scripts/rofi/sway-alt-tab.sh

19 lines
412 B
Bash
Raw Normal View History

2020-09-11 15:00:39 +00:00
#!/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 | {
2023-01-06 19:41:31 +00:00
read -r
2020-09-11 15:00:39 +00:00
2023-01-06 19:41:31 +00:00
id=`echo $REPLY | rev | cut -d' ' -f1 | rev`
2020-09-11 15:00:39 +00:00
2023-01-06 19:41:31 +00:00
swaymsg "[con_id=$id]" focus
2020-09-11 15:00:39 +00:00
}