diff options
author | Raul Benencia <id@rbenencia.name> | 2024-10-17 10:23:49 -0700 |
---|---|---|
committer | Raul Benencia <id@rbenencia.name> | 2024-10-17 10:24:38 -0700 |
commit | 9848e7051fca898fcd46d3afa1a1859c9fdd7b9a (patch) | |
tree | 5cb5b44c29479fa48a9f11da0cbee4a717d10a59 | |
parent | 11f99ab0413be1d01860282f6db3e3435ef3ebf4 (diff) |
gnome: tweak gnome-move-windows to support secondary displays
-rwxr-xr-x | bin/gnome-move-windows | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/bin/gnome-move-windows b/bin/gnome-move-windows index 2eb9462..3ca3069 100755 --- a/bin/gnome-move-windows +++ b/bin/gnome-move-windows @@ -2,23 +2,35 @@ # Move windows according to my workflow. Check bin/gnome-set-config to # see its key-binding. Needs wmctrl. -emacs_main="$(wmctrl -l | awk '/ main$/ {print $1}')" -emacs_communications="$(wmctrl -l | awk '/ communications$/ {print $1}')" -emacs_terminals="$(wmctrl -l | awk '/ terminals$/ {print $1}')" -browsers="$(wmctrl -l | grep -i -e firefox -e chrom | awk '{print $1}' | tr '\n' ' ')" +# Move all windows to the primary display. If they're on the secondary +# display, and we try to move them to a workspace, it won't work. +for window_id in $(wmctrl -l | awk '{print $1}'); do + wmctrl -i -r $window_id -e 0,0,0,-1,-1 +done -if [ -n "$emacs_main" ]; then - wmctrl -i -r $emacs_main -t 0 -fi +# Assign windows to predetermined workplaces +misc=$(wmctrl -l | awk '/isco|eepa/ {print $1}') +main="$(wmctrl -l | awk '/ main$/ {print $1}')" +communications="$(wmctrl -l | awk '/Webex|Slack|communications/ {print $1}')" +terminals="$(wmctrl -l | awk '/Alacritty|terminals$/ {print $1}')" +browsers="$(wmctrl -l | awk '/Firefox|Chrom/ {print $1}')" -if [ -n "$emacs_communications" ]; then - wmctrl -i -r $emacs_communications -t 2 -fi +for window_id in $misc; do + wmctrl -i -r $window_id -t 4 +done -if [ -n "$emacs_terminals" ]; then - wmctrl -i -r $emacs_terminals -t 3 -fi +for window_id in $main; do + wmctrl -i -r $window_id -t 0 +done -for browser in $browsers; do - wmctrl -i -r $browser -t 1 +for window_id in $browsers; do + wmctrl -i -r $window_id -t 1 done + +for window_id in $communications; do + wmctrl -i -r $window_id -t 2 +fi + +for window_id in $terminals; do + wmctrl -i -r $window_id -t 3 +fi |