scripts/rofi/sway-alt-tab.sh

19 lines
412 B
Bash
Executable File

#!/bin/bash
swaymsg -t get_tree |
jq -r '.nodes[].nodes[] | if .nodes then [recurse(.nodes[])] else [] end + .floating_nodes | .[] | select(.nodes==[]) | ((.id | tostring) + "\t" + .name)' |
sed -e 's/ - [^-]*//' |
sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \1/' |
rofi -dmenu -config ~/.config/rofi/sidebar.rasi | {
read -r
id=`echo $REPLY | rev | cut -d' ' -f1 | rev`
swaymsg "[con_id=$id]" focus
}