dotfiles/.config/dmenu-wl/dmenu_bspwm_desktop

57 lines
1.4 KiB
Text
Raw Normal View History

2020-08-17 20:04:10 +02:00
#!/usr/bin/env zsh
2020-08-17 20:04:10 +02:00
if [[ -f $HOME/.zsh_alias ]]; then
source $HOME/.zsh_alias
fi
local dmenu_string="Wrong parameter"
case $1 in
"rename")
dmenu_string="Rename desktop to: " ;;
"delete")
dmenu_string="Really delete this desktop? (n = abort): " ;;
"swap")
dmenu_string="Swap desktop with desktop: " ;;
"swapfollow")
dmenu_string="Swap and follow desktop with desktop: " ;;
esac
2020-08-17 20:04:10 +02:00
local desktop=""
if [[ $1 == "delete" || $1 == "rename" ]]; then
2020-08-17 20:04:10 +02:00
desktop=$(echo "" | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string")
else
if [[ $1 != "bubbleprev" && $1 != "bubblenext" && $1 != "save" && $1 != "load" ]]; then
2020-08-17 20:04:10 +02:00
desktop=$(bspc query -m focused -D --names | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string")
fi
fi
case $1 in
"rename")
if [[ $desktop != "" ]];
then
bspc desktop -n $desktop
fi
;;
"delete")
echo $desktop
if [[ $desktop != "n" ]];
then
bspc desktop -r
fi
;;
"swap")
bspc desktop -s $desktop ;;
"swapfollow")
bspc desktop -s $desktop --follow ;;
"bubbleprev")
bspc desktop -b prev ;;
"bubblenext")
bspc desktop -b next ;;
"save")
bspwm-save ;;
"load")
bspwm-load ;;
esac