diff --git a/quickshell/Common/SettingsData.qml b/quickshell/Common/SettingsData.qml index b08a9aa9..ddf0f6bf 100644 --- a/quickshell/Common/SettingsData.qml +++ b/quickshell/Common/SettingsData.qml @@ -312,6 +312,8 @@ Singleton { property int overviewColumns: 5 property real overviewScale: 0.16 + property bool modalDarkenBackground: true + property bool lockScreenShowPowerActions: true property bool lockScreenShowSystemIcons: true property bool lockScreenShowTime: true diff --git a/quickshell/Common/settings/SettingsSpec.js b/quickshell/Common/settings/SettingsSpec.js index 4a413ff5..78b8f00a 100644 --- a/quickshell/Common/settings/SettingsSpec.js +++ b/quickshell/Common/settings/SettingsSpec.js @@ -211,6 +211,8 @@ var SPEC = { overviewColumns: { def: 5, persist: false }, overviewScale: { def: 0.16, persist: false }, + modalDarkenBackground: { def: true }, + lockScreenShowPowerActions: { def: true }, lockScreenShowSystemIcons: { def: true }, lockScreenShowTime: { def: true }, diff --git a/quickshell/Modals/Common/DankModal.qml b/quickshell/Modals/Common/DankModal.qml index b2f78cbd..c1a86dc2 100644 --- a/quickshell/Modals/Common/DankModal.qml +++ b/quickshell/Modals/Common/DankModal.qml @@ -19,6 +19,8 @@ Item { readonly property real screenWidth: effectiveScreen?.width ?? 1920 readonly property real screenHeight: effectiveScreen?.height ?? 1080 readonly property real dpr: effectiveScreen ? CompositorService.getScreenScale(effectiveScreen) : 1 + property bool showBackground: true + property real backgroundOpacity: 0.5 property string positioning: "center" property point customPosition: Qt.point(0, 0) property bool closeOnEscapeKey: true @@ -46,7 +48,8 @@ Item { readonly property alias contentWindow: contentWindow readonly property alias clickCatcher: clickCatcher readonly property bool useHyprlandFocusGrab: CompositorService.useHyprlandFocusGrab - readonly property bool useSingleWindow: useHyprlandFocusGrab + readonly property bool useBackground: showBackground && SettingsData.modalDarkenBackground + readonly property bool useSingleWindow: useHyprlandFocusGrab || useBackground signal opened signal dialogClosed @@ -272,6 +275,23 @@ Item { onClicked: root.backgroundClicked() } + Rectangle { + anchors.fill: parent + z: -1 + color: "black" + opacity: root.useBackground ? (root.shouldBeVisible ? root.backgroundOpacity : 0) : 0 + visible: root.useBackground + + Behavior on opacity { + enabled: root.animationsEnabled + NumberAnimation { + duration: root.animationDuration + easing.type: Easing.BezierSpline + easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve + } + } + } + Item { id: modalContainer x: root.useSingleWindow ? root.alignedX : shadowBuffer diff --git a/quickshell/Modules/Settings/ThemeColorsTab.qml b/quickshell/Modules/Settings/ThemeColorsTab.qml index 8586a06a..976888e8 100644 --- a/quickshell/Modules/Settings/ThemeColorsTab.qml +++ b/quickshell/Modules/Settings/ThemeColorsTab.qml @@ -876,6 +876,21 @@ Item { } } + SettingsCard { + tab: "theme" + tags: ["modal", "darken", "background", "overlay"] + + SettingsToggleRow { + tab: "theme" + tags: ["modal", "darken", "background", "overlay"] + settingKey: "modalDarkenBackground" + text: I18n.tr("Darken Modal Background") + description: I18n.tr("Show darkened overlay behind modal dialogs") + checked: SettingsData.modalDarkenBackground + onToggled: checked => SettingsData.set("modalDarkenBackground", checked) + } + } + SettingsCard { tab: "theme" tags: ["applications", "portal", "dark", "terminal"]