summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xhyprshutdown.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/hyprshutdown.sh b/hyprshutdown.sh
new file mode 100755
index 0000000..9e78c91
--- /dev/null
+++ b/hyprshutdown.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env sh
+
+WAIT=10 # in seconds
+self=$$
+cancel="Cancel"
+confirm="Confirm"
+
+function dialog {
+ ans=$(timeout 1.2 hyprland-dialog --apptitle hyprshutdown --title "Shutting down in $1" --buttons "$cancel;$confirm")
+ if [[ $ans == $confirm ]]; then
+ hyprshutdown
+ kill $self
+ elif [[ $ans == $cancel ]]; then
+ kill $self
+ fi
+}
+
+for ((i=WAIT; i>=0; i--)); do
+ dialog $i &
+ sleep 1
+done