1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env bash
- # Simple script to handle a DIY shutdown menu. When run you should see a bunch of options (shutdown, reboot etc.)
- #
- # Requirements:
- # - rofi
- # - systemd, but you can replace the commands for OpenRC or anything else
- #
- # Instructions:
- # - Save this file as power.sh or anything
- # - Give it exec priviledge, or chmod +x /path/to/power.sh
- # - Run it
- chosen=$(echo -e "[Cancel]\nLogout\nShutdown\nReboot\nSuspend\nHibernate\nHybrid-sleep\nSuspend-then-hibernate" | rofi -dmenu -i)
- # Info about some states are available here:
- # https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description
- if [[ $chosen = "Logout" ]]; then
- jwm -exit
- elif [[ $chosen = "Shutdown" ]]; then
- systemctl poweroff
- elif [[ $chosen = "Reboot" ]]; then
- systemctl reboot
- elif [[ $chosen = "Suspend" ]]; then
- systemctl suspend
- elif [[ $chosen = "Hibernate" ]]; then
- systemctl hibernate
- elif [[ $chosen = "Hybrid-sleep" ]]; then
- systemctl hibernate
- elif [[ $chosen = "Suspend-then-hibernate" ]]; then
- systemctl suspend-then-hibernate
- fi
|