scripts/wofi/wofi-alt-tab.sh

15 lines
600 B
Bash
Raw Normal View History

#!/bin/bash
swaymsg -t get_tree |
2023-01-06 19:41:31 +00:00
jq -r '.nodes[].nodes[] | if .nodes then [recurse(.nodes[])] else [] end + .floating_nodes | .[] | select(.nodes==[]) | if .app_id then ((.app_id | tostring) + " -- " + .name) else .name end' |
grep -v __i3_scratch |
sed -e 's/^.*\-\- \(.*\)$/\1/' |
sed -e 's/^\(.*\) [—-] .*$/\1/'|
sed -e 's/^\([0-9]*\)\t*\(.*\)/\2 \1/' |
wofi -s $HOME/.dotfiles/wofi/style.css -c \
2023-01-07 13:16:47 +00:00
$HOME/.dotfiles/wofi/sidebar -d | {
2023-01-06 19:41:31 +00:00
read -r
id=`echo $REPLY | rev | cut -d' ' -f1 | rev`
swaymsg "[con_id=$id]" focus
}
echo $id $REPLY