From 848802eb947a57976a72b0f8777e32cb1496742c Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 1 Apr 2020 14:30:25 +0100 Subject: [PATCH] add window-select script --- src/window-select | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 src/window-select diff --git a/src/window-select b/src/window-select new file mode 100755 index 0000000..cfcec2d --- /dev/null +++ b/src/window-select @@ -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