dotfiles/.config/dmenu-wl/dmenu_bspwm_desktop_content

45 lines
1,009 B
Text
Raw Permalink Normal View History

2020-08-17 20:04:10 +02:00
#!/usr/bin/env zsh
2020-03-04 03:51:39 +01:00
2020-08-17 20:04:10 +02:00
if [[ -f $HOME/.zsh_alias ]]; then
source $HOME/.zsh_alias
fi
local dmenu_string="Wrong parameter"
2020-03-04 03:51:39 +01:00
case $1 in
"goto")
dmenu_string="Switch to desktop: " ;;
"move")
dmenu_string="Move node to desktop: " ;;
"movefollow")
dmenu_string="Move and follow node to desktop: " ;;
esac
2020-08-17 20:04:10 +02:00
local desktop=$(bspc query -m focused -D --names | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string")
2020-03-04 03:51:39 +01:00
2020-08-17 20:04:10 +02:00
local found=false
2020-03-04 03:51:39 +01:00
2020-08-17 20:04:10 +02:00
local desktop_list=$(bspc query -m focused -D --names)
local desktop_array=("${(f)desktop_list}")
2020-03-04 03:51:39 +01:00
2020-08-17 20:04:10 +02:00
if [[ $desktop != "" ]]; then
for name in $desktop_array; do
2020-03-04 03:51:39 +01:00
if [[ $name == $desktop ]]; then
found=true
fi
done
fi
if [ ! $found = true ]; then
2020-08-17 20:04:10 +02:00
bspc monitor -d $desktop_array $desktop
2020-03-04 03:51:39 +01:00
fi
case $1 in
"goto")
bspc desktop -f $desktop ;;
"move")
bspc node -d $desktop ;;
"movefollow")
bspc node -d $desktop --follow ;;
esac