Added power confirmation script
This commit is contained in:
parent
80b82e8d86
commit
84fdfab431
10
config
10
config
@ -18,7 +18,7 @@
|
||||
"disable-scroll": true,
|
||||
"all-outputs": false,
|
||||
"active-only": false,
|
||||
"show-special": true,
|
||||
"show-special": false,
|
||||
"format": "{name}"
|
||||
},
|
||||
"hyprland/window": {
|
||||
@ -109,15 +109,15 @@
|
||||
},
|
||||
"modules": [
|
||||
"custom/power", // First element is the "group leader" and won't ever be hidden
|
||||
"custom/exit",
|
||||
"custom/lock",
|
||||
"custom/exit",
|
||||
"custom/reboot",
|
||||
]
|
||||
},
|
||||
"custom/exit": {
|
||||
"format": " ",
|
||||
"tooltip": false,
|
||||
"on-click": "hyprctl dispatch exit"
|
||||
"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"hyprctl dispatch exit\""
|
||||
},
|
||||
"custom/lock": {
|
||||
"format": " ",
|
||||
@ -127,11 +127,11 @@
|
||||
"custom/reboot": {
|
||||
"format": " ",
|
||||
"tooltip": false,
|
||||
"on-click": "reboot"
|
||||
"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"reboot\""
|
||||
},
|
||||
"custom/power": {
|
||||
"format": " ",
|
||||
"tooltip": false,
|
||||
"on-click": "shutdown now"
|
||||
"on-click": "bash ~/.config/waybar/scripts/confirm.sh \"shutdown now\""
|
||||
}
|
||||
}
|
||||
|
12
scripts/confirm.sh
Executable file
12
scripts/confirm.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
ACTION=$1
|
||||
LOCKFILE="/tmp/confirm_$(echo -n $ACTION | md5sum | awk '{print $1}')"
|
||||
|
||||
if [ -f "$LOCKFILE" ]; then
|
||||
rm "$LOCKFILE"
|
||||
$ACTION
|
||||
else
|
||||
touch "$LOCKFILE"
|
||||
notify-send "Нажмите ещё раз для подтверждения" -t 5000 -w
|
||||
rm "$LOCKFILE"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user