44 lines
1,009 B
Bash
Executable file
44 lines
1,009 B
Bash
Executable file
#!/usr/bin/env zsh
|
|
|
|
if [[ -f $HOME/.zsh_alias ]]; then
|
|
source $HOME/.zsh_alias
|
|
fi
|
|
|
|
local dmenu_string="Wrong parameter"
|
|
|
|
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
|
|
|
|
local desktop=$(bspc query -m focused -D --names | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string")
|
|
|
|
local found=false
|
|
|
|
local desktop_list=$(bspc query -m focused -D --names)
|
|
local desktop_array=("${(f)desktop_list}")
|
|
|
|
if [[ $desktop != "" ]]; then
|
|
for name in $desktop_array; do
|
|
if [[ $name == $desktop ]]; then
|
|
found=true
|
|
fi
|
|
done
|
|
fi
|
|
|
|
if [ ! $found = true ]; then
|
|
bspc monitor -d $desktop_array $desktop
|
|
fi
|
|
|
|
case $1 in
|
|
"goto")
|
|
bspc desktop -f $desktop ;;
|
|
"move")
|
|
bspc node -d $desktop ;;
|
|
"movefollow")
|
|
bspc node -d $desktop --follow ;;
|
|
esac
|