From ac6a64efaba8023b258dbdeada1a2d047a88ae21 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 11 Jun 2025 08:25:05 +0200 Subject: [PATCH] right sidebar: fix idle inhibitor exiting on close (#1381) --- .../quickToggles/IdleInhibitor.qml | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.config/quickshell/modules/sidebarRight/quickToggles/IdleInhibitor.qml b/.config/quickshell/modules/sidebarRight/quickToggles/IdleInhibitor.qml index 4ac63d22..5080d99a 100644 --- a/.config/quickshell/modules/sidebarRight/quickToggles/IdleInhibitor.qml +++ b/.config/quickshell/modules/sidebarRight/quickToggles/IdleInhibitor.qml @@ -3,16 +3,28 @@ import "root:/modules/common/widgets" import "../" import Quickshell.Io import Quickshell +import Quickshell.Hyprland QuickToggleButton { + id: root toggled: idleInhibitor.running buttonIcon: "coffee" 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 { - id: idleInhibitor - command: ["bash", "-c", "${XDG_CONFIG_HOME:-$HOME/.config}/quickshell/scripts/wayland-idle-inhibitor.py"] + id: fetchActiveState + running: true + command: ["bash", "-c", "pidof wayland-idle-inhibitor.py"] + onExited: (exitCode, exitStatus) => { + root.toggled = exitCode === 0 + } } StyledToolTip { content: qsTr("Keep system awake")