forked from Shinonome/dots-hyprland
right sidebar: fix idle inhibitor exiting on close (#1381)
This commit is contained in:
@@ -3,16 +3,28 @@ import "root:/modules/common/widgets"
|
|||||||
import "../"
|
import "../"
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
QuickToggleButton {
|
QuickToggleButton {
|
||||||
|
id: root
|
||||||
toggled: idleInhibitor.running
|
toggled: idleInhibitor.running
|
||||||
buttonIcon: "coffee"
|
buttonIcon: "coffee"
|
||||||
onClicked: {
|
onClicked: {
|
||||||
idleInhibitor.running = !idleInhibitor.running
|
if (toggled) {
|
||||||
|
root.toggled = false
|
||||||
|
Hyprland.dispatch("exec pkill wayland-idle") // pkill doesn't accept too long names
|
||||||
|
} else {
|
||||||
|
root.toggled = true
|
||||||
|
Hyprland.dispatch('exec ${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/scripts/wayland-idle-inhibitor.py')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Process {
|
Process {
|
||||||
id: idleInhibitor
|
id: fetchActiveState
|
||||||
command: ["bash", "-c", "${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/scripts/wayland-idle-inhibitor.py"]
|
running: true
|
||||||
|
command: ["bash", "-c", "pidof wayland-idle-inhibitor.py"]
|
||||||
|
onExited: (exitCode, exitStatus) => {
|
||||||
|
root.toggled = exitCode === 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
StyledToolTip {
|
StyledToolTip {
|
||||||
content: qsTr("Keep system awake")
|
content: qsTr("Keep system awake")
|
||||||
|
|||||||
Reference in New Issue
Block a user