Compare commits
2 Commits
632745c36d
...
3799873323
Author | SHA1 | Date | |
---|---|---|---|
3799873323 | |||
ed379a1131 |
@ -16,9 +16,23 @@
|
||||
(build-system copy-build-system)
|
||||
(arguments
|
||||
'(#:install-plan
|
||||
'(("prevent-sleep" "bin/"))))
|
||||
(propagated-inputs
|
||||
`(("yad" ,yad)))
|
||||
'(("prevent-sleep" "bin/")
|
||||
("prevent-sleep.desktop" "share/applications/"))
|
||||
#:phases
|
||||
(modify-phases %standard-phases
|
||||
(add-after 'unpack 'configure
|
||||
(lambda* (#:key inputs outputs #:allow-other-keys)
|
||||
(substitute* (list "prevent-sleep")
|
||||
(("@YAD_PATH@")
|
||||
(string-append (assoc-ref inputs "yad")
|
||||
"/bin")))
|
||||
(substitute* (list "prevent-sleep.desktop")
|
||||
(("@EXEC@")
|
||||
(string-append (assoc-ref outputs "out")
|
||||
"/bin/prevent-sleep")))
|
||||
#t)))))
|
||||
(inputs
|
||||
`(("yad" ,yad)))
|
||||
(synopsis "Prevent sleep")
|
||||
(description
|
||||
"Prevent sleep")
|
||||
|
@ -1,9 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
gnome-session-inhibit --reason "$(whoami) said so..." \
|
||||
--inhibit suspend \
|
||||
yad --title "Prevent Suspend" \
|
||||
--text "We will NOT sleep, unless you click \"OK\"!" \
|
||||
--button=gtk-ok \
|
||||
REASON="$(whoami) said so..."
|
||||
TITLE="Prevent Suspend"
|
||||
TEXT="We will NOT sleep, unless you click \"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[@]}"
|
||||
|
@ -0,0 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Suspend Inhibitor
|
||||
Icon=gnome-power-manager
|
||||
Exec=@EXEC@
|
||||
Terminal=false
|
Loading…
x
Reference in New Issue
Block a user