diff --git a/modules/bar/Bar.qml b/modules/bar/Bar.qml index 1f468d4..06f5572 100644 --- a/modules/bar/Bar.qml +++ b/modules/bar/Bar.qml @@ -1,13 +1,12 @@ +import qs.config +import QtQuick +import QtQuick.Layouts +import Quickshell import "components" import "components/bluetooth" import "components/hyprland" import "components/notifications" import "components/tray" -import qs.config -import QtQuick -import QtQuick.Layouts -import Quickshell -import Quickshell.Wayland PanelWindow { id: parentWindow @@ -19,8 +18,6 @@ PanelWindow { implicitHeight: Dimensions.bar.height color: 'transparent' - WlrLayershell.layer: WlrLayer.Top - Item { anchors.fill: parent diff --git a/modules/bar/components/Caffeine.qml b/modules/bar/components/Caffeine.qml index dd5588c..d97ebd1 100644 --- a/modules/bar/components/Caffeine.qml +++ b/modules/bar/components/Caffeine.qml @@ -1,16 +1,21 @@ import qs.config import qs.constants -import qs.services import qs.widgets +import Quickshell.Io StyledButton { id: root - border.color: Caffeine.enabled ? Theme.palette.secondary : 'transparent' + border.color: process.running ? Theme.palette.secondary : 'transparent' border.width: 2 onClicked: { - Caffeine.toggle(); + if (process.running) { + process.signal(888); + process.running = false; + } else { + process.running = true; + } } content: StyledText { @@ -23,4 +28,9 @@ StyledButton { color: root.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent } + + Process { + id: process + command: ["sh", "-c", "systemd-inhibit --what=idle --who=Caffeine --why='Caffeine module is active' --mode=block sleep inf"] + } } diff --git a/services/Caffeine.qml b/services/Caffeine.qml deleted file mode 100644 index 04680b0..0000000 --- a/services/Caffeine.qml +++ /dev/null @@ -1,31 +0,0 @@ -pragma Singleton - -import Quickshell -import Quickshell.Io - -Singleton { - - property alias enabled: properties.enabled - - PersistentProperties { - id: properties - reloadableId: "Caffeine" - - property bool enabled: false - } - - function toggle() { - if (properties.enabled) { - process.signal(888); - properties.enabled = false; - } else { - properties.enabled = true; - } - } - - Process { - id: process - running: properties.enabled - command: ["sh", "-c", "systemd-inhibit --what=idle --who=Caffeine --why='Caffeine module is active' --mode=block sleep inf"] - } -}