From 5c552f97e4553947b17534ffbe091dc9ef958efe Mon Sep 17 00:00:00 2001 From: bbedward Date: Mon, 31 Aug 2026 09:36:16 -0400 Subject: [PATCH] theme: add widgetInactiveIconColor token, apply to volume 0 --- quickshell/Common/Theme.qml | 2 ++ .../DankBar/Widgets/ControlCenterButton.qml | 10 ++++++++-- quickshell/Modules/Greetd/GreeterContent.qml | 16 ++-------------- quickshell/Modules/Lock/LockScreenContent.qml | 2 +- quickshell/Modules/OSD/VolumeOSD.qml | 4 ++-- quickshell/Services/AudioService.qml | 8 ++++++++ 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/quickshell/Common/Theme.qml b/quickshell/Common/Theme.qml index e0c4bdaf8..817dbb299 100644 --- a/quickshell/Common/Theme.qml +++ b/quickshell/Common/Theme.qml @@ -1464,6 +1464,8 @@ Singleton { } } + property color widgetInactiveIconColor: withAlpha(widgetIconColor, 0.6) + property color widgetTextColor: { if (typeof SettingsData === "undefined") { return surfaceText; diff --git a/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml b/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml index 6c6327c91..62dcb049a 100644 --- a/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml +++ b/quickshell/Modules/DankBar/Widgets/ControlCenterButton.qml @@ -164,6 +164,12 @@ BasePill { return Theme.widgetIconColor; } + function getAudioIconColor() { + if (AudioService.sinkSilent) + return Theme.widgetInactiveIconColor; + return Theme.widgetIconColor; + } + function getBrightnessIconName() { const deviceName = getEffectiveBrightnessDevice(); return DisplayService.brightnessIconName(DisplayService.getCurrentDeviceInfoByName(deviceName), DisplayService.getDeviceBrightness(deviceName)); @@ -545,7 +551,7 @@ BasePill { visible: verticalGroupItem.modelData.id === "audio" name: AudioService.sinkVolumeIconName size: root.vIconSize - color: Theme.widgetIconColor + color: root.getAudioIconColor() anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top } @@ -745,7 +751,7 @@ BasePill { id: audioIcon name: AudioService.sinkVolumeIconName size: root.getControlCenterIconSize() - color: Theme.widgetIconColor + color: root.getAudioIconColor() anchors.verticalCenter: parent.verticalCenter } diff --git a/quickshell/Modules/Greetd/GreeterContent.qml b/quickshell/Modules/Greetd/GreeterContent.qml index 77e5f7bd2..351da2860 100644 --- a/quickshell/Modules/Greetd/GreeterContent.qml +++ b/quickshell/Modules/Greetd/GreeterContent.qml @@ -1575,21 +1575,9 @@ Item { } DankIcon { - name: { - if (!AudioService.sink?.audio) { - return "volume_up"; - } - if (AudioService.sink.audio.muted) - return "volume_off"; - if (AudioService.sink.audio.volume === 0) - return "volume_mute"; - if (AudioService.sink.audio.volume * 100 < 33) { - return "volume_down"; - } - return "volume_up"; - } + name: AudioService.sinkVolumeIconName size: Theme.iconSize - 2 - color: (AudioService.sink && AudioService.sink.audio && (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0)) ? Qt.rgba(255, 255, 255, 0.5) : "white" + color: AudioService.sinkSilent ? Qt.rgba(255, 255, 255, 0.5) : "white" anchors.verticalCenter: parent.verticalCenter visible: AudioService.sink && AudioService.sink.audio } diff --git a/quickshell/Modules/Lock/LockScreenContent.qml b/quickshell/Modules/Lock/LockScreenContent.qml index 2eec3ff77..e7da178dd 100644 --- a/quickshell/Modules/Lock/LockScreenContent.qml +++ b/quickshell/Modules/Lock/LockScreenContent.qml @@ -1866,7 +1866,7 @@ Item { DankIcon { name: AudioService.sinkVolumeIconName size: Theme.iconSize - 2 - color: (AudioService.sink && AudioService.sink.audio && (AudioService.sink.audio.muted || AudioService.sink.audio.volume === 0)) ? Qt.rgba(255, 255, 255, 0.5) : "white" + color: AudioService.sinkSilent ? Qt.rgba(255, 255, 255, 0.5) : "white" anchors.verticalCenter: parent.verticalCenter visible: AudioService.sink && AudioService.sink.audio } diff --git a/quickshell/Modules/OSD/VolumeOSD.qml b/quickshell/Modules/OSD/VolumeOSD.qml index 1d9267849..e66598d86 100644 --- a/quickshell/Modules/OSD/VolumeOSD.qml +++ b/quickshell/Modules/OSD/VolumeOSD.qml @@ -65,7 +65,7 @@ DankOSD { OsdLevelRow { anchors.fill: parent - iconName: AudioService.sink?.audio?.muted ? "volume_off" : "volume_up" + iconName: AudioService.sinkVolumeIconName iconInteractive: true value: root._displayVolume minimum: 0 @@ -108,7 +108,7 @@ DankOSD { DankIcon { anchors.centerIn: parent - name: AudioService.sink?.audio?.muted ? "volume_off" : "volume_up" + name: AudioService.sinkVolumeIconName size: Theme.iconSize color: muteButtonVert.containsMouse ? Theme.primary : Theme.surfaceText } diff --git a/quickshell/Services/AudioService.qml b/quickshell/Services/AudioService.qml index 270298904..101d4fe76 100644 --- a/quickshell/Services/AudioService.qml +++ b/quickshell/Services/AudioService.qml @@ -796,6 +796,14 @@ EOFCONFIG } readonly property string sinkVolumeIconName: volumeIconName(sink) + readonly property bool sinkSilent: isSilent(sink) + + function isSilent(node) { + const audio = node?.audio; + if (!audio) + return false; + return audio.muted || audio.volume === 0; + } function volumeIconName(node, noDeviceIcon = "volume_off") { const audio = node?.audio;