From 8f3245c4e32dde8d6b39977badad427f5ae20b50 Mon Sep 17 00:00:00 2001
From: Raúl Benencia <id@rbenencia.name>
Date: Wed, 16 Oct 2024 08:38:21 -0700
Subject: gnome: move windows programatically

---
 bin/gnome-move-windows | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100755 bin/gnome-move-windows

(limited to 'bin/gnome-move-windows')

diff --git a/bin/gnome-move-windows b/bin/gnome-move-windows
new file mode 100755
index 0000000..2eb9462
--- /dev/null
+++ b/bin/gnome-move-windows
@@ -0,0 +1,24 @@
+#!/bin/sh
+# 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' ' ')"
+
+if [ -n "$emacs_main" ]; then
+    wmctrl -i -r $emacs_main -t 0
+fi
+
+if [ -n "$emacs_communications" ]; then
+    wmctrl -i -r $emacs_communications -t 2
+fi
+
+if [ -n "$emacs_terminals" ]; then
+    wmctrl -i -r $emacs_terminals -t 3
+fi
+
+for browser in $browsers; do
+    wmctrl -i -r $browser -t 1
+done
-- 
cgit v1.2.3