diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index b821323c..93a477b3 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -305,6 +305,12 @@ Singleton { property int notificationPopupPosition: SettingsData.Position.Top property bool osdAlwaysShowValue: false + property bool osdVolumeEnabled: true + property bool osdBrightnessEnabled: true + property bool osdIdleInhibitorEnabled: true + property bool osdMicMuteEnabled: true + property bool osdCapsLockEnabled: true + property bool osdPowerProfileEnabled: true property bool powerActionConfirm: true property var powerMenuActions: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"] diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index a3913244..55039bcd 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -215,6 +215,12 @@ var SPEC = { notificationPopupPosition: { def: 0 }, osdAlwaysShowValue: { def: false }, + osdVolumeEnabled: { def: true }, + osdBrightnessEnabled: { def: true }, + osdIdleInhibitorEnabled: { def: true }, + osdMicMuteEnabled: { def: true }, + osdCapsLockEnabled: { def: true }, + osdPowerProfileEnabled: { def: true }, powerActionConfirm: { def: true }, powerMenuActions: { def: ["reboot", "logout", "poweroff", "lock", "suspend", "restart"] }, diff --git a/quickshell/Modules/OSD/BrightnessOSD.qml b/quickshell/Modules/OSD/BrightnessOSD.qml index 26b91bd5..b4c8028a 100644 --- a/quickshell/Modules/OSD/BrightnessOSD.qml +++ b/quickshell/Modules/OSD/BrightnessOSD.qml @@ -14,7 +14,7 @@ DankOSD { Connections { target: DisplayService function onBrightnessChanged(showOsd) { - if (showOsd) { + if (showOsd && SettingsData.osdBrightnessEnabled) { root.show() } } diff --git a/quickshell/Modules/OSD/CapsLockOSD.qml b/quickshell/Modules/OSD/CapsLockOSD.qml index 03e268c1..b37a86b0 100644 --- a/quickshell/Modules/OSD/CapsLockOSD.qml +++ b/quickshell/Modules/OSD/CapsLockOSD.qml @@ -17,7 +17,7 @@ DankOSD { target: DMSService function onCapsLockStateChanged() { - if (lastCapsLockState !== DMSService.capsLockState) { + if (lastCapsLockState !== DMSService.capsLockState && SettingsData.osdCapsLockEnabled) { root.show() } lastCapsLockState = DMSService.capsLockState diff --git a/quickshell/Modules/OSD/IdleInhibitorOSD.qml b/quickshell/Modules/OSD/IdleInhibitorOSD.qml index cbf4ab4d..e08c2167 100644 --- a/quickshell/Modules/OSD/IdleInhibitorOSD.qml +++ b/quickshell/Modules/OSD/IdleInhibitorOSD.qml @@ -14,7 +14,9 @@ DankOSD { Connections { target: SessionService function onInhibitorChanged() { - root.show() + if (SettingsData.osdIdleInhibitorEnabled) { + root.show() + } } } diff --git a/quickshell/Modules/OSD/MicMuteOSD.qml b/quickshell/Modules/OSD/MicMuteOSD.qml index d60db81a..71162acd 100644 --- a/quickshell/Modules/OSD/MicMuteOSD.qml +++ b/quickshell/Modules/OSD/MicMuteOSD.qml @@ -14,7 +14,9 @@ DankOSD { Connections { target: AudioService function onMicMuteChanged() { - root.show() + if (SettingsData.osdMicMuteEnabled) { + root.show() + } } } diff --git a/quickshell/Modules/OSD/PowerProfileOSD.qml b/quickshell/Modules/OSD/PowerProfileOSD.qml index 96304710..a7f4a311 100644 --- a/quickshell/Modules/OSD/PowerProfileOSD.qml +++ b/quickshell/Modules/OSD/PowerProfileOSD.qml @@ -18,7 +18,7 @@ DankOSD { target: typeof PowerProfiles !== "undefined" ? PowerProfiles : null function onProfileChanged() { - if (lastProfile !== -1 && lastProfile !== PowerProfiles.profile) { + if (lastProfile !== -1 && lastProfile !== PowerProfiles.profile && SettingsData.osdPowerProfileEnabled) { root.show() } lastProfile = PowerProfiles.profile diff --git a/quickshell/Modules/OSD/VolumeOSD.qml b/quickshell/Modules/OSD/VolumeOSD.qml index ee0c5afc..44912e4c 100644 --- a/quickshell/Modules/OSD/VolumeOSD.qml +++ b/quickshell/Modules/OSD/VolumeOSD.qml @@ -15,13 +15,13 @@ DankOSD { target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null function onVolumeChanged() { - if (!AudioService.suppressOSD) { + if (!AudioService.suppressOSD && SettingsData.osdVolumeEnabled) { root.show() } } function onMutedChanged() { - if (!AudioService.suppressOSD) { + if (!AudioService.suppressOSD && SettingsData.osdVolumeEnabled) { root.show() } } @@ -31,7 +31,7 @@ DankOSD { target: AudioService function onSinkChanged() { - if (root.shouldBeVisible) { + if (root.shouldBeVisible && SettingsData.osdVolumeEnabled) { root.show() } } diff --git a/quickshell/Modules/Settings/WidgetTweaksTab.qml b/quickshell/Modules/Settings/WidgetTweaksTab.qml index 2f88cfaa..ee7aff83 100644 --- a/quickshell/Modules/Settings/WidgetTweaksTab.qml +++ b/quickshell/Modules/Settings/WidgetTweaksTab.qml @@ -700,6 +700,104 @@ Item { } } } + + StyledRect { + width: parent.width + height: osdSection.implicitHeight + Theme.spacingL * 2 + radius: Theme.cornerRadius + color: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency) + border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, + Theme.outline.b, 0.2) + border.width: 0 + + Column { + id: osdSection + + anchors.fill: parent + anchors.margins: Theme.spacingL + spacing: Theme.spacingM + + Row { + width: parent.width + spacing: Theme.spacingM + + DankIcon { + name: "notification_important" + size: Theme.iconSize + color: Theme.primary + anchors.verticalCenter: parent.verticalCenter + } + + StyledText { + text: I18n.tr("On-screen Displays") + font.pixelSize: Theme.fontSizeLarge + font.weight: Font.Medium + color: Theme.surfaceText + anchors.verticalCenter: parent.verticalCenter + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Volume OSD") + description: I18n.tr("Show on-screen display when volume changes") + checked: SettingsData.osdVolumeEnabled + onToggled: checked => { + return SettingsData.set("osdVolumeEnabled", checked) + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Brightness OSD") + description: I18n.tr("Show on-screen display when brightness changes") + checked: SettingsData.osdBrightnessEnabled + onToggled: checked => { + return SettingsData.set("osdBrightnessEnabled", checked) + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Idle Inhibitor OSD") + description: I18n.tr("Show on-screen display when idle inhibitor state changes") + checked: SettingsData.osdIdleInhibitorEnabled + onToggled: checked => { + return SettingsData.set("osdIdleInhibitorEnabled", checked) + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Microphone Mute OSD") + description: I18n.tr("Show on-screen display when microphone is muted/unmuted") + checked: SettingsData.osdMicMuteEnabled + onToggled: checked => { + return SettingsData.set("osdMicMuteEnabled", checked) + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Caps Lock OSD") + description: I18n.tr("Show on-screen display when caps lock state changes") + checked: SettingsData.osdCapsLockEnabled + onToggled: checked => { + return SettingsData.set("osdCapsLockEnabled", checked) + } + } + + DankToggle { + width: parent.width + text: I18n.tr("Power Profile OSD") + description: I18n.tr("Show on-screen display when power profile changes") + checked: SettingsData.osdPowerProfileEnabled + onToggled: checked => { + return SettingsData.set("osdPowerProfileEnabled", checked) + } + } + } + } } } }