Compare commits
No commits in common. "97c40a7302c9c2a0aa27d38b3c9c84501de496e9" and "41b75cffca3ce6e2417332c4753ab47c70bce339" have entirely different histories.
97c40a7302
...
41b75cffca
3 changed files with 17 additions and 41 deletions
|
|
@ -1,13 +1,12 @@
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
import "components"
|
import "components"
|
||||||
import "components/bluetooth"
|
import "components/bluetooth"
|
||||||
import "components/hyprland"
|
import "components/hyprland"
|
||||||
import "components/notifications"
|
import "components/notifications"
|
||||||
import "components/tray"
|
import "components/tray"
|
||||||
import qs.config
|
|
||||||
import QtQuick
|
|
||||||
import QtQuick.Layouts
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
|
|
||||||
PanelWindow {
|
PanelWindow {
|
||||||
id: parentWindow
|
id: parentWindow
|
||||||
|
|
@ -19,8 +18,6 @@ PanelWindow {
|
||||||
implicitHeight: Dimensions.bar.height
|
implicitHeight: Dimensions.bar.height
|
||||||
color: 'transparent'
|
color: 'transparent'
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Top
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.constants
|
import qs.constants
|
||||||
import qs.services
|
|
||||||
import qs.widgets
|
import qs.widgets
|
||||||
|
import Quickshell.Io
|
||||||
|
|
||||||
StyledButton {
|
StyledButton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
border.color: Caffeine.enabled ? Theme.palette.secondary : 'transparent'
|
border.color: process.running ? Theme.palette.secondary : 'transparent'
|
||||||
border.width: 2
|
border.width: 2
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
Caffeine.toggle();
|
if (process.running) {
|
||||||
|
process.signal(888);
|
||||||
|
process.running = false;
|
||||||
|
} else {
|
||||||
|
process.running = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
content: StyledText {
|
content: StyledText {
|
||||||
|
|
@ -23,4 +28,9 @@ StyledButton {
|
||||||
|
|
||||||
color: root.containsMouse ? Theme.palette.base300 : Theme.palette.basecontent
|
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"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue