etc/wofi-windows

22 lines
560 B
Plaintext
Raw Normal View History

2020-07-14 13:36:35 +00:00
#!/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')
2020-07-16 14:32:04 +00:00
case "$1" in
movehere)
cmd="move workspace current"
prompt="move window here"
;;
*)
cmd="focus"
prompt="go to window"
;;
esac
2020-07-14 13:36:35 +00:00
# Select window with rofi
2020-07-16 14:32:04 +00:00
selected=$(echo "$windows" | wofi --show dmenu -i -p "$prompt" | awk '{print $1}')
2020-07-14 13:36:35 +00:00
2020-07-16 14:32:04 +00:00
# Tell sway to frobnicate said window
swaymsg "[con_id=$selected]" $cmd