You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

64 lines
1.0 KiB

#!/usr/bin/sh
isPhone(){
case "$(hostname)" in
*-phone) return 0 ;;
*) return 1 ;;
esac
}
if type -p rofi 2> /dev/null; then
if isPhone; then
theme="themes/power-phone.rasi"
else
theme="themes/power.rasi"
fi
alias selectcommand="rofi -dmenu -i -theme $theme -me-select-entry '' -me-accept-entry MousePrimary"
shutdown=""
reboot=""
lock=""
suspend=""
logout="﫼"
else
alias selectcommand="dmenu -i -p 'Option'"
shutdown="Shutdown"
reboot="Reboot"
lock="Lock"
suspend="Suspend"
logout="Logout"
fi
hostname="$(hostname)"
if isPhone; then
selection="$(echo -e "$shutdown\n$reboot\n$lock\n$logout" | selectcommand)"
else
selection="$(echo -e "$lock\n$shutdown\n$reboot\n$logout\n$suspend" | selectcommand)"
fi
sleep .2
case $selection in
$lock)
if isPhone; then
screenlock --suspend
else
i3exit lock
fi
;;
$logout)
pkill dwm
;;
$suspend)
systemctl suspend
if !isPhone; then
i3exit lock
fi
;;
$reboot)
systemctl reboot
;;
$shutdown)
systemctl poweroff
;;
esac