From aa0d70f8b31691091f4fc12a33d07d8b0b231013 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 1 Apr 2020 15:23:49 +0100 Subject: [PATCH] add options for current monitor/desktop and all windows --- src/window-select | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/window-select b/src/window-select index 252f657..cb56952 100755 --- a/src/window-select +++ b/src/window-select @@ -2,11 +2,25 @@ # dependency - xtitle +# arguments: +# none - select from windows on current desktop +# 'monitor' - select from all windows. +# 'all' - select from all windows. + . "$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)) + # NOTE: query can be '.window', '.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). + if [ "$1" = all ] ; then + ids=($(bspc query -N -n ".window")) + elif [ "$1" = monitor ] ; then + ids=($(bspc query -N -m "focused")) + else + # current desktop + ids=($(bspc query -N -n ".local.window")) + fi options="$(xtitle "${ids[@]}" | awk '{ print ++i": "$0 }')" [[ -n "$options" ]] || exit @@ -15,6 +29,4 @@ if command -v bspc ; then [[ -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