foxygit / dotfiles Log in
commit 0e81eaa8e2aef37fc2b54747290b4a1e66516b36
Author:     MrJensK <jens.se@icloud.com>
AuthorDate: Wed Jul 29 20:51:25 2026 +0200
Commit:     MrJensK <jens.se@icloud.com>
CommitDate: Wed Jul 29 20:51:25 2026 +0200

    updates
---
 install.sh              |  7 ++++++-
 net-active-window.patch | 31 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/install.sh b/install.sh
index 1ac8be4..2ae1387 100755
--- a/install.sh
+++ b/install.sh
@@ -33,6 +33,7 @@ sudo apt-get install -y \
     curl \
     unzip \
     fontconfig \
+    wmctrl \

 mkdir -p "$BUILD_DIR"
 cd "$BUILD_DIR"
@@ -41,9 +42,13 @@ echo "==> Klonar sxwm..."
 rm -rf sxwm
 git clone --depth=1 "$SXWM_REPO" sxwm

-echo "==> Applicerar sxwm-patch..."
+echo "==> Applicerar sxwm-patchar..."
 cd sxwm
 patch -p1 < "$SCRIPT_DIR/cursor-dpi-fix.patch"
+# Lägger till stöd för _NET_ACTIVE_WINDOW (behövs för sxbars taskbar-modul
+# -- utan denna gör klick i taskbaren ingenting, sxwm har ingen annan
+# extern mekanism för att fokusera ett specifikt fönster)
+patch -p1 < "$SCRIPT_DIR/net-active-window.patch"

 echo "==> Bygger och installerar sxwm..."
 make
diff --git a/net-active-window.patch b/net-active-window.patch
new file mode 100644
index 0000000..df71ee2
--- /dev/null
+++ b/net-active-window.patch
@@ -0,0 +1,31 @@
+diff --git a/src/sxwm.c b/src/sxwm.c
+index 55fe97b..d25d872 100644
+--- a/src/sxwm.c
++++ b/src/sxwm.c
+@@ -1009,6 +1009,26 @@ void hdl_client_msg(XEvent *xev)
+ 		}
+ 		return;
+ 	}
++
++	if (xev->xclient.message_type == atoms[ATOM_NET_ACTIVE_WINDOW]) {
++		/* external activation request (pagers/taskbars, e.g. `wmctrl -a`)
++		 * -- _NET_ACTIVE_WINDOW is advertised in _NET_SUPPORTED and we
++		 * already publish it read-only to reflect our own focus, but
++		 * nothing accepted requests to change it until now. Switch to
++		 * the client's workspace first if it's not the current one, same
++		 * as a pager would expect, then focus/raise it exactly like
++		 * focus_next/focus_prev do. */
++		XClientMessageEvent *client_msg_ev = &xev->xclient;
++		Window w = client_msg_ev->window;
++		Client *c = find_client(find_toplevel(w));
++		if (!c)
++			return;
++
++		if (c->ws != current_ws)
++			change_workspace(c->ws);
++		set_input_focus(c, True, True);
++		return;
++	}
+ }
+
+ void hdl_config_ntf(XEvent *xev)