Add move window here functionality.

This commit is contained in:
Gabriel Ebner 2020-07-16 16:32:04 +02:00
parent 9ba3e7773f
commit 241b655b50
2 changed files with 16 additions and 4 deletions

View File

@ -24,6 +24,7 @@ bindsym $mod+Shift+q kill
bindsym $mod+d exec wofi --show run -i bindsym $mod+d exec wofi --show run -i
bindsym $mod+Tab exec ~/etc/wofi-windows bindsym $mod+Tab exec ~/etc/wofi-windows
bindsym $mod+shift+Tab exec ~/etc/wofi-windows movehere
bindsym $mod+p exec ~/etc/wofi-pass bindsym $mod+p exec ~/etc/wofi-pass
define([dir_bind], [ define([dir_bind], [

View File

@ -3,8 +3,19 @@
# Get available windows # 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') 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 case "$1" in
selected=$(echo "$windows" | wofi --show dmenu -i -p 'go to window' | awk '{print $1}') movehere)
cmd="move workspace current"
prompt="move window here"
;;
*)
cmd="focus"
prompt="go to window"
;;
esac
# Tell sway to focus said window # Select window with rofi
swaymsg "[con_id=$selected]" focus selected=$(echo "$windows" | wofi --show dmenu -i -p "$prompt" | awk '{print $1}')
# Tell sway to frobnicate said window
swaymsg "[con_id=$selected]" $cmd