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