diff --git a/config b/config index 60515e3..50188a0 100644 --- a/config +++ b/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\"" } } diff --git a/scripts/confirm.sh b/scripts/confirm.sh new file mode 100755 index 0000000..2bb28e5 --- /dev/null +++ b/scripts/confirm.sh @@ -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