Large update to upgrade script, remove unneccessary configs, add additional and fixups
This commit is contained in:
36
home/bin/session-logout
Executable file
36
home/bin/session-logout
Executable file
@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# check which wm were using, case insensitive
|
||||
WMS=(bspwm i3 openbox)
|
||||
for i in ${WMS[@]}; do
|
||||
if [[ "$(wmctrl -m | grep -i name | awk '{print tolower($2)}')" == "$i" ]]; then
|
||||
WM=$i && break
|
||||
elif [[ "$(xprop -root -notype | grep "WM_NAME =" | tr -d '"' | awk '{print tolower($3)}')" == "$i" ]]; then
|
||||
WM=$i && break
|
||||
elif [[ "$(awk '{print tolower($0)}' <<< $XDG_CURRENT_DESKTOP)" == "$i" ]]; then
|
||||
WM=$i && break
|
||||
fi
|
||||
done
|
||||
|
||||
# do the logout
|
||||
case $WM in
|
||||
i3)
|
||||
i3-msg exit
|
||||
;;
|
||||
bspwm)
|
||||
for window_id in $(bspc query -W); do
|
||||
bspc window $window_id -c
|
||||
done
|
||||
killall sxhkd
|
||||
bspc quit
|
||||
;;
|
||||
openbox)
|
||||
openbox --exit
|
||||
;;
|
||||
*)
|
||||
echo "WM not yet supported.. Exiting"
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user