22 lines
551 B
Plaintext
22 lines
551 B
Plaintext
|
#!/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')
|
||
|
|
||
|
case "$1" in
|
||
|
movehere)
|
||
|
cmd="move workspace current"
|
||
|
prompt="move window here"
|
||
|
;;
|
||
|
*)
|
||
|
cmd="focus"
|
||
|
prompt="go to window"
|
||
|
;;
|
||
|
esac
|
||
|
|
||
|
# Select window with rofi
|
||
|
selected=$(echo "$windows" | rofi -dmenu -p "$prompt" | awk '{print $1}')
|
||
|
|
||
|
# Tell sway to frobnicate said window
|
||
|
swaymsg "[con_id=$selected]" $cmd
|