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()
|
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 {
|
PwObjectTracker {
|
||||||
objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]
|
objects: [Pipewire.defaultAudioSink, Pipewire.defaultAudioSource]
|
||||||
}
|
}
|
||||||
@@ -73,30 +24,13 @@ Singleton {
|
|||||||
if (root.sink && root.sink.audio) {
|
if (root.sink && root.sink.audio) {
|
||||||
const clampedVolume = Math.max(0, Math.min(100, percentage));
|
const clampedVolume = Math.max(0, Math.min(100, percentage));
|
||||||
root.sink.audio.volume = clampedVolume / 100;
|
root.sink.audio.volume = clampedVolume / 100;
|
||||||
|
root.volumeChanged();
|
||||||
return "Volume set to " + clampedVolume + "%";
|
return "Volume set to " + clampedVolume + "%";
|
||||||
}
|
}
|
||||||
return "No audio sink available";
|
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() {
|
function toggleMute() {
|
||||||
if (root.sink && root.sink.audio) {
|
if (root.sink && root.sink.audio) {
|
||||||
@@ -128,27 +62,33 @@ Singleton {
|
|||||||
target: "audio"
|
target: "audio"
|
||||||
|
|
||||||
function setvolume(percentage: string): string {
|
function setvolume(percentage: string): string {
|
||||||
const result = root.setVolume(parseInt(percentage));
|
return root.setVolume(parseInt(percentage));
|
||||||
root.volumeChanged();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function increment(step: string): string {
|
function increment(step: string): string {
|
||||||
const result = root.incrementVolume(parseInt(step || "5"));
|
if (root.sink && root.sink.audio) {
|
||||||
root.volumeChanged();
|
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||||
return result;
|
const newVolume = Math.max(0, Math.min(100, currentVolume + parseInt(step || "5")));
|
||||||
|
root.sink.audio.volume = newVolume / 100;
|
||||||
|
root.volumeChanged();
|
||||||
|
return "Volume increased to " + newVolume + "%";
|
||||||
|
}
|
||||||
|
return "No audio sink available";
|
||||||
}
|
}
|
||||||
|
|
||||||
function decrement(step: string): string {
|
function decrement(step: string): string {
|
||||||
const result = root.decrementVolume(parseInt(step || "5"));
|
if (root.sink && root.sink.audio) {
|
||||||
root.volumeChanged();
|
const currentVolume = Math.round(root.sink.audio.volume * 100);
|
||||||
return result;
|
const newVolume = Math.max(0, Math.min(100, currentVolume - parseInt(step || "5")));
|
||||||
|
root.sink.audio.volume = newVolume / 100;
|
||||||
|
root.volumeChanged();
|
||||||
|
return "Volume decreased to " + newVolume + "%";
|
||||||
|
}
|
||||||
|
return "No audio sink available";
|
||||||
}
|
}
|
||||||
|
|
||||||
function mute(): string {
|
function mute(): string {
|
||||||
const result = root.toggleMute();
|
return root.toggleMute();
|
||||||
root.volumeChanged();
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setmic(percentage: string): string {
|
function setmic(percentage: string): string {
|
||||||
|
|||||||
@@ -54,9 +54,4 @@ Singleton {
|
|||||||
else
|
else
|
||||||
return minutes + "m";
|
return minutes + "m";
|
||||||
}
|
}
|
||||||
|
|
||||||
function getBluetoothDevices() {
|
|
||||||
return bluetoothDevices;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,9 +114,6 @@ Singleton {
|
|||||||
return !device.paired && !device.pairing && !device.blocked;
|
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) {
|
function getSignalStrength(device) {
|
||||||
@@ -170,7 +167,4 @@ Singleton {
|
|||||||
device.trusted = true;
|
device.trusted = true;
|
||||||
device.connect();
|
device.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function increaseBrightness() {
|
|
||||||
setBrightness(brightnessLevel + 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
function decreaseBrightness() {
|
|
||||||
setBrightness(brightnessLevel - 10);
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ddcAvailabilityChecker.running = true;
|
ddcAvailabilityChecker.running = true;
|
||||||
laptopBacklightChecker.running = true;
|
laptopBacklightChecker.running = true;
|
||||||
|
|||||||
@@ -333,13 +333,6 @@ Singleton {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWorkspaceByIndex(index) {
|
|
||||||
if (index >= 0 && index < allWorkspaces.length) {
|
|
||||||
return allWorkspaces[index]
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentOutputWorkspaceNumbers() {
|
function getCurrentOutputWorkspaceNumbers() {
|
||||||
return currentOutputWorkspaces.map(w => w.idx + 1) // niri uses 0-based, UI shows 1-based
|
return currentOutputWorkspaces.map(w => w.idx + 1) // niri uses 0-based, UI shows 1-based
|
||||||
}
|
}
|
||||||
@@ -350,17 +343,4 @@ Singleton {
|
|||||||
}
|
}
|
||||||
return 1
|
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> notificationQueue: []
|
||||||
property list<NotifWrapper> visibleNotifications: []
|
property list<NotifWrapper> visibleNotifications: []
|
||||||
property list<NotifWrapper> history: []
|
|
||||||
property int maxHistory: 200
|
|
||||||
property int maxVisibleNotifications: 3
|
property int maxVisibleNotifications: 3
|
||||||
property bool addGateBusy: false
|
property bool addGateBusy: false
|
||||||
property int enterAnimMs: 400
|
property int enterAnimMs: 400
|
||||||
@@ -42,10 +40,6 @@ Singleton {
|
|||||||
property var expandedMessages: ({})
|
property var expandedMessages: ({})
|
||||||
property bool popupsDisabled: false
|
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 {
|
NotificationServer {
|
||||||
id: server
|
id: server
|
||||||
@@ -71,7 +65,6 @@ Singleton {
|
|||||||
if (wrapper) {
|
if (wrapper) {
|
||||||
root.allWrappers.push(wrapper);
|
root.allWrappers.push(wrapper);
|
||||||
root.notifications.push(wrapper);
|
root.notifications.push(wrapper);
|
||||||
addToPersistentStorage(wrapper);
|
|
||||||
|
|
||||||
if (shouldShowPopup) {
|
if (shouldShowPopup) {
|
||||||
notificationQueue = [...notificationQueue, wrapper];
|
notificationQueue = [...notificationQueue, wrapper];
|
||||||
@@ -209,10 +202,6 @@ Singleton {
|
|||||||
wrapper.notification.dismiss();
|
wrapper.notification.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
function hidePopup(wrapper) {
|
|
||||||
wrapper.popup = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function disablePopups(disable) {
|
function disablePopups(disable) {
|
||||||
popupsDisabled = disable;
|
popupsDisabled = disable;
|
||||||
if (disable) {
|
if (disable) {
|
||||||
@@ -267,15 +256,8 @@ Singleton {
|
|||||||
notificationQueue = q;
|
notificationQueue = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push to bounded history or destroy if non-persistent
|
// Destroy wrapper if non-persistent
|
||||||
if (w && w.isPersistent) {
|
if (w && w.destroy && !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) {
|
|
||||||
w.destroy();
|
w.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -383,7 +365,6 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function clearGroupExpansionState(groupKey) {
|
function clearGroupExpansionState(groupKey) {
|
||||||
let newExpandedGroups = {};
|
let newExpandedGroups = {};
|
||||||
for (const key in expandedGroups) {
|
for (const key in expandedGroups) {
|
||||||
@@ -394,7 +375,6 @@ Singleton {
|
|||||||
expandedGroups = newExpandedGroups;
|
expandedGroups = newExpandedGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function cleanupExpansionStates() {
|
function cleanupExpansionStates() {
|
||||||
const currentGroupKeys = new Set(groupedNotifications.map(g => g.key));
|
const currentGroupKeys = new Set(groupedNotifications.map(g => g.key));
|
||||||
const currentMessageIds = new Set();
|
const currentMessageIds = new Set();
|
||||||
@@ -428,48 +408,6 @@ Singleton {
|
|||||||
expandedMessages = newExpandedMessages;
|
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 {
|
Connections {
|
||||||
target: Prefs
|
target: Prefs
|
||||||
@@ -488,7 +426,4 @@ Singleton {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
cleanupPersistentStorage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -357,31 +357,6 @@ Singleton {
|
|||||||
return (mem / (1024 * 1024)).toFixed(1) + " GB";
|
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 {
|
Timer {
|
||||||
id: updateTimer
|
id: updateTimer
|
||||||
interval: root.updateInterval
|
interval: root.updateInterval
|
||||||
|
|||||||
Reference in New Issue
Block a user