- With polybar hidden window count module.
-
Needs
fzf
The script:
#!/bin/sh BIN_NAME=${0##*/} unhide(){ bspc node $(bspc query -N -n .hidden | tail -n1) -g hidden=off polybar_refresh } hide(){ bspc node focused -g hidden=on polybar_refresh } unhide_all(){ bspc query -N -n .hidden | xargs -I {} bspc node {} -g hidden=off polybar_refresh } hide_select(){ bspc query -N -n .window | xargs -I {} dash -c "printf '{}\t'; xdotool getwindowname {}" | fzf | cut -f 1 | xargs -I {} bspc node {} -g hidden=on polybar_refresh } unhide_select(){ bspc query -N -n .hidden | xargs -I {} dash -c "printf '{}\t'; xdotool getwindowname {}" | fzf | cut -f 1 | xargs -I {} bspc node {} -g hidden=off polybar_refresh } polybar_refresh(){ polybar-msg hook hidden 1 } help(){ cat <<EOF $BIN_NAME h hide focused $BIN_NAME u unhide focused $BIN_NAME ua unhide all $BIN_NAME sh hide select $BIN_NAME su unhide select $BIN_NAME r refresh polybar hidden count $BIN_NAME * help EOF } case $1 in "h") hide ;; "u") unhide ;; "ua") unhide_all ;; "sh" ) hide_select ;; "su" ) unhide_select ;; "r" ) polybar_refresh ;; *) help;; esac
Polybar module
[module/hidden] type = custom/ipc hook-0 = echo H:$(bspc query -N -n .hidden | wc -l) initial = 1
Together with sxhkd
hotkey binding
# # hide # alt + shift + h xterm -e hide sh alt + shift + u xterm -e hide su alt + shift + t hide h alt + shift + r hide u