add window-select script

This commit is contained in:
Ray Elliott 2020-04-01 14:30:25 +01:00
parent 3d388e9fc8
commit 848802eb94
1 changed files with 20 additions and 0 deletions

20
src/window-select Executable file
View File

@ -0,0 +1,20 @@
#!/bin/bash
# dependency - xtitle
. "$HOME/.config/dmenu/dmenurc"
if command -v bspc ; then
# adapted from: https://www.reddit.com/r/bspwm/comments/er2olp/dmenu_window_picker/ff16ff0/
ids=($(bspc query -N -n .window))
options="$(xtitle "${ids[@]}" | awk '{ print ++i": "$0 }')"
[[ -n "$options" ]] || exit
id_index="$(<<< "$options" dmenu $DMENU_OPTIONS | cut -d: -f1)"
[[ -n "$id_index" ]] || exit
bspc node "${ids[$((id_index - 1))]}" -f
# NOTE: you can change the query from '.window' to '.local.window', '.local.tiled' (to only have tiled windows
# as options) or '.local.window.!fullscreen.!floating' (to only have tiled and pseudo_tiled windows as options).
fi