#!/bin/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: current=$(wmctrl -m | grep Name | awk {'print $2'}) # - 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 System\nEdit config\nEdit dotfiles\nEdit power menu" | rofi -dmenu -width 10 -lines 7 -i -p "Power Menu:") # Info about some states are available here: # https://www.freedesktop.org/software/systemd/man/systemd-sleep.conf.html#Description if [[ $chosen = "Logout" ]]; then pkill $current elif [[ $chosen = "Shutdown" ]]; then systemctl poweroff elif [[ $chosen = "Reboot System" ]]; then systemctl reboot elif [[ $chosen = "Edit config" ]]; then if [[ $current = "spectrwm" ]]; then alacritty -e nvim ~/.spectrwm.conf elif [[ $current = "awesome" ]]; then alacritty -e nvim ~/.config/awesome/rc.lua elif [[ $current = "leftwm" ]]; then alacritty -e nvim ~/.config/leftwm/config.toml fi elif [[ $chosen = "Edit dotfiles" ]]; then ~/.config/rofi/scripts/dmenu-edit-configs.sh elif [[ $chosen = "Edit power menu" ]]; then alacritty -e nvim $HOME/.config/rofi/scripts/power-menu.sh fi