| 1 | #!/bin/bash |
| 2 | |
| 3 | rofi_command="rofi -theme danixland/powermenu.rasi" |
| 4 | |
| 5 | ### Options ### |
| 6 | power_off="" |
| 7 | reboot="" |
| 8 | lock="" |
| 9 | suspend="鈴" |
| 10 | log_out="" |
| 11 | # Variable passed to rofi |
| 12 | options="$power_off\n$reboot\n$lock\n$suspend\n$log_out" |
| 13 | |
| 14 | chosen="$(echo -e "$options" | $rofi_command -dmenu -selected-row 2)" |
| 15 | case $chosen in |
| 16 | $power_off) |
| 17 | notify-send 'shutting down' 'the system is going to shutdown now' |
| 18 | sleep 1 |
| 19 | sudo /sbin/shutdown -h now |
| 20 | ;; |
| 21 | $reboot) |
| 22 | notify-send 'rebooting the system' 'the system is going to reboot now' |
| 23 | sleep 1 |
| 24 | sudo /sbin/shutdown -r now |
| 25 | ;; |
| 26 | $lock) |
| 27 | sleep 1 |
| 28 | i3lock-wrapper |
| 29 | ;; |
| 30 | $suspend) |
| 31 | sleep 1 |
| 32 | i3suspend |
| 33 | ;; |
| 34 | $log_out) |
| 35 | i3-exit |
| 36 | ;; |
| 37 | esac |
| 38 | |