mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-10 07:25:37 -05:00
remove unused functions/dead code
This commit is contained in:
@@ -14,55 +14,6 @@ Singleton {
|
||||
|
||||
signal volumeChanged()
|
||||
|
||||
function displayName(node) {
|
||||
if (!node) return ""
|
||||
|
||||
if (node.properties && node.properties["device.description"]) {
|
||||
return node.properties["device.description"]
|
||||
}
|
||||
|
||||
if (node.description && node.description !== node.name) {
|
||||
return node.description
|
||||
}
|
||||
|
||||
if (node.nickname && node.nickname !== node.name) {
|
||||
return node.nickname
|
||||
}
|
||||
|
||||
if (node.name.includes("analog-stereo")) return "Built-in Speakers"
|
||||
else if (node.name.includes("bluez")) return "Bluetooth Audio"
|
||||
else if (node.name.includes("usb")) return "USB Audio"
|
||||
else if (node.name.includes("hdmi")) return "HDMI Audio"
|
||||
|
||||
return node.name
|
||||
}
|
||||
|
||||
function subtitle(name) {
|
||||
if (!name) return ""
|
||||
|
||||
if (name.includes('usb-')) {
|
||||
if (name.includes('SteelSeries')) {
|
||||
return "USB Gaming Headset"
|
||||
} else if (name.includes('Generic')) {
|
||||
return "USB Audio Device"
|
||||
}
|
||||
return "USB Audio"
|
||||
} else if (name.includes('pci-')) {
|
||||
if (name.includes('01_00.1') || name.includes('01:00.1')) {
|
||||
return "NVIDIA GPU Audio"
|
||||
}
|
||||
return "PCI Audio"
|
||||
} else if (name.includes('bluez')) {
|
||||
return "Bluetooth Audio"
|
||||
} else if (name.includes('analog')) {
|
||||
return "Built-in Audio"
|
||||
} else if (name.includes('hdmi')) {
|
||||
return "HDMI Audio"
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
PwObjectTracker {
|
||||
objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]
|
||||
}
|
||||
@@ -73,30 +24,13 @@ Singleton {
|
||||
if (root.sink && root.sink.audio) {
|
||||
const clampedVolume = Math.max(0, Math.min(100, percentage));
|
||||
root.sink.audio.volume = clampedVolume / 100;
|
||||
root.volumeChanged();
|
||||
return "Volume set to " + clampedVolume + "%";
|
||||
}
|
||||
return "No audio sink available";
|
||||
}
|
||||
|
||||
function incrementVolume(step) {
|
||||
if (root.sink && root.sink.audio) {
|
||||
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||
const newVolume = Math.max(0, Math.min(100, currentVolume + step));
|
||||
root.sink.audio.volume = newVolume / 100;
|
||||
return "Volume increased to " + newVolume + "%";
|
||||
}
|
||||
return "No audio sink available";
|
||||
}
|
||||
|
||||
function decrementVolume(step) {
|
||||
if (root.sink && root.sink.audio) {
|
||||
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||
const newVolume = Math.max(0, Math.min(100, currentVolume - step));
|
||||
root.sink.audio.volume = newVolume / 100;
|
||||
return "Volume decreased to " + newVolume + "%";
|
||||
}
|
||||
return "No audio sink available";
|
||||
}
|
||||
|
||||
function toggleMute() {
|
||||
if (root.sink && root.sink.audio) {
|
||||
@@ -128,27 +62,33 @@ Singleton {
|
||||
target: "audio"
|
||||
|
||||
function setvolume(percentage: string): string {
|
||||
const result = root.setVolume(parseInt(percentage));
|
||||
root.volumeChanged();
|
||||
return result;
|
||||
return root.setVolume(parseInt(percentage));
|
||||
}
|
||||
|
||||
function increment(step: string): string {
|
||||
const result = root.incrementVolume(parseInt(step || "5"));
|
||||
if (root.sink && root.sink.audio) {
|
||||
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||
const newVolume = Math.max(0, Math.min(100, currentVolume + parseInt(step || "5")));
|
||||
root.sink.audio.volume = newVolume / 100;
|
||||
root.volumeChanged();
|
||||
return result;
|
||||
return "Volume increased to " + newVolume + "%";
|
||||
}
|
||||
return "No audio sink available";
|
||||
}
|
||||
|
||||
function decrement(step: string): string {
|
||||
const result = root.decrementVolume(parseInt(step || "5"));
|
||||
if (root.sink && root.sink.audio) {
|
||||
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||
const newVolume = Math.max(0, Math.min(100, currentVolume - parseInt(step || "5")));
|
||||
root.sink.audio.volume = newVolume / 100;
|
||||
root.volumeChanged();
|
||||
return result;
|
||||
return "Volume decreased to " + newVolume + "%";
|
||||
}
|
||||
return "No audio sink available";
|
||||
}
|
||||
|
||||
function mute(): string {
|
||||
const result = root.toggleMute();
|
||||
root.volumeChanged();
|
||||
return result;
|
||||
return root.toggleMute();
|
||||
}
|
||||
|
||||
function setmic(percentage: string): string {
|
||||
|
||||
@@ -54,9 +54,4 @@ Singleton {
|
||||
else
|
||||
return minutes + "m";
|
||||
}
|
||||
|
||||
function getBluetoothDevices() {
|
||||
return bluetoothDevices;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -114,9 +114,6 @@ Singleton {
|
||||
return !device.paired && !device.pairing && !device.blocked;
|
||||
}
|
||||
|
||||
function debugDevice(device) {
|
||||
console.log("Device:", device.name, "paired:", device.paired, "connected:", device.connected, "signalStrength:", device.signalStrength);
|
||||
}
|
||||
|
||||
|
||||
function getSignalStrength(device) {
|
||||
@@ -170,7 +167,4 @@ Singleton {
|
||||
device.trusted = true;
|
||||
device.connect();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -27,14 +27,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
function increaseBrightness() {
|
||||
setBrightness(brightnessLevel + 10);
|
||||
}
|
||||
|
||||
function decreaseBrightness() {
|
||||
setBrightness(brightnessLevel - 10);
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
ddcAvailabilityChecker.running = true;
|
||||
laptopBacklightChecker.running = true;
|
||||
|
||||
@@ -333,13 +333,6 @@ Singleton {
|
||||
return false
|
||||
}
|
||||
|
||||
function getWorkspaceByIndex(index) {
|
||||
if (index >= 0 && index < allWorkspaces.length) {
|
||||
return allWorkspaces[index]
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
function getCurrentOutputWorkspaceNumbers() {
|
||||
return currentOutputWorkspaces.map(w => w.idx + 1) // niri uses 0-based, UI shows 1-based
|
||||
}
|
||||
@@ -350,17 +343,4 @@ Singleton {
|
||||
}
|
||||
return 1
|
||||
}
|
||||
|
||||
function isWorkspaceActive(workspaceNumber) {
|
||||
return workspaceNumber === getCurrentWorkspaceNumber()
|
||||
}
|
||||
|
||||
// For compatibility with existing components
|
||||
function getCurrentWorkspace() {
|
||||
return getCurrentWorkspaceNumber()
|
||||
}
|
||||
|
||||
function getWorkspaceList() {
|
||||
return getCurrentOutputWorkspaceNumbers()
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ Singleton {
|
||||
|
||||
property list<NotifWrapper> notificationQueue: []
|
||||
property list<NotifWrapper> visibleNotifications: []
|
||||
property list<NotifWrapper> history: []
|
||||
property int maxHistory: 200
|
||||
property int maxVisibleNotifications: 3
|
||||
property bool addGateBusy: false
|
||||
property int enterAnimMs: 400
|
||||
@@ -42,10 +40,6 @@ Singleton {
|
||||
property var expandedMessages: ({})
|
||||
property bool popupsDisabled: false
|
||||
|
||||
// Notification persistence settings
|
||||
property int maxStoredNotifications: 100
|
||||
property int maxNotificationAge: 7 * 24 * 60 * 60 * 1000 // 7 days in milliseconds
|
||||
property var persistedNotifications: ([]) // Stored notification history
|
||||
|
||||
NotificationServer {
|
||||
id: server
|
||||
@@ -71,7 +65,6 @@ Singleton {
|
||||
if (wrapper) {
|
||||
root.allWrappers.push(wrapper);
|
||||
root.notifications.push(wrapper);
|
||||
addToPersistentStorage(wrapper);
|
||||
|
||||
if (shouldShowPopup) {
|
||||
notificationQueue = [...notificationQueue, wrapper];
|
||||
@@ -209,10 +202,6 @@ Singleton {
|
||||
wrapper.notification.dismiss();
|
||||
}
|
||||
|
||||
function hidePopup(wrapper) {
|
||||
wrapper.popup = false;
|
||||
}
|
||||
|
||||
function disablePopups(disable) {
|
||||
popupsDisabled = disable;
|
||||
if (disable) {
|
||||
@@ -267,15 +256,8 @@ Singleton {
|
||||
notificationQueue = q;
|
||||
}
|
||||
|
||||
// Push to bounded history or destroy if non-persistent
|
||||
if (w && w.isPersistent) {
|
||||
let h = history.slice();
|
||||
h.push(w);
|
||||
if (h.length > maxHistory) {
|
||||
h.splice(0, h.length - maxHistory);
|
||||
}
|
||||
history = h;
|
||||
} else if (w && w.destroy) {
|
||||
// Destroy wrapper if non-persistent
|
||||
if (w && w.destroy && !w.isPersistent) {
|
||||
w.destroy();
|
||||
}
|
||||
}
|
||||
@@ -383,7 +365,6 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function clearGroupExpansionState(groupKey) {
|
||||
let newExpandedGroups = {};
|
||||
for (const key in expandedGroups) {
|
||||
@@ -394,7 +375,6 @@ Singleton {
|
||||
expandedGroups = newExpandedGroups;
|
||||
}
|
||||
|
||||
|
||||
function cleanupExpansionStates() {
|
||||
const currentGroupKeys = new Set(groupedNotifications.map(g => g.key));
|
||||
const currentMessageIds = new Set();
|
||||
@@ -428,48 +408,6 @@ Singleton {
|
||||
expandedMessages = newExpandedMessages;
|
||||
}
|
||||
|
||||
function getGroupTitle(group) {
|
||||
if (group.count === 1) {
|
||||
return group.latestNotification.summary;
|
||||
}
|
||||
return `${group.count} notifications`;
|
||||
}
|
||||
|
||||
function getGroupBody(group) {
|
||||
if (group.count === 1) {
|
||||
return group.latestNotification.htmlBody; // Use HTML body
|
||||
}
|
||||
return `Latest: ${group.latestNotification.summary}`;
|
||||
}
|
||||
|
||||
function addToPersistentStorage(wrapper) {
|
||||
const persistedNotif = {
|
||||
id: wrapper.notification.id,
|
||||
appName: wrapper.appName,
|
||||
summary: wrapper.summary,
|
||||
body: wrapper.body,
|
||||
htmlBody: wrapper.htmlBody, // Store HTML version too
|
||||
appIcon: wrapper.appIcon,
|
||||
image: wrapper.image,
|
||||
urgency: wrapper.urgency,
|
||||
timestamp: wrapper.time.getTime(),
|
||||
};
|
||||
persistedNotifications.unshift(persistedNotif);
|
||||
cleanupPersistentStorage();
|
||||
}
|
||||
|
||||
function cleanupPersistentStorage() {
|
||||
const now = new Date().getTime();
|
||||
let newPersisted = [];
|
||||
for (let i = 0; i < persistedNotifications.length && i < maxStoredNotifications; i++) {
|
||||
const notif = persistedNotifications[i];
|
||||
if (now - notif.timestamp < maxNotificationAge) {
|
||||
newPersisted.push(notif);
|
||||
}
|
||||
}
|
||||
persistedNotifications = newPersisted;
|
||||
}
|
||||
|
||||
|
||||
Connections {
|
||||
target: Prefs
|
||||
@@ -488,7 +426,4 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
cleanupPersistentStorage();
|
||||
}
|
||||
}
|
||||
@@ -357,31 +357,6 @@ Singleton {
|
||||
return (mem / (1024 * 1024)).toFixed(1) + " GB";
|
||||
}
|
||||
|
||||
function formatMemory(mb) {
|
||||
const mem = mb || 0;
|
||||
if (mem >= 1024)
|
||||
return (mem / 1024).toFixed(1) + " GB";
|
||||
return mem.toFixed(0) + " MB";
|
||||
}
|
||||
|
||||
function getCpuUsageColor() {
|
||||
if (cpuUsage > 80) return "#e74c3c";
|
||||
if (cpuUsage > 60) return "#f39c12";
|
||||
return "#27ae60";
|
||||
}
|
||||
|
||||
function getMemoryUsageColor() {
|
||||
if (memoryUsage > 90) return "#e74c3c";
|
||||
if (memoryUsage > 75) return "#f39c12";
|
||||
return "#3498db";
|
||||
}
|
||||
|
||||
function getTemperatureColor() {
|
||||
if (cpuTemperature > 80) return "#e74c3c";
|
||||
if (cpuTemperature > 65) return "#f39c12";
|
||||
return "#27ae60";
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: updateTimer
|
||||
interval: root.updateInterval
|
||||
|
||||
Reference in New Issue
Block a user