aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gnome-move-windows42
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
nihil fit ex nihilo