diff --git a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml index 907f0f76..f59f56ea 100644 --- a/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml +++ b/quickshell/Modules/ControlCenter/Components/DragDropGrid.qml @@ -28,10 +28,6 @@ Column { signal collapseRequested signal configRequested(int index, var widgetData, var anchor) - function requestCollapse() { - collapseRequested(); - } - spacing: editMode ? Theme.spacingL : Theme.spacingS property real maxPopoutHeight: 9999 @@ -103,39 +99,56 @@ Column { } function getCompoundPillIconBlinking(id) { - if (id === "wifi") return NetworkService.isWifiConnecting; - if (id === "bluetooth") return BluetoothService.connecting; + if (id === "wifi") + return NetworkService.isWifiConnecting; + if (id === "bluetooth") + return BluetoothService.connecting; return false; } function getCompoundPillIconName(id, widgetDef) { switch (id) { - case "wifi": { - if (NetworkService.wifiToggling) return "sync"; - if (NetworkService.isConnecting && !NetworkService.ethernetConnected) return NetworkService.wifiSignalIcon; - const status = NetworkService.networkStatus; - if (status === "ethernet") return "settings_ethernet"; - if (status === "vpn") return NetworkService.ethernetConnected ? "settings_ethernet" : NetworkService.wifiSignalIcon; - if (status === "wifi") return NetworkService.wifiSignalIcon; - return "wifi"; - } - case "bluetooth": { - return "bluetooth"; - } - case "audioOutput": { - if (!AudioService.sink?.audio) return "volume_off"; - let volume = AudioService.sink.audio.volume; - let muted = AudioService.sink.audio.muted; - if (muted) return "volume_off"; - if (volume === 0.0) return "volume_mute"; - if (volume <= 0.33) return "volume_down"; - if (volume <= 0.66) return "volume_up"; - return "volume_up"; - } - case "audioInput": { - if (!AudioService.source?.audio) return "mic_off"; - return AudioService.source.audio.muted ? "mic_off" : "mic"; - } + case "wifi": + { + if (NetworkService.wifiToggling) + return "sync"; + if (NetworkService.isConnecting && !NetworkService.ethernetConnected) + return NetworkService.wifiSignalIcon; + const status = NetworkService.networkStatus; + if (status === "ethernet") + return "settings_ethernet"; + if (status === "vpn") + return NetworkService.ethernetConnected ? "settings_ethernet" : NetworkService.wifiSignalIcon; + if (status === "wifi") + return NetworkService.wifiSignalIcon; + return "wifi"; + } + case "bluetooth": + { + return "bluetooth"; + } + case "audioOutput": + { + if (!AudioService.sink?.audio) + return "volume_off"; + let volume = AudioService.sink.audio.volume; + let muted = AudioService.sink.audio.muted; + if (muted) + return "volume_off"; + if (volume === 0.0) + return "volume_mute"; + if (volume <= 0.33) + return "volume_down"; + if (volume <= 0.66) + return "volume_up"; + return "volume_up"; + } + case "audioInput": + { + if (!AudioService.source?.audio) + return "mic_off"; + return AudioService.source.audio.muted ? "mic_off" : "mic"; + } default: return widgetDef?.icon || "help"; } @@ -143,14 +156,19 @@ Column { function getCompoundPillIsActive(id) { switch (id) { - case "wifi": { - if (NetworkService.wifiToggling) return false; - const status = NetworkService.networkStatus; - if (status === "ethernet") return true; - if (status === "vpn") return NetworkService.ethernetConnected || NetworkService.wifiConnected; - if (status === "wifi") return true; - return NetworkService.wifiEnabled; - } + case "wifi": + { + if (NetworkService.wifiToggling) + return false; + const status = NetworkService.networkStatus; + if (status === "ethernet") + return true; + if (status === "vpn") + return NetworkService.ethernetConnected || NetworkService.wifiConnected; + if (status === "wifi") + return true; + return NetworkService.wifiEnabled; + } case "bluetooth": return !!(BluetoothService.available && BluetoothService.adapter && BluetoothService.adapter.enabled); case "audioOutput": @@ -164,52 +182,62 @@ Column { function handleCompoundPillToggled(id) { switch (id) { - case "wifi": { - if (NetworkService.networkStatus !== "ethernet" && !NetworkService.wifiToggling) { - NetworkService.toggleWifiRadio(); + case "wifi": + { + if (NetworkService.networkStatus !== "ethernet" && !NetworkService.wifiToggling) { + NetworkService.toggleWifiRadio(); + } + break; } - break; - } - case "bluetooth": { - if (BluetoothService.available && BluetoothService.adapter) { - BluetoothService.adapter.enabled = !BluetoothService.adapter.enabled; + case "bluetooth": + { + if (BluetoothService.available && BluetoothService.adapter) { + BluetoothService.adapter.enabled = !BluetoothService.adapter.enabled; + } + break; } - break; - } - case "audioOutput": { - if (AudioService.sink && AudioService.sink.audio) { - AudioService.sink.audio.muted = !AudioService.sink.audio.muted; + case "audioOutput": + { + if (AudioService.sink && AudioService.sink.audio) { + AudioService.sink.audio.muted = !AudioService.sink.audio.muted; + } + break; } - break; - } - case "audioInput": { - if (AudioService.source && AudioService.source.audio) { - AudioService.source.audio.muted = !AudioService.source.audio.muted; + case "audioInput": + { + if (AudioService.source && AudioService.source.audio) { + AudioService.source.audio.muted = !AudioService.source.audio.muted; + } + break; } - break; - } } } function handleCompoundPillWheelEvent(id, wheelEvent) { if (id === "audioOutput") { - if (!AudioService.sink || !AudioService.sink.audio) return; + if (!AudioService.sink || !AudioService.sink.audio) + return; let delta = wheelEvent.angleDelta.y; let maxVol = AudioService.sinkMaxVolume; let currentVolume = AudioService.sink.audio.volume * 100; let newVolume; - if (delta > 0) newVolume = Math.min(maxVol, currentVolume + 5); - else newVolume = Math.max(0, currentVolume - 5); + if (delta > 0) + newVolume = Math.min(maxVol, currentVolume + 5); + else + newVolume = Math.max(0, currentVolume - 5); AudioService.sink.audio.muted = false; AudioService.sink.audio.volume = newVolume / 100; wheelEvent.accepted = true; } else if (id === "audioInput") { - if (!AudioService.source || !AudioService.source.audio) return; + if (!AudioService.source || !AudioService.source.audio) + return; let delta = wheelEvent.angleDelta.y; let currentVolume = AudioService.source.audio.volume * 100; let newVolume; - if (delta > 0) newVolume = Math.min(100, currentVolume + 5); - else newVolume = Math.max(0, currentVolume - 5); + if (delta > 0) + newVolume = Math.min(100, currentVolume + 5); + else + newVolume = Math.max(0, currentVolume - 5); AudioService.source.audio.muted = false; AudioService.source.audio.volume = newVolume / 100; wheelEvent.accepted = true; @@ -354,7 +382,7 @@ Column { expandedWidgetData: active ? root.expandedWidgetData : retainedWidgetData bluetoothCodecSelector: root.bluetoothCodecSelector widgetModel: root.model - collapseCallback: root.requestCollapse + collapseCallback: root.collapseRequested screenName: root.screenName screenModel: root.screenModel @@ -1208,15 +1236,18 @@ Column { isActive: root.getCompoundPillIsActive(widgetData.id || "") enabled: (widgetDef?.enabled ?? true) && !root.editMode onToggled: { - if (root.editMode) return; + if (root.editMode) + return; root.handleCompoundPillToggled(widgetData.id || ""); } onExpandClicked: { - if (root.editMode) return; + if (root.editMode) + return; root.expandClicked(widgetData, widgetIndex); } - onWheelEvent: function(wheelEvent) { - if (root.editMode) return; + onWheelEvent: function (wheelEvent) { + if (root.editMode) + return; root.handleCompoundPillWheelEvent(widgetData.id || "", wheelEvent); } } @@ -1231,7 +1262,8 @@ Column { height: 48 colorPickerModal: root.colorPickerModal onClicked: { - if (root.editMode) return; + if (root.editMode) + return; if (root.colorPickerModal) root.colorPickerModal.show(); } diff --git a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml index 40dc74a4..1a379f65 100644 --- a/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml +++ b/quickshell/Modules/DankBar/Widgets/SystemTrayBar.qml @@ -1538,15 +1538,11 @@ BasePill { } } - function closeWithAction() { - close(); - } - Timer { id: pendingActionCloseTimer interval: 80 repeat: false - onTriggered: menuRoot.closeWithAction() + onTriggered: menuRoot.close() } function showSubMenu(entry) { @@ -1906,7 +1902,7 @@ BasePill { } else { SessionData.hideTrayId(itemKey); } - menuRoot.closeWithAction(); + menuRoot.close(); } } } diff --git a/quickshell/Modules/Notepad/Notepad.qml b/quickshell/Modules/Notepad/Notepad.qml index c9d65656..4b6ef589 100644 --- a/quickshell/Modules/Notepad/Notepad.qml +++ b/quickshell/Modules/Notepad/Notepad.qml @@ -102,15 +102,7 @@ Item { return textEditor.hasUnsavedChanges(); } - function hasUnsavedTemporaryContent() { - return hasUnsavedChanges(); - } - function createNewTab() { - performCreateNewTab(); - } - - function performCreateNewTab() { textEditor.commitLiveBuffer(); NotepadStorageService.createNewTab(); textEditor.applyingShared = true; @@ -221,7 +213,7 @@ Item { } function loadFromFile(fileUrl) { - if (hasUnsavedTemporaryContent()) { + if (hasUnsavedChanges()) { root.pendingFileUrl = fileUrl; root.pendingAction = "load_file"; root.confirmationDialogOpen = true; diff --git a/quickshell/Modules/Plugins/PluginControlCenterWrapper.qml b/quickshell/Modules/Plugins/PluginControlCenterWrapper.qml index 5d408263..b5ccd4fb 100644 --- a/quickshell/Modules/Plugins/PluginControlCenterWrapper.qml +++ b/quickshell/Modules/Plugins/PluginControlCenterWrapper.qml @@ -19,33 +19,25 @@ Item { readonly property Component detailContent: pluginInstance?.ccDetailContent || null readonly property real detailHeight: pluginInstance?.ccDetailHeight || 250 - signal toggled() - signal expanded() + signal toggled + signal expanded Component.onCompleted: { if (pluginInstance) { - pluginInstance.ccWidgetToggled.connect(handleToggled) - pluginInstance.ccWidgetExpanded.connect(handleExpanded) + pluginInstance.ccWidgetToggled.connect(toggled); + pluginInstance.ccWidgetExpanded.connect(expanded); } } - function handleToggled() { - toggled() - } - - function handleExpanded() { - expanded() - } - function invokeToggle() { if (pluginInstance) { - pluginInstance.ccWidgetToggled() + pluginInstance.ccWidgetToggled(); } } function invokeExpand() { if (pluginInstance) { - pluginInstance.ccWidgetExpanded() + pluginInstance.ccWidgetExpanded(); } } } diff --git a/quickshell/Services/ChangelogService.qml b/quickshell/Services/ChangelogService.qml index f3cb9e35..c6977ab7 100644 --- a/quickshell/Services/ChangelogService.qml +++ b/quickshell/Services/ChangelogService.qml @@ -62,10 +62,6 @@ Singleton { } } - function showChangelog() { - changelogRequested(); - } - function dismissChangelog() { changelogDismissed = true; touchMarkerProcess.running = true; diff --git a/quickshell/Services/IdleService.qml b/quickshell/Services/IdleService.qml index 4ececaf5..8ce9919f 100644 --- a/quickshell/Services/IdleService.qml +++ b/quickshell/Services/IdleService.qml @@ -64,10 +64,6 @@ Singleton { property bool monitorsOff: false property bool isShellLocked: false - function wake() { - requestMonitorOn(); - } - function reapplyDpmsIfNeeded() { if (monitorsOff) CompositorService.powerOffMonitors();