From 8e526ba5109dd5a8b34fac08cb80e18fcced69eb Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:36:15 +0200 Subject: [PATCH 01/35] feat(battery): add screen-edge countdown overlay with layout struts --- src/share/sleex/CriticalBatteryOverlay.qml | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 src/share/sleex/CriticalBatteryOverlay.qml diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml new file mode 100644 index 00000000..05872ba0 --- /dev/null +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -0,0 +1,162 @@ +import qs +import qs.services +import SleexUiKit.Appearance +import QtQuick +import Quickshell +import Quickshell.Wayland +import QtQuick.Shapes + +Scope { + id: root + + readonly property int borderThick: 14 + readonly property int pathInset: 7 + readonly property int strutMargin: 20 + readonly property real cornerRadius: 20 + + Variants { + model: Quickshell.screens + + PanelWindow { + id: win + required property var modelData + screen: modelData + + readonly property real prog: Battery.criticalActionProgress + + visible: Battery.criticalActionWanted + color: "transparent" + + anchors { top: true; bottom: true; left: true; right: true } + exclusionMode: ExclusionMode.Ignore + exclusiveZone: 0 + WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.namespace: "quickshell:criticalaction" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + mask: Region { } + + Shape { + id: trackShape + anchors.fill: parent + antialiasing: true + + layer.enabled: Battery.criticalActionWanted + layer.smooth: true + layer.samples: 4 + opacity: 0.15 + ShapePath { + strokeWidth: root.borderThick + strokeColor: Appearance.colors.colPrimary + fillColor: "transparent" + capStyle: ShapePath.RoundCap + PathMove { x: win.width / 2; y: root.pathInset } + PathLine { x: win.width - root.pathInset - root.cornerRadius; y: root.pathInset } + PathArc { x: win.width - root.pathInset; y: root.pathInset + root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: win.width - root.pathInset; y: win.height - root.pathInset - root.cornerRadius } + PathArc { x: win.width - root.pathInset - root.cornerRadius; y: win.height - root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: root.pathInset + root.cornerRadius; y: win.height - root.pathInset } + PathArc { x: root.pathInset; y: win.height - root.pathInset - root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: root.pathInset; y: root.pathInset + root.cornerRadius } + PathArc { x: root.pathInset + root.cornerRadius; y: root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: win.width / 2; y: root.pathInset } + } + } + Shape { + id: snakeShape + anchors.fill: parent + antialiasing: true + + layer.enabled: Battery.criticalActionWanted + layer.smooth: true + layer.samples: 4 + ShapePath { + strokeWidth: root.borderThick + strokeColor: Appearance.colors.colPrimary + fillColor: "transparent" + capStyle: ShapePath.RoundCap + + trim.start: 0 + trim.end: Math.max(win.prog, 0.002) + PathMove { x: win.width / 2; y: root.pathInset } + PathLine { x: win.width - root.pathInset - root.cornerRadius; y: root.pathInset } + PathArc { x: win.width - root.pathInset; y: root.pathInset + root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: win.width - root.pathInset; y: win.height - root.pathInset - root.cornerRadius } + PathArc { x: win.width - root.pathInset - root.cornerRadius; y: win.height - root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: root.pathInset + root.cornerRadius; y: win.height - root.pathInset } + PathArc { x: root.pathInset; y: win.height - root.pathInset - root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: root.pathInset; y: root.pathInset + root.cornerRadius } + PathArc { x: root.pathInset + root.cornerRadius; y: root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } + PathLine { x: win.width / 2; y: root.pathInset } + } + } + } + } + + Variants { + model: Quickshell.screens + + PanelWindow { + required property var modelData + screen: modelData + color: "transparent" + anchors { top: true; left: true; right: true } + implicitHeight: root.strutMargin + exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 + WlrLayershell.layer: WlrLayer.Top + WlrLayershell.namespace: "quickshell:castrut-top" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + mask: Region { } + } + } + + Variants { + model: Quickshell.screens + + PanelWindow { + required property var modelData + screen: modelData + color: "transparent" + anchors { bottom: true; left: true; right: true } + implicitHeight: root.strutMargin + exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 + WlrLayershell.layer: WlrLayer.Top + WlrLayershell.namespace: "quickshell:castrut-bottom" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + mask: Region { } + } + } + + Variants { + model: Quickshell.screens + + PanelWindow { + required property var modelData + screen: modelData + color: "transparent" + anchors { left: true; top: true; bottom: true } + implicitWidth: root.strutMargin + exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 + WlrLayershell.layer: WlrLayer.Top + WlrLayershell.namespace: "quickshell:castrut-left" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + mask: Region { } + } + } + + Variants { + model: Quickshell.screens + + PanelWindow { + required property var modelData + screen: modelData + color: "transparent" + anchors { right: true; top: true; bottom: true } + implicitWidth: root.strutMargin + exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 + WlrLayershell.layer: WlrLayer.Top + WlrLayershell.namespace: "quickshell:castrut-right" + WlrLayershell.keyboardFocus: WlrKeyboardFocus.None + mask: Region { } + } + } +} From 65a4fbce3c2f2b55f9f58619f49b72e4fb74cddd Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:38:29 +0200 Subject: [PATCH 02/35] feat(battery): show live countdown row and dismiss card on plug-in and on action fire --- .../modules/BatteryPopup/BatteryPopup.qml | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml index ba2ecbb2..cf8c1cd1 100644 --- a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml +++ b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml @@ -14,6 +14,13 @@ Scope { property bool isCritical: false + Component.onCompleted: { + if (Config.options.battery.overlayEnabled && Battery.available && Battery.isCriticalAndNotCharging) { + root.isCritical = true + overlayLoader.loading = true + } + } + component Divider: Rectangle { Layout.fillWidth: true height: 1 @@ -96,8 +103,8 @@ Scope { target: Battery function onIsLowAndNotChargingChanged() { - if (!Config.options.battery.overlayEnabled) return if (Battery.isLowAndNotCharging) { + if (!Config.options.battery.overlayEnabled) return root.isCritical = Battery.isCriticalAndNotCharging overlayLoader.active = false overlayLoader.loading = true @@ -112,15 +119,21 @@ Scope { } function onIsCriticalAndNotChargingChanged() { - if (!Config.options.battery.overlayEnabled) return if (Battery.isCriticalAndNotCharging) { + if (!Config.options.battery.overlayEnabled) return root.isCritical = true overlayLoader.active = false overlayLoader.loading = true if (Config.options.battery.sound) Audio.playSound("assets/sounds/battery/05_critical.wav") + } else { + overlayLoader.active = false } } + + function onCriticalActionExecuted() { + overlayLoader.active = false + } } LazyLoader { @@ -245,6 +258,19 @@ Scope { font.pixelSize: Appearance.font.pixelSize.small color: Appearance.colors.colOnLayer1 } + + StyledText { + Layout.fillWidth: true + horizontalAlignment: Text.AlignHCenter + visible: Battery.criticalActionWanted + text: { + const remain = Math.max(0, Math.ceil((1 - Battery.criticalActionProgress) * Config.options.battery.criticalActionDelay)) + return qsTr("%1 in %2s").arg(Battery.criticalActionLabel).arg(remain) + } + font.pixelSize: Appearance.font.pixelSize.small + font.weight: Font.Medium + color: Appearance.colors.colError + } } Divider {} From bd03a24eb120ea5559438519bd96c6be3391ee94 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:42:04 +0200 Subject: [PATCH 03/35] feat(battery): add critical-action countdown state machine and dispatch --- src/share/sleex/services/Battery.qml | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/src/share/sleex/services/Battery.qml b/src/share/sleex/services/Battery.qml index f7149204..23d8f326 100644 --- a/src/share/sleex/services/Battery.qml +++ b/src/share/sleex/services/Battery.qml @@ -30,6 +30,65 @@ Singleton { property bool isLowAndNotCharging: isLow && !isCharging property bool isCriticalAndNotCharging: isCritical && !isCharging + property bool criticalActionWanted: available && Config.options.battery.criticalActionEnabled + && isCriticalAndNotCharging && !_criticalActionFired + property real criticalActionProgress: 0 + property bool _criticalActionFired: false + + readonly property string criticalActionLabel: { + switch (Config.options.battery.criticalAction) { + case "hibernate": return qsTr("Hibernate") + case "shutdown": return qsTr("Shut down") + case "lock": return qsTr("Lock screen") + default: return qsTr("Suspend") + } + } + + onIsCriticalChanged: { + if (!isCritical) _criticalActionFired = false + } + + onCriticalActionWantedChanged: { + if (criticalActionWanted) { + criticalActionProgress = 0 + criticalActionAnim.restart() + } else { + criticalActionAnim.stop() + criticalActionProgress = 0 + } + } + + NumberAnimation { + id: criticalActionAnim + target: batteryService + property: "criticalActionProgress" + from: 0 + to: 1 + duration: Config.options.battery.criticalActionDelay * 1000 + easing.type: Easing.Linear + onFinished: { + if (batteryService.criticalActionWanted) + batteryService.runCriticalAction() + } + } + + signal criticalActionExecuted() + + function runCriticalAction() { + _criticalActionFired = true + criticalActionExecuted() + const action = Config.options.battery.criticalAction + if (action === "lock") { + GlobalStates.screenLocked = true + } else if (action === "shutdown") { + PowerActions.poweroff() + } else if (action === "hibernate") { + PowerActions.hibernate() + } else { + PowerActions.suspend() + } + } + property real energyRate: UPower.displayDevice.changeRate property real timeToFull: UPower.displayDevice.timeToFull From 6c64d4b1af1c9d3735c95c3dfd9e6d38104389f3 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:44:25 +0200 Subject: [PATCH 04/35] feat(config): add criticalActionEnabled, criticalActionDelay and criticalAction options --- src/share/sleex/modules/common/Config.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/share/sleex/modules/common/Config.qml b/src/share/sleex/modules/common/Config.qml index dd7b2397..37ed2d06 100644 --- a/src/share/sleex/modules/common/Config.qml +++ b/src/share/sleex/modules/common/Config.qml @@ -127,6 +127,9 @@ Singleton { property int suspend: 2 property bool sound: true //Added for Battery Sound Toggle property bool overlayEnabled: true + property bool criticalActionEnabled: false + property int criticalActionDelay: 20 + property string criticalAction: "suspend" } property JsonObject bar: JsonObject { From 3b81b38733748eb5ede13df28d45314a9ebd04e2 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:47:09 +0200 Subject: [PATCH 05/35] feat(settings): add Critical actions section to Power settings --- .../sleex/modules/settings/BehaviorConfig.qml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/share/sleex/modules/settings/BehaviorConfig.qml b/src/share/sleex/modules/settings/BehaviorConfig.qml index 15199ca3..228daeeb 100644 --- a/src/share/sleex/modules/settings/BehaviorConfig.qml +++ b/src/share/sleex/modules/settings/BehaviorConfig.qml @@ -131,6 +131,46 @@ ContentPage { } } } + ContentSubsection { + title: "Critical actions" + tooltip: "On critical battery, run a screen-edge countdown, then the chosen action." + visible: UPower.displayDevice.isLaptopBattery + + ConfigSwitch { + text: "Enable critical actions" + checked: Config.options.battery.criticalActionEnabled + onClicked: checked = !checked; + onCheckedChanged: { + Config.options.battery.criticalActionEnabled = checked; + } + } + ConfigSpinBox { + text: "Countdown (seconds)" + value: Config.options.battery.criticalActionDelay + from: 5 + to: 120 + stepSize: 5 + onValueChanged: { + Config.options.battery.criticalActionDelay = value; + } + } + ContentSubsectionLabel { + text: "Action on countdown end" + } + ConfigSelectionArray { + currentValue: Config.options.battery.criticalAction + configOptionName: "battery.criticalAction" + onSelected: (newValue) => { + Config.options.battery.criticalAction = newValue; + } + options: [ + {"value": "suspend", "displayName": "Suspend"}, + {"value": "hibernate", "displayName": "Hibernate"}, + {"value": "shutdown", "displayName": "Shut down"}, + {"value": "lock", "displayName": "Lock screen"} + ] + } + } ContentSubsectionLabel { text: "Power profile" } From 353467dc41b04521e8334c1e3778ff62fde79b74 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 12:47:56 +0200 Subject: [PATCH 06/35] feat(shell): load CriticalBatteryOverlay --- src/share/sleex/shell.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/src/share/sleex/shell.qml b/src/share/sleex/shell.qml index 8840f11c..138b4f01 100644 --- a/src/share/sleex/shell.qml +++ b/src/share/sleex/shell.qml @@ -73,6 +73,7 @@ ShellRoot { LazyLoader { active: enablePolkit; component: Polkit {} } LazyLoader { active: enableReloadPopup; component: ReloadPopup {} } LazyLoader { active: true; component: BatteryPopup {} } + LazyLoader { active: true; component: CriticalBatteryOverlay {} } LazyLoader { active: enableScreenCorners; component: ScreenCorners {} } LazyLoader { active: enableSession; component: Session {} } LazyLoader { active: enableDashboard; component: Dashboard {} } From 15f5192f3cfd77a9c1d535ea6adbe0beb0a27b79 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:22:04 +0200 Subject: [PATCH 07/35] refactor(settings): drop Lock screen from critical action options --- src/share/sleex/modules/settings/BehaviorConfig.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/share/sleex/modules/settings/BehaviorConfig.qml b/src/share/sleex/modules/settings/BehaviorConfig.qml index 228daeeb..b5e08620 100644 --- a/src/share/sleex/modules/settings/BehaviorConfig.qml +++ b/src/share/sleex/modules/settings/BehaviorConfig.qml @@ -166,8 +166,7 @@ ContentPage { options: [ {"value": "suspend", "displayName": "Suspend"}, {"value": "hibernate", "displayName": "Hibernate"}, - {"value": "shutdown", "displayName": "Shut down"}, - {"value": "lock", "displayName": "Lock screen"} + {"value": "shutdown", "displayName": "Shut down"} ] } } From 2a95adb9247d7654419475116bc315f17128b5b1 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Mon, 5 Oct 2026 13:23:47 +0200 Subject: [PATCH 08/35] refactor(battery): remove lock handling from critical action dispatch --- src/share/sleex/services/Battery.qml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/share/sleex/services/Battery.qml b/src/share/sleex/services/Battery.qml index 23d8f326..8ca0bd4a 100644 --- a/src/share/sleex/services/Battery.qml +++ b/src/share/sleex/services/Battery.qml @@ -39,7 +39,6 @@ Singleton { switch (Config.options.battery.criticalAction) { case "hibernate": return qsTr("Hibernate") case "shutdown": return qsTr("Shut down") - case "lock": return qsTr("Lock screen") default: return qsTr("Suspend") } } @@ -78,9 +77,7 @@ Singleton { _criticalActionFired = true criticalActionExecuted() const action = Config.options.battery.criticalAction - if (action === "lock") { - GlobalStates.screenLocked = true - } else if (action === "shutdown") { + if (action === "shutdown") { PowerActions.poweroff() } else if (action === "hibernate") { PowerActions.hibernate() From 9d480f6802a47912fa1e716f943527fbfd926f40 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:31:40 +0200 Subject: [PATCH 09/35] feat(overlay): border-only countdown loop with no window reservations --- src/share/sleex/CriticalBatteryOverlay.qml | 82 +++------------------- 1 file changed, 8 insertions(+), 74 deletions(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 05872ba0..37836192 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -1,4 +1,5 @@ import qs +import qs.modules.common import qs.services import SleexUiKit.Appearance import QtQuick @@ -9,10 +10,9 @@ import QtQuick.Shapes Scope { id: root - readonly property int borderThick: 14 - readonly property int pathInset: 7 - readonly property int strutMargin: 20 - readonly property real cornerRadius: 20 + property int borderThick: Config.options.battery.criticalOverlayBorderThick ?? 14 + property int pathInset: Config.options.battery.criticalOverlayPathInset ?? 0 + property int cornerRadius: Config.options.battery.criticalOverlayCornerRadius ?? 20 Variants { model: Quickshell.screens @@ -28,7 +28,6 @@ Scope { color: "transparent" anchors { top: true; bottom: true; left: true; right: true } - exclusionMode: ExclusionMode.Ignore exclusiveZone: 0 WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.namespace: "quickshell:criticalaction" @@ -38,11 +37,12 @@ Scope { Shape { id: trackShape anchors.fill: parent + visible: Battery.criticalActionWanted antialiasing: true layer.enabled: Battery.criticalActionWanted layer.smooth: true - layer.samples: 4 + layer.samples: 2 opacity: 0.15 ShapePath { strokeWidth: root.borderThick @@ -64,11 +64,12 @@ Scope { Shape { id: snakeShape anchors.fill: parent + visible: Battery.criticalActionWanted antialiasing: true layer.enabled: Battery.criticalActionWanted layer.smooth: true - layer.samples: 4 + layer.samples: 2 ShapePath { strokeWidth: root.borderThick strokeColor: Appearance.colors.colPrimary @@ -92,71 +93,4 @@ Scope { } } - Variants { - model: Quickshell.screens - - PanelWindow { - required property var modelData - screen: modelData - color: "transparent" - anchors { top: true; left: true; right: true } - implicitHeight: root.strutMargin - exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 - WlrLayershell.layer: WlrLayer.Top - WlrLayershell.namespace: "quickshell:castrut-top" - WlrLayershell.keyboardFocus: WlrKeyboardFocus.None - mask: Region { } - } - } - - Variants { - model: Quickshell.screens - - PanelWindow { - required property var modelData - screen: modelData - color: "transparent" - anchors { bottom: true; left: true; right: true } - implicitHeight: root.strutMargin - exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 - WlrLayershell.layer: WlrLayer.Top - WlrLayershell.namespace: "quickshell:castrut-bottom" - WlrLayershell.keyboardFocus: WlrKeyboardFocus.None - mask: Region { } - } - } - - Variants { - model: Quickshell.screens - - PanelWindow { - required property var modelData - screen: modelData - color: "transparent" - anchors { left: true; top: true; bottom: true } - implicitWidth: root.strutMargin - exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 - WlrLayershell.layer: WlrLayer.Top - WlrLayershell.namespace: "quickshell:castrut-left" - WlrLayershell.keyboardFocus: WlrKeyboardFocus.None - mask: Region { } - } - } - - Variants { - model: Quickshell.screens - - PanelWindow { - required property var modelData - screen: modelData - color: "transparent" - anchors { right: true; top: true; bottom: true } - implicitWidth: root.strutMargin - exclusiveZone: Battery.criticalActionWanted ? root.strutMargin : 0 - WlrLayershell.layer: WlrLayer.Top - WlrLayershell.namespace: "quickshell:castrut-right" - WlrLayershell.keyboardFocus: WlrKeyboardFocus.None - mask: Region { } - } - } } From 387920ee62057e9c9e8bdec16154927809f78d0e Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:34:32 +0200 Subject: [PATCH 10/35] feat(bar): keep bar static during critical-battery countdown --- src/share/sleex/modules/bar/Bar.qml | 63 +++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/src/share/sleex/modules/bar/Bar.qml b/src/share/sleex/modules/bar/Bar.qml index 49ff2744..6bcf727a 100644 --- a/src/share/sleex/modules/bar/Bar.qml +++ b/src/share/sleex/modules/bar/Bar.qml @@ -47,6 +47,8 @@ Scope { property ShellScreen modelData property bool centerPopupOpen: false + property bool barRevealed: !Config.options.bar.autoHide || barHoverArea.containsMouse || barRoot.centerPopupOpen || GlobalStates.dashboardOpen + readonly property int autoHideAnimMs: 400 property var brightnessMonitor: Brightness.getMonitorForScreen(modelData) property real useShortenedForm: (Appearance.sizes.barHellaShortenScreenWidthThreshold >= screen.width) ? 2 : (Appearance.sizes.barShortenScreenWidthThreshold >= screen.width) ? 1 : 0 @@ -71,11 +73,14 @@ Scope { WlrLayershell.namespace: "quickshell:bar" WlrLayershell.layer: WlrLayer.Top WlrLayershell.keyboardFocus: barRoot.centerPopupOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None - implicitHeight: barHeight + Appearance.rounding.screenRounding + centerPopup.popupHeight + Appearance.sizes.elevationMargin * 2 - exclusiveZone: barHeight + implicitHeight: barHeight + Appearance.rounding.screenRounding + ((barRoot.centerPopupOpen || centerPopup.isAnimating) ? centerPopup.popupHeight : 0) + Appearance.sizes.elevationMargin * 2 + exclusiveZone: (Config.options.bar.autoHide && !Config.options.bar.reserveSpace ? (barContent.visible ? barHeight : 0) : barHeight) mask: Region { Region { - item: barContent + item: Config.options.bar.autoHide ? barHoverArea : null + } + Region { + item: barContent.visible ? barContent : null } Region { item: (barRoot.centerPopupOpen || centerPopup.isAnimating ? centerPopup : null) @@ -96,13 +101,55 @@ Scope { barRoot: barRoot } + MouseArea { + id: barHoverArea + anchors { + left: parent.left + right: parent.right + top: !Config.options.bar.bottom ? parent.top : undefined + bottom: Config.options.bar.bottom ? parent.bottom : undefined + } + height: barContent.visible ? barHeight : 5 + hoverEnabled: true + acceptedButtons: Qt.NoButton + visible: Config.options.bar.autoHide + z: 100 + } + Rectangle { // Bar background id: barContent + visible: barRoot.barRevealed || opacity > 0 + opacity: barRoot.barRevealed ? 1 : 0 + + Behavior on opacity { + NumberAnimation { + duration: barRoot.autoHideAnimMs + easing.type: Appearance.animation.elementMove.type + easing.bezierCurve: Appearance.animation.elementMove.bezierCurve + } + } anchors { right: parent.right left: parent.left top: !Config.options.bar.bottom ? parent.top : undefined bottom: Config.options.bar.bottom ? parent.bottom : undefined + topMargin: !Config.options.bar.bottom ? (barContent.visible ? 0 : -barHeight) : 0 + bottomMargin: Config.options.bar.bottom ? (barContent.visible ? 0 : -barHeight) : 0 + } + + Behavior on anchors.topMargin { + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } + } + Behavior on anchors.bottomMargin { + NumberAnimation { + duration: Appearance.animation.elementMoveFast.duration + easing.type: Appearance.animation.elementMoveFast.type + easing.bezierCurve: Appearance.animation.elementMoveFast.bezierCurve + } } color: barBackground ? Appearance.colors.colLayer2 : "transparent" height: barHeight @@ -111,7 +158,7 @@ Scope { id: barLeftSideMouseArea anchors.left: parent.left implicitHeight: barHeight - width: (barRoot.width - middleSection.width) / 2 + width: (barRoot.width - (Config.options.bar.showIsland ? middleSection.width : 0)) / 2 property bool hovered: false property real lastScrollX: 0 property real lastScrollY: 0 @@ -184,6 +231,7 @@ Scope { // Background Rectangle Rectangle { id: middleBg + visible: Config.options.bar.showIsland anchors.centerIn: parent anchors.horizontalCenter: middleSection.horizontalCenter anchors.verticalCenter: middleSection.verticalCenter @@ -211,6 +259,7 @@ Scope { RowLayout { // Middle section id: middleSection + visible: Config.options.bar.showIsland anchors.centerIn: parent spacing: 0 @@ -351,7 +400,7 @@ Scope { corner: cornerEnum.topLeft color: Appearance.colors.colLayer0 anchors.margins: -Appearance.rounding.screenRounding - visible: barBackground ? Config.options.appearance.transparency ? true : false : !barBackground ? true : false + visible: Config.options.bar.showIsland && (barBackground ? Config.options.appearance.transparency ? true : false : !barBackground ? true : false) } RoundCorner { @@ -361,7 +410,7 @@ Scope { corner: cornerEnum.topRight color: Appearance.colors.colLayer0 anchors.margins: -Appearance.rounding.screenRounding - visible: barBackground ? Config.options.appearance.transparency ? true : false : !barBackground ? true : false + visible: Config.options.bar.showIsland && (barBackground ? Config.options.appearance.transparency ? true : false : !barBackground ? true : false) } @@ -370,7 +419,7 @@ Scope { anchors.right: parent.right implicitHeight: barHeight - width: (barRoot.width - middleSection.width) / 2 + width: (barRoot.width - (Config.options.bar.showIsland ? middleSection.width : 0)) / 2 property bool hovered: false property real lastScrollX: 0 From 75bc87bf7f2f5958058430bdbc998e848ea809c7 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:38:05 +0200 Subject: [PATCH 11/35] feat(config): countdown overlay appearance options --- src/share/sleex/modules/common/Config.qml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/share/sleex/modules/common/Config.qml b/src/share/sleex/modules/common/Config.qml index 37ed2d06..b76ebba4 100644 --- a/src/share/sleex/modules/common/Config.qml +++ b/src/share/sleex/modules/common/Config.qml @@ -128,8 +128,11 @@ Singleton { property bool sound: true //Added for Battery Sound Toggle property bool overlayEnabled: true property bool criticalActionEnabled: false - property int criticalActionDelay: 20 + property int criticalActionDelay: 30 property string criticalAction: "suspend" + property int criticalOverlayBorderThick: 25 + property int criticalOverlayPathInset: 0 + property int criticalOverlayCornerRadius: 25 } property JsonObject bar: JsonObject { From 4f9acf459f6fe2765d281b167730dc2279f3d9f4 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:39:41 +0200 Subject: [PATCH 12/35] feat(settings): critical charge behaviour section with appearance controls --- .../sleex/modules/settings/BehaviorConfig.qml | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/src/share/sleex/modules/settings/BehaviorConfig.qml b/src/share/sleex/modules/settings/BehaviorConfig.qml index b5e08620..c5cd6e4b 100644 --- a/src/share/sleex/modules/settings/BehaviorConfig.qml +++ b/src/share/sleex/modules/settings/BehaviorConfig.qml @@ -132,12 +132,12 @@ ContentPage { } } ContentSubsection { - title: "Critical actions" + title: "Critical charge behavior" tooltip: "On critical battery, run a screen-edge countdown, then the chosen action." visible: UPower.displayDevice.isLaptopBattery ConfigSwitch { - text: "Enable critical actions" + text: "Enable critical charge behavior" checked: Config.options.battery.criticalActionEnabled onClicked: checked = !checked; onCheckedChanged: { @@ -169,6 +169,45 @@ ContentPage { {"value": "shutdown", "displayName": "Shut down"} ] } + ContentSubsectionLabel { + text: "Countdown appearance" + } + ConfigRow { + uniform: true + ConfigSpinBox { + text: "Border thickness" + value: Config.options.battery.criticalOverlayBorderThick + from: 2 + to: 40 + stepSize: 1 + onValueChanged: { + Config.options.battery.criticalOverlayBorderThick = value; + } + } + ConfigSpinBox { + text: "Path inset" + value: Config.options.battery.criticalOverlayPathInset + from: 0 + to: 40 + stepSize: 1 + onValueChanged: { + Config.options.battery.criticalOverlayPathInset = value; + } + } + } + ConfigRow { + uniform: true + ConfigSpinBox { + text: "Corner radius" + value: Config.options.battery.criticalOverlayCornerRadius + from: 0 + to: 60 + stepSize: 1 + onValueChanged: { + Config.options.battery.criticalOverlayCornerRadius = value; + } + } + } } ContentSubsectionLabel { text: "Power profile" From 5c3cc2fde82ce250fd486c947f0995b326514d78 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:41:04 +0200 Subject: [PATCH 13/35] feat(battery): explicit suspend action with unknown fallback label --- src/share/sleex/services/Battery.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/share/sleex/services/Battery.qml b/src/share/sleex/services/Battery.qml index 8ca0bd4a..9a3ea6d9 100644 --- a/src/share/sleex/services/Battery.qml +++ b/src/share/sleex/services/Battery.qml @@ -37,9 +37,10 @@ Singleton { readonly property string criticalActionLabel: { switch (Config.options.battery.criticalAction) { + case "suspend": return qsTr("Suspend") case "hibernate": return qsTr("Hibernate") case "shutdown": return qsTr("Shut down") - default: return qsTr("Suspend") + default: return qsTr("Unknown") } } From 5aab2cc2bc3f41e7c233ad3bd3f9420215899989 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:04:15 +0200 Subject: [PATCH 14/35] feat(bar): keep bar static during critical-battery countdown From c8af5ed314249228fc90586ece8f949c7e4107d8 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:22:38 +0200 Subject: [PATCH 15/35] fix(bar): keep top bar stationary during critical countdown --- src/share/sleex/modules/bar/Bar.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/share/sleex/modules/bar/Bar.qml b/src/share/sleex/modules/bar/Bar.qml index 6bcf727a..9672383c 100644 --- a/src/share/sleex/modules/bar/Bar.qml +++ b/src/share/sleex/modules/bar/Bar.qml @@ -73,8 +73,8 @@ Scope { WlrLayershell.namespace: "quickshell:bar" WlrLayershell.layer: WlrLayer.Top WlrLayershell.keyboardFocus: barRoot.centerPopupOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None - implicitHeight: barHeight + Appearance.rounding.screenRounding + ((barRoot.centerPopupOpen || centerPopup.isAnimating) ? centerPopup.popupHeight : 0) + Appearance.sizes.elevationMargin * 2 - exclusiveZone: (Config.options.bar.autoHide && !Config.options.bar.reserveSpace ? (barContent.visible ? barHeight : 0) : barHeight) + implicitHeight: barHeight + Appearance.rounding.screenRounding + centerPopup.popupHeight + Appearance.sizes.elevationMargin * 2 + exclusiveZone: Config.options.bar.autoHide && !Config.options.bar.reserveSpace ? (barContent.visible ? barHeight : 0) : barHeight mask: Region { Region { item: Config.options.bar.autoHide ? barHoverArea : null From 004d83034e52ddfc129ba8005d273bc6e51db742 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:24:52 +0200 Subject: [PATCH 16/35] feat(battery): simplify overlay checks Removed redundant checks for overlayEnabled in battery status updates. --- .../sleex/modules/BatteryPopup/BatteryPopup.qml | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml index cf8c1cd1..f02ae035 100644 --- a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml +++ b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml @@ -14,13 +14,6 @@ Scope { property bool isCritical: false - Component.onCompleted: { - if (Config.options.battery.overlayEnabled && Battery.available && Battery.isCriticalAndNotCharging) { - root.isCritical = true - overlayLoader.loading = true - } - } - component Divider: Rectangle { Layout.fillWidth: true height: 1 @@ -103,8 +96,8 @@ Scope { target: Battery function onIsLowAndNotChargingChanged() { + if (!Config.options.battery.overlayEnabled) return if (Battery.isLowAndNotCharging) { - if (!Config.options.battery.overlayEnabled) return root.isCritical = Battery.isCriticalAndNotCharging overlayLoader.active = false overlayLoader.loading = true @@ -119,15 +112,13 @@ Scope { } function onIsCriticalAndNotChargingChanged() { + if (!Config.options.battery.overlayEnabled) return if (Battery.isCriticalAndNotCharging) { - if (!Config.options.battery.overlayEnabled) return root.isCritical = true overlayLoader.active = false overlayLoader.loading = true if (Config.options.battery.sound) Audio.playSound("assets/sounds/battery/05_critical.wav") - } else { - overlayLoader.active = false } } From bccf17f17ee5e1fdf6bdd866ec70519ea9fd6984 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:26:19 +0200 Subject: [PATCH 17/35] feat(bar): add properties for island, autoHide, and reserveSpace --- src/share/sleex/modules/common/Config.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/share/sleex/modules/common/Config.qml b/src/share/sleex/modules/common/Config.qml index b76ebba4..650678cc 100644 --- a/src/share/sleex/modules/common/Config.qml +++ b/src/share/sleex/modules/common/Config.qml @@ -153,6 +153,9 @@ Singleton { property bool showWorkspaces: true property bool showClock: false property bool showTrayAndIcons: true + property bool showIsland: true + property bool autoHide: false + property bool reserveSpace: false property JsonObject tray: JsonObject { property bool monochromeIcons: true property bool showItemId: false From 5d436963eecc10508b4a85786eb87ae20aa8d8e6 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:29:17 +0200 Subject: [PATCH 18/35] feat(battery): optimise critical action handling in Battery.qml Refactor critical action handling for battery service and add re-arm logic for critical discharge. --- src/share/sleex/services/Battery.qml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/share/sleex/services/Battery.qml b/src/share/sleex/services/Battery.qml index 9a3ea6d9..93a35fcd 100644 --- a/src/share/sleex/services/Battery.qml +++ b/src/share/sleex/services/Battery.qml @@ -6,6 +6,7 @@ import Quickshell import Quickshell.Services.UPower import QtQuick import Quickshell.Io +import Sleex.Core Singleton { id: batteryService @@ -44,10 +45,6 @@ Singleton { } } - onIsCriticalChanged: { - if (!isCritical) _criticalActionFired = false - } - onCriticalActionWantedChanged: { if (criticalActionWanted) { criticalActionProgress = 0 @@ -87,6 +84,20 @@ Singleton { } } + // The critical action only fires once per critical discharge: the flag is + // cleared as soon as the battery is no longer critical *and* discharging, + // so plugging the charger in (and unplugging it again) re-arms the action. + Connections { + target: SuspendFader + + function onPrepareForSleep(sleeping) { + // Woke up while still critical: re-arm the action so the warning + // and the countdown are shown again. + if (!sleeping && batteryService.isCriticalAndNotCharging) + batteryService._criticalActionFired = false + } + } + property real energyRate: UPower.displayDevice.changeRate property real timeToFull: UPower.displayDevice.timeToFull @@ -127,6 +138,7 @@ Singleton { } onIsCriticalAndNotChargingChanged: { + if (!isCriticalAndNotCharging) _criticalActionFired = false if (!available) return if (isCriticalAndNotCharging && !Config.options.battery.overlayEnabled) { if (Config.options.battery.sound) From acdfca3b81bca2e515506b1d26eba02f3783a279 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:31:25 +0200 Subject: [PATCH 19/35] faet(battery): optimise CriticalBatteryOverlay.qml to use EdgePath Replaced ShapePath with EdgePath for better performance and clarity. --- src/share/sleex/CriticalBatteryOverlay.qml | 88 ++++++++++++++-------- 1 file changed, 56 insertions(+), 32 deletions(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 37836192..0e4c2abf 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -34,6 +34,60 @@ Scope { WlrLayershell.keyboardFocus: WlrKeyboardFocus.None mask: Region { } + readonly property real halfThick: root.borderThick / 2 + readonly property real radius: root.cornerRadius + readonly property real lineLeft: root.pathInset + halfThick + readonly property real lineTop: root.pathInset + halfThick + readonly property real lineRight: win.width - root.pathInset - halfThick + readonly property real lineBottom: win.height - root.pathInset - halfThick + + component EdgePath: ShapePath { + strokeWidth: root.borderThick + strokeColor: Appearance.colors.colPrimary + fillColor: "transparent" + capStyle: ShapePath.RoundCap + joinStyle: ShapePath.MiterJoin + + PathMove { x: win.width / 2; y: win.lineTop } + PathLine { x: win.lineRight - win.radius; y: win.lineTop } + PathAngleArc { + centerX: win.lineRight - win.radius + centerY: win.lineTop + win.radius + radiusX: win.radius + radiusY: win.radius + startAngle: -90 + sweepAngle: 90 + } + PathLine { x: win.lineRight; y: win.lineBottom - win.radius } + PathAngleArc { + centerX: win.lineRight - win.radius + centerY: win.lineBottom - win.radius + radiusX: win.radius + radiusY: win.radius + startAngle: 0 + sweepAngle: 90 + } + PathLine { x: win.lineLeft + win.radius; y: win.lineBottom } + PathAngleArc { + centerX: win.lineLeft + win.radius + centerY: win.lineBottom - win.radius + radiusX: win.radius + radiusY: win.radius + startAngle: 90 + sweepAngle: 90 + } + PathLine { x: win.lineLeft; y: win.lineTop + win.radius } + PathAngleArc { + centerX: win.lineLeft + win.radius + centerY: win.lineTop + win.radius + radiusX: win.radius + radiusY: win.radius + startAngle: 180 + sweepAngle: 90 + } + PathLine { x: win.width / 2; y: win.lineTop } + } + Shape { id: trackShape anchors.fill: parent @@ -44,22 +98,7 @@ Scope { layer.smooth: true layer.samples: 2 opacity: 0.15 - ShapePath { - strokeWidth: root.borderThick - strokeColor: Appearance.colors.colPrimary - fillColor: "transparent" - capStyle: ShapePath.RoundCap - PathMove { x: win.width / 2; y: root.pathInset } - PathLine { x: win.width - root.pathInset - root.cornerRadius; y: root.pathInset } - PathArc { x: win.width - root.pathInset; y: root.pathInset + root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: win.width - root.pathInset; y: win.height - root.pathInset - root.cornerRadius } - PathArc { x: win.width - root.pathInset - root.cornerRadius; y: win.height - root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: root.pathInset + root.cornerRadius; y: win.height - root.pathInset } - PathArc { x: root.pathInset; y: win.height - root.pathInset - root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: root.pathInset; y: root.pathInset + root.cornerRadius } - PathArc { x: root.pathInset + root.cornerRadius; y: root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: win.width / 2; y: root.pathInset } - } + EdgePath { } } Shape { id: snakeShape @@ -70,24 +109,9 @@ Scope { layer.enabled: Battery.criticalActionWanted layer.smooth: true layer.samples: 2 - ShapePath { - strokeWidth: root.borderThick - strokeColor: Appearance.colors.colPrimary - fillColor: "transparent" - capStyle: ShapePath.RoundCap - + EdgePath { trim.start: 0 trim.end: Math.max(win.prog, 0.002) - PathMove { x: win.width / 2; y: root.pathInset } - PathLine { x: win.width - root.pathInset - root.cornerRadius; y: root.pathInset } - PathArc { x: win.width - root.pathInset; y: root.pathInset + root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: win.width - root.pathInset; y: win.height - root.pathInset - root.cornerRadius } - PathArc { x: win.width - root.pathInset - root.cornerRadius; y: win.height - root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: root.pathInset + root.cornerRadius; y: win.height - root.pathInset } - PathArc { x: root.pathInset; y: win.height - root.pathInset - root.cornerRadius; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: root.pathInset; y: root.pathInset + root.cornerRadius } - PathArc { x: root.pathInset + root.cornerRadius; y: root.pathInset; radiusX: root.cornerRadius; radiusY: root.cornerRadius; direction: PathArc.Clockwise } - PathLine { x: win.width / 2; y: root.pathInset } } } } From 264b1090e8e48650ac2723eb4fdfb70282cca484 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:36:33 +0200 Subject: [PATCH 20/35] feat(shell): update theme loader file path in shell.qml Refreshed the stale code in this PR to be inline with the latest upstream changes --- src/share/sleex/shell.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/share/sleex/shell.qml b/src/share/sleex/shell.qml index 138b4f01..30c58121 100644 --- a/src/share/sleex/shell.qml +++ b/src/share/sleex/shell.qml @@ -30,6 +30,7 @@ import QtQuick.Controls import qs.services import Sleex.Core +import SleexUiKit.Appearance ShellRoot { // Enable/disable modules here. False = not loaded at all, so rest assured @@ -55,7 +56,7 @@ ShellRoot { // Force initialization of some singletons Component.onCompleted: { - MaterialThemeLoader.reapplyTheme() + Appearance.themeLoader.filePath = Directories.generatedMaterialThemePath FirstRunExperience.load() Cliphist.refresh() Idle.init(); From 66837c89b4558d0282fff121bf3bf7f36aef3f68 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:39:08 +0200 Subject: [PATCH 21/35] feat(sleex-core): emit prepareForSleep on sleep and resume --- src/share/sleex/plugins/src/Sleex/core/dpmsFade.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/share/sleex/plugins/src/Sleex/core/dpmsFade.cpp b/src/share/sleex/plugins/src/Sleex/core/dpmsFade.cpp index 0b1d0f5e..ee2442c4 100644 --- a/src/share/sleex/plugins/src/Sleex/core/dpmsFade.cpp +++ b/src/share/sleex/plugins/src/Sleex/core/dpmsFade.cpp @@ -80,6 +80,7 @@ void SuspendFader::releaseLock() { } void SuspendFader::onPrepareForSleep(bool sleeping) { + emit prepareForSleep(sleeping); if (sleeping) { std::system("wlr-dpms off"); std::this_thread::sleep_for(FADE_DURATION); @@ -88,4 +89,4 @@ void SuspendFader::onPrepareForSleep(bool sleeping) { std::system("wlr-dpms on"); acquireLock(); } -} \ No newline at end of file +} From 2a93962d0cb8cf7db27b2412c1526d3f9da5556b Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 16:40:07 +0200 Subject: [PATCH 22/35] feat(sleex-core): expose prepareForSleep signal --- src/share/sleex/plugins/src/Sleex/core/dpmsFade.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/share/sleex/plugins/src/Sleex/core/dpmsFade.hpp b/src/share/sleex/plugins/src/Sleex/core/dpmsFade.hpp index c641809b..027e64f9 100644 --- a/src/share/sleex/plugins/src/Sleex/core/dpmsFade.hpp +++ b/src/share/sleex/plugins/src/Sleex/core/dpmsFade.hpp @@ -22,6 +22,9 @@ class SuspendFader : public QObject { Q_INVOKABLE void start(); Q_INVOKABLE void stop(); + // Emitted when the system is about to sleep (true) or has just woken up (false). + Q_SIGNAL void prepareForSleep(bool sleeping); + private: void acquireLock(); void releaseLock(); @@ -32,4 +35,4 @@ class SuspendFader : public QObject { sdbus::ServiceName destination; sdbus::ObjectPath objectPath; int lock_fd_{-1}; -}; \ No newline at end of file +}; From abb1b1d6cd17db44151fa64e6114918eeb7f8990 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Wed, 11 Nov 2026 18:11:34 +0200 Subject: [PATCH 23/35] Adjust critical overlay properties in Config.qml --- src/share/sleex/modules/common/Config.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/sleex/modules/common/Config.qml b/src/share/sleex/modules/common/Config.qml index 650678cc..fc3d34c2 100644 --- a/src/share/sleex/modules/common/Config.qml +++ b/src/share/sleex/modules/common/Config.qml @@ -130,9 +130,9 @@ Singleton { property bool criticalActionEnabled: false property int criticalActionDelay: 30 property string criticalAction: "suspend" - property int criticalOverlayBorderThick: 25 - property int criticalOverlayPathInset: 0 - property int criticalOverlayCornerRadius: 25 + property int criticalOverlayBorderThick: 15 + property int criticalOverlayPathInset: 5 + property int criticalOverlayCornerRadius: 30 } property JsonObject bar: JsonObject { From 1310a49822801e909e2804b2b01c3da9baa030b0 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 12 Nov 2026 10:40:26 +0200 Subject: [PATCH 24/35] feat(overlay): change exclusiveZone value to -1 --- src/share/sleex/CriticalBatteryOverlay.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 0e4c2abf..3663007a 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -28,7 +28,7 @@ Scope { color: "transparent" anchors { top: true; bottom: true; left: true; right: true } - exclusiveZone: 0 + exclusiveZone: -1 WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.namespace: "quickshell:criticalaction" WlrLayershell.keyboardFocus: WlrKeyboardFocus.None From 29c85416763522a76a63909201043f0fc1cacecf Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 12 Nov 2026 11:50:34 +0200 Subject: [PATCH 25/35] feat(overlay): change WlrLayer from Overlay to Top --- src/share/sleex/CriticalBatteryOverlay.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 3663007a..a9780be2 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -29,7 +29,7 @@ Scope { anchors { top: true; bottom: true; left: true; right: true } exclusiveZone: -1 - WlrLayershell.layer: WlrLayer.Overlay + WlrLayershell.layer: WlrLayer.Top WlrLayershell.namespace: "quickshell:criticalaction" WlrLayershell.keyboardFocus: WlrKeyboardFocus.None mask: Region { } From 63a43fdbcceb329edfe9e148c4076044fa162009 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:30:50 +0200 Subject: [PATCH 26/35] fix(BatteryPopup): fix critical state handling --- src/share/sleex/modules/BatteryPopup/BatteryPopup.qml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml index f02ae035..6a31165b 100644 --- a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml +++ b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml @@ -119,6 +119,9 @@ Scope { overlayLoader.loading = true if (Config.options.battery.sound) Audio.playSound("assets/sounds/battery/05_critical.wav") + } else { + root.isCritical = false + overlayLoader.active = false } } From 09b3572fa549c6fce385ff926405796601162374 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:33:14 +0200 Subject: [PATCH 27/35] feat(config): adjust critical overlay default properties --- src/share/sleex/modules/common/Config.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/share/sleex/modules/common/Config.qml b/src/share/sleex/modules/common/Config.qml index fc3d34c2..52bdd130 100644 --- a/src/share/sleex/modules/common/Config.qml +++ b/src/share/sleex/modules/common/Config.qml @@ -130,9 +130,9 @@ Singleton { property bool criticalActionEnabled: false property int criticalActionDelay: 30 property string criticalAction: "suspend" - property int criticalOverlayBorderThick: 15 - property int criticalOverlayPathInset: 5 - property int criticalOverlayCornerRadius: 30 + property int criticalOverlayBorderThick: 5 + property int criticalOverlayPathInset: 0 + property int criticalOverlayCornerRadius: 25 } property JsonObject bar: JsonObject { From 986ba5a6dff0b6faf87365134840516384cdb5a0 Mon Sep 17 00:00:00 2001 From: Armiel Pillay <125122987+Abscissa24@users.noreply.github.com> Date: Thu, 12 Nov 2026 12:38:49 +0200 Subject: [PATCH 28/35] feat(rules): add 'Choose' dialog pattern and update layer rules --- src/etc/sleex/hyprland/rules.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/etc/sleex/hyprland/rules.lua b/src/etc/sleex/hyprland/rules.lua index cfd984a3..cccd2e5e 100644 --- a/src/etc/sleex/hyprland/rules.lua +++ b/src/etc/sleex/hyprland/rules.lua @@ -27,6 +27,7 @@ local center_dialogs = { "^(Save As)(.*)$", "^(Library)(.*)$", "^(File Upload)(.*)$", + "^(Choose)$", } for _, pattern in ipairs(center_dialogs) do hl.window_rule({ @@ -150,6 +151,13 @@ hl.layer_rule({ match = { namespace = "quickshell:bar" }, animation = "slide", }) +-- The critical battery countdown border shares the top layer with the bar. +-- A higher order renders lower, so this keeps the border underneath the bar +-- and the island, which then always cover the screen edges they share. +hl.layer_rule({ + match = { namespace = "quickshell:criticalaction" }, + order = 1, +}) hl.layer_rule({ match = { namespace = "quickshell:cheatsheet" }, animation = "slide bottom", From f4214aee2c4462a962c997939dd70927b82ddffc Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 13:23:27 +0200 Subject: [PATCH 29/35] perf(overlay): render the countdown border with the curve renderer The two full screen Shape items each allocated a multisampled offscreen buffer through layer.enabled, which is expensive on high resolution or multi monitor setups. The curve renderer antialiases the strokes on the GPU instead, so the offscreen buffers are not needed. The countdown border is also no longer loaded before the countdown runs, so its layer surfaces only exist while they are actually needed. --- src/share/sleex/CriticalBatteryOverlay.qml | 12 ++++++------ src/share/sleex/shell.qml | 8 ++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index a9780be2..2d6177ef 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -94,9 +94,11 @@ Scope { visible: Battery.criticalActionWanted antialiasing: true - layer.enabled: Battery.criticalActionWanted - layer.smooth: true - layer.samples: 2 + // The curve renderer antialiases the strokes on the GPU, so the + // shapes need no offscreen buffer of their own. layer.enabled + // would allocate a full screen sized (and, with layer.samples, + // multisampled) texture for each of them. + preferredRendererType: Shape.CurveRenderer opacity: 0.15 EdgePath { } } @@ -106,9 +108,7 @@ Scope { visible: Battery.criticalActionWanted antialiasing: true - layer.enabled: Battery.criticalActionWanted - layer.smooth: true - layer.samples: 2 + preferredRendererType: Shape.CurveRenderer EdgePath { trim.start: 0 trim.end: Math.max(win.prog, 0.002) diff --git a/src/share/sleex/shell.qml b/src/share/sleex/shell.qml index 30c58121..18ecfc8c 100644 --- a/src/share/sleex/shell.qml +++ b/src/share/sleex/shell.qml @@ -45,6 +45,8 @@ ShellRoot { property bool enableOverview: true property bool enablePolkit: true property bool enableReloadPopup: true + property bool enableBatteryPopup: true + property bool enableCriticalBatteryOverlay: true property bool enableScreenCorners: false property bool enableSession: true property bool enableDashboard: true @@ -73,8 +75,10 @@ ShellRoot { LazyLoader { active: enableOverview; component: Overview {} } LazyLoader { active: enablePolkit; component: Polkit {} } LazyLoader { active: enableReloadPopup; component: ReloadPopup {} } - LazyLoader { active: true; component: BatteryPopup {} } - LazyLoader { active: true; component: CriticalBatteryOverlay {} } + LazyLoader { active: enableBatteryPopup; component: BatteryPopup {} } + // The countdown border is only of any use while the countdown runs, so it + // is not loaded - and its layer surfaces are not created - before that. + LazyLoader { active: enableCriticalBatteryOverlay && Battery.criticalActionWanted; component: CriticalBatteryOverlay {} } LazyLoader { active: enableScreenCorners; component: ScreenCorners {} } LazyLoader { active: enableSession; component: Session {} } LazyLoader { active: enableDashboard; component: Dashboard {} } From 37f16fb05e082c0de3820ba995974690a96b134c Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 13:34:37 +0200 Subject: [PATCH 30/35] fix(overlay): align the border fallbacks with the config defaults The fallback values were left over from the first version of the overlay and no longer matched the defaults in modules/common/Config.qml. --- src/share/sleex/CriticalBatteryOverlay.qml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 2d6177ef..6a5a8817 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -10,9 +10,10 @@ import QtQuick.Shapes Scope { id: root - property int borderThick: Config.options.battery.criticalOverlayBorderThick ?? 14 + // Fallbacks mirror the defaults in modules/common/Config.qml. + property int borderThick: Config.options.battery.criticalOverlayBorderThick ?? 5 property int pathInset: Config.options.battery.criticalOverlayPathInset ?? 0 - property int cornerRadius: Config.options.battery.criticalOverlayCornerRadius ?? 20 + property int cornerRadius: Config.options.battery.criticalOverlayCornerRadius ?? 25 Variants { model: Quickshell.screens @@ -110,6 +111,9 @@ Scope { preferredRendererType: Shape.CurveRenderer EdgePath { + // ShapePath.trim is a property group (QQuickShapeTrim, added + // in Qt 6.10) holding fractions of the path length, so the + // snake stroke grows along the border as the countdown runs. trim.start: 0 trim.end: Math.max(win.prog, 0.002) } From 93400fd36742b2871e6d37d54c8570e437d09cc2 Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 13:40:26 +0200 Subject: [PATCH 31/35] build: require Qt 6.10 The critical battery overlay uses ShapePath.trim, which was added in Qt 6.10, so the shell no longer runs on older Qt. --- src/share/sleex/plugins/src/Sleex/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/plugins/src/Sleex/CMakeLists.txt b/src/share/sleex/plugins/src/Sleex/CMakeLists.txt index f2d14997..0ddc2584 100644 --- a/src/share/sleex/plugins/src/Sleex/CMakeLists.txt +++ b/src/share/sleex/plugins/src/Sleex/CMakeLists.txt @@ -3,7 +3,7 @@ find_package(PkgConfig REQUIRED) find_package(sdbus-c++ REQUIRED) set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml") -qt_standard_project_setup(REQUIRES 6.9) +qt_standard_project_setup(REQUIRES 6.10) function(qml_module arg_TARGET) cmake_parse_arguments(PARSE_ARGV 1 arg "" "URI" "SOURCES;LIBRARIES") From 5cbc6b7ebdd4621357bef3f4e7c8ca7cfc20ef65 Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 15:09:55 +0200 Subject: [PATCH 32/35] perf(battery): only rebuild the countdown label once a second The label was bound to the countdown progress, which is animated on every frame, so the binding and the string formatting ran at the frame rate for the whole countdown. Round the remaining time down to whole seconds on the Battery service instead, so the label is only rebuilt when the number actually changes. --- src/share/sleex/CriticalBatteryOverlay.qml | 6 +++--- src/share/sleex/modules/BatteryPopup/BatteryPopup.qml | 5 +---- src/share/sleex/services/Battery.qml | 6 ++++++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index 6a5a8817..d9b2c26c 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -111,9 +111,9 @@ Scope { preferredRendererType: Shape.CurveRenderer EdgePath { - // ShapePath.trim is a property group (QQuickShapeTrim, added - // in Qt 6.10) holding fractions of the path length, so the - // snake stroke grows along the border as the countdown runs. + // ShapePath.trim is a property group (QQuickShapeTrim) that + // holds fractions of the path length, so the snake stroke + // grows along the border as the countdown runs. trim.start: 0 trim.end: Math.max(win.prog, 0.002) } diff --git a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml index 6a31165b..e89d9b50 100644 --- a/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml +++ b/src/share/sleex/modules/BatteryPopup/BatteryPopup.qml @@ -257,10 +257,7 @@ Scope { Layout.fillWidth: true horizontalAlignment: Text.AlignHCenter visible: Battery.criticalActionWanted - text: { - const remain = Math.max(0, Math.ceil((1 - Battery.criticalActionProgress) * Config.options.battery.criticalActionDelay)) - return qsTr("%1 in %2s").arg(Battery.criticalActionLabel).arg(remain) - } + text: qsTr("%1 in %2s").arg(Battery.criticalActionLabel).arg(Battery.criticalActionRemaining) font.pixelSize: Appearance.font.pixelSize.small font.weight: Font.Medium color: Appearance.colors.colError diff --git a/src/share/sleex/services/Battery.qml b/src/share/sleex/services/Battery.qml index 93a35fcd..2fc50dab 100644 --- a/src/share/sleex/services/Battery.qml +++ b/src/share/sleex/services/Battery.qml @@ -36,6 +36,12 @@ Singleton { property real criticalActionProgress: 0 property bool _criticalActionFired: false + // The remaining seconds of the countdown. The progress is animated every + // frame, so this rounds it down to whole seconds: the value only changes + // once a second, which keeps anything bound to it from being rebuilt on + // every frame of the animation. + readonly property int criticalActionRemaining: Math.max(0, Math.ceil((1 - criticalActionProgress) * Config.options.battery.criticalActionDelay)) + readonly property string criticalActionLabel: { switch (Config.options.battery.criticalAction) { case "suspend": return qsTr("Suspend") From 37c8f2799670d154f29bdec5abf408d6802acb3d Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 15:15:12 +0200 Subject: [PATCH 33/35] build: keep the Qt requirement at 6.9 The 6.10 bump was only there to match ShapePath.trim, which the countdown border uses. The requirement stays where upstream has it. --- src/share/sleex/plugins/src/Sleex/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/plugins/src/Sleex/CMakeLists.txt b/src/share/sleex/plugins/src/Sleex/CMakeLists.txt index 0ddc2584..f2d14997 100644 --- a/src/share/sleex/plugins/src/Sleex/CMakeLists.txt +++ b/src/share/sleex/plugins/src/Sleex/CMakeLists.txt @@ -3,7 +3,7 @@ find_package(PkgConfig REQUIRED) find_package(sdbus-c++ REQUIRED) set(QT_QML_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/qml") -qt_standard_project_setup(REQUIRES 6.10) +qt_standard_project_setup(REQUIRES 6.9) function(qml_module arg_TARGET) cmake_parse_arguments(PARSE_ARGV 1 arg "" "URI" "SOURCES;LIBRARIES") From 25b35a93c625d482120cf918d23341d65c4ba8bc Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 15:28:48 +0200 Subject: [PATCH 34/35] fix(overlay): paint the countdown border with the error colour The border warns about a dying battery, so it should use the same error colour as the countdown text in the battery popup instead of the regular accent colour. --- src/share/sleex/CriticalBatteryOverlay.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index d9b2c26c..c184fd21 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -44,7 +44,7 @@ Scope { component EdgePath: ShapePath { strokeWidth: root.borderThick - strokeColor: Appearance.colors.colPrimary + strokeColor: Appearance.colors.colError fillColor: "transparent" capStyle: ShapePath.RoundCap joinStyle: ShapePath.MiterJoin From ce57b46d1f055662be662bcaf3ae6dc19a7e7642 Mon Sep 17 00:00:00 2001 From: Abscissa24 Date: Fri, 13 Nov 2026 15:59:11 +0200 Subject: [PATCH 35/35] fix(overlay): keep the countdown border in the accent colour The accent colour is what the border should use; the error colour is reserved for the countdown text in the battery popup. --- src/share/sleex/CriticalBatteryOverlay.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/share/sleex/CriticalBatteryOverlay.qml b/src/share/sleex/CriticalBatteryOverlay.qml index c184fd21..d9b2c26c 100644 --- a/src/share/sleex/CriticalBatteryOverlay.qml +++ b/src/share/sleex/CriticalBatteryOverlay.qml @@ -44,7 +44,7 @@ Scope { component EdgePath: ShapePath { strokeWidth: root.borderThick - strokeColor: Appearance.colors.colError + strokeColor: Appearance.colors.colPrimary fillColor: "transparent" capStyle: ShapePath.RoundCap joinStyle: ShapePath.MiterJoin