This repository has been archived on 2024-09-01. You can view files and clone it, but cannot push or open issues or pull requests.
al-skel/home/bin/rofi-logout.template

29 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/usr/bin/env bash
2017-12-02 01:06:11 -06:00
CUR_WM=$(xprop -root | grep "_NET_WM_NAME(UTF8_STRING)" | cut -d " " -f 3 | sed 's/"//g' | awk '{print tolower($0)}')
ANS=$(echo " lock| logout| reboot| shutdown" | rofi -sep "|" -dmenu -i -p 'System: ' "" -width 20 -hide-scrollbar -location 0 -yoffset -200 -font "Ubuntu 11" -eh 1 -line-padding 4 -padding 30 -no-config -lines 4 -color-enabled -color-window "{{.Data.terminal_background}}, {{.Data.terminal_foreground}}, {{.Data.terminal_background}}" -color-normal "{{.Data.terminal_background}}, {{.Data.terminal_foreground}}, {{.Data.terminal_background}}, {{index .Data.terminal_colors 4}}, {{.Data.terminal_background}}")
if [[ "$ANS" == *lock ]]; then
i3lock-fancy
elif [[ "$ANS" == *logout ]]; then
2017-12-02 01:06:11 -06:00
if [[ "$CUR_WM" == "i3" ]]; then
i3-msg exit
elif [[ "$CUR_WM" == "bspwm" ]]; then
for window_id in $(bspc query -W); do
bspc window $window_id -c
done
killall sxhkd
bspc quit
elif [[ "$CUR_WM" == "bspwm" ]]; then
openbox --exit
else
echo "Unknown WM... Exiting"
exit 1
fi
elif [[ "$ANS" == *reboot ]]; then
systemctl reboot
elif [[ "$ANS" == *shutdown ]]; then
systemctl poweroff
fi