#!/bin/sh
|
|
|
|
# Set environment
|
|
export BSPWM_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/bspwm"
|
|
|
|
# Function to kill programs
|
|
killprogs() {
|
|
# Kill udisks-glue
|
|
pkill -x udisks-glue
|
|
# Kill panel
|
|
pkill -x panel
|
|
# Kill Redshift
|
|
pkill -x redshift
|
|
}
|
|
|
|
|
|
# Logout function
|
|
logout() {
|
|
pkill dwm
|
|
}
|
|
|
|
# Load dmenu config
|
|
# shellcheck source=/dev/null
|
|
[ -f "$HOME/.dmenurc" ] && . "$HOME/.dmenurc" || DMENU='dmenu -z 1900 -x 10 -y 10 -i'
|
|
|
|
# Menu items
|
|
items="logout
|
|
suspend
|
|
hibernate
|
|
reboot
|
|
poweroff"
|
|
|
|
# Open menu
|
|
selection=$(printf '%s' "$items" | $DMENU)
|
|
|
|
case $selection in
|
|
logout)
|
|
logout
|
|
;;
|
|
hibernate)
|
|
loginctl hibernate
|
|
;;
|
|
suspend)
|
|
sudo /sbin/sleep
|
|
;;
|
|
reboot)
|
|
sudo /sbin/reboot
|
|
;;
|
|
halt|poweroff|shutdown)
|
|
sudo /sbin/shutdown
|
|
;;
|
|
esac
|
|
|
|
exit
|