#!/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)
|
|
firefox-sync &
|
|
kill -9 "$DBUS_SESSION_BUS_PID"
|
|
kill -9 "$XSESSION_PID"
|
|
;;
|
|
hibernate)
|
|
loginctl hibernate
|
|
;;
|
|
suspend)
|
|
sudo sleep
|
|
;;
|
|
reboot)
|
|
sudo reboot
|
|
;;
|
|
halt|poweroff|shutdown)
|
|
sudo shutdown -h now
|
|
;;
|
|
esac
|
|
|
|
exit
|