prevent-sleep: do not propagate yad input, allow for system yad or zenity to take precedence (since Guix GTK applications don't seem to work with mobian right now)
This commit is contained in:
parent
632745c36d
commit
ed379a1131
@ -16,8 +16,17 @@
|
|||||||
(build-system copy-build-system)
|
(build-system copy-build-system)
|
||||||
(arguments
|
(arguments
|
||||||
'(#:install-plan
|
'(#:install-plan
|
||||||
'(("prevent-sleep" "bin/"))))
|
'(("prevent-sleep" "bin/"))
|
||||||
(propagated-inputs
|
#:phases
|
||||||
|
(modify-phases %standard-phases
|
||||||
|
(add-after 'unpack 'configure
|
||||||
|
(lambda* (#:key inputs #:allow-other-keys)
|
||||||
|
(substitute* (list "prevent-sleep")
|
||||||
|
(("@YAD_PATH@")
|
||||||
|
(string-append (assoc-ref inputs "yad")
|
||||||
|
"/bin")))
|
||||||
|
#t)))))
|
||||||
|
(inputs
|
||||||
`(("yad" ,yad)))
|
`(("yad" ,yad)))
|
||||||
(synopsis "Prevent sleep")
|
(synopsis "Prevent sleep")
|
||||||
(description
|
(description
|
||||||
|
@ -1,9 +1,24 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
gnome-session-inhibit --reason "$(whoami) said so..." \
|
REASON="$(whoami) said so..."
|
||||||
--inhibit suspend \
|
TITLE="Prevent Suspend"
|
||||||
yad --title "Prevent Suspend" \
|
TEXT="We will NOT sleep, unless you click \"OK\"!"
|
||||||
--text "We will NOT sleep, unless you click \"OK\"!" \
|
|
||||||
--button=gtk-ok \
|
|
||||||
|
|
||||||
echo "OK! Zzzzzzzz"
|
YAD_INPUT="@YAD_PATH@/bin/yad"
|
||||||
|
|
||||||
|
if command -v yad &> /dev/null; then
|
||||||
|
COMMAND=(yad --title "$TITLE" \
|
||||||
|
--text "$TEXT" \
|
||||||
|
--button=gtk-ok)
|
||||||
|
elif command -v zenity &> /dev/null; then
|
||||||
|
COMMAND=(zenity --info --title "$TITLE" \
|
||||||
|
--text "$TEXT")
|
||||||
|
elif [ -x $YAD_INPUT ]; then
|
||||||
|
COMMAND=($YAD_INPUT --title "$TITLE" \
|
||||||
|
--text "$TEXT" \
|
||||||
|
--button=gtk-ok)
|
||||||
|
fi
|
||||||
|
|
||||||
|
gnome-session-inhibit --reason "$REASON" \
|
||||||
|
--inhibit suspend \
|
||||||
|
"${COMMAND[@]}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user