etc/wofi_windows.sh
2020-07-14 15:36:35 +02:00

11 lines
388 B
Bash
Executable File

#!/usr/bin/env bash
# Get available windows
windows=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?)|recurse(.floating_nodes[]?)|select(.type=="con"),select(.type=="floating_con")|(.id|tostring)+" "+.app_id+": "+.name')
# Select window with rofi
selected=$(echo "$windows" | wofi --show dmenu -i | awk '{print $1}')
# Tell sway to focus said window
swaymsg "[con_id=$selected]" focus