diff --git a/de/home/.config/eww/eww.yuck b/de/home/.config/eww/eww.yuck index 8276aa2..d01da3b 100644 --- a/de/home/.config/eww/eww.yuck +++ b/de/home/.config/eww/eww.yuck @@ -41,9 +41,12 @@ (button :onclick 'blueman-manager' "")) -(defvar inhibit_active false) +(defpoll inhibit_active :initial false + :interval "5s" + "scripts/inhibit-status") + (defwidget idleinhibit [] - (button :onclick 'notify-send "test"' + (button :onclick {inhibit_active ? 'killall eww-idle-inhibit' : 'scripts/eww-idle-inhibit'} :class {inhibit_active ? "active" : ""} {inhibit_active ? "" : ""})) diff --git a/de/home/.config/eww/scripts/eww-idle-inhibit b/de/home/.config/eww/scripts/eww-idle-inhibit new file mode 100755 index 0000000..73ef7c7 --- /dev/null +++ b/de/home/.config/eww/scripts/eww-idle-inhibit @@ -0,0 +1,3 @@ +#!/bin/bash + +systemd-inhibit sleep infinity diff --git a/de/home/.config/eww/scripts/inhibit-status b/de/home/.config/eww/scripts/inhibit-status new file mode 100755 index 0000000..ee631f3 --- /dev/null +++ b/de/home/.config/eww/scripts/inhibit-status @@ -0,0 +1,8 @@ +#!/bin/bash + +inhibit_active=false +if pgrep eww-idle-inhibi;then + inhibit_active=true +fi + +printf '%s' "${inhibit_active}"