[wiki] [sites] Add xinerama-monitors-xorder patch || Lyciih

From: <git_AT_suckless.org>
Date: Mon, 14 Jul 2025 18:08:35 +0200

commit 65b481781d641452baacb701d38e822b99d84424
Author: Lyciih <gnehciyil_AT_gmail.com>
Date: Tue Jul 15 00:04:12 2025 +0800

    Add xinerama-monitors-xorder patch
    
    Sort Xinerama monitors by x_org to match physical screen layout.

diff --git a/dwm.suckless.org/patches/xinerama-monitors-xorder/dwm-xinerama-monitors-xorder-6.4.diff b/dwm.suckless.org/patches/xinerama-monitors-xorder/dwm-xinerama-monitors-xorder-6.4.diff
new file mode 100644
index 00000000..02ca5976
--- /dev/null
+++ b/dwm.suckless.org/patches/xinerama-monitors-xorder/dwm-xinerama-monitors-xorder-6.4.diff
_AT_@ -0,0 +1,28 @@
+--- a/dwm.c 2025-07-14 22:37:49.738597862 +0800
++++ b/dwm.c 2025-07-14 22:37:08.706035689 +0800
+_AT_@ -1864,6 +1864,16 @@ updateclientlist()
+ (unsigned char *) &(c->win), 1);
+ }
+
++#ifdef XINERAMA
++// Custom comparator: sort monitors by x_org to match physical layout left-to-right
++static int
++compare_xinerama_x(const void *a, const void *b) {
++ const XineramaScreenInfo *sa = (const XineramaScreenInfo *)a;
++ const XineramaScreenInfo *sb = (const XineramaScreenInfo *)b;
++ return sa->x_org - sb->x_org;
++}
++#endif /* XINERAMA */
++
+ int
+ updategeom(void)
+ {
+_AT_@ -1880,6 +1890,8 @@ updategeom(void)
+ for (n = 0, m = mons; m; m = m->next, n++);
+ /* only consider unique geometries as separate screens */
+ unique = ecalloc(nn, sizeof(XineramaScreenInfo));
++ // Sort monitors by x_org so dwm handles screens in left-to-right order
++ qsort(info, nn, sizeof(XineramaScreenInfo), compare_xinerama_x);
+ for (i = 0, j = 0; i < nn; i++)
+ if (isuniquegeom(unique, j, &info[i]))
+ memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
diff --git a/dwm.suckless.org/patches/xinerama-monitors-xorder/index.md b/dwm.suckless.org/patches/xinerama-monitors-xorder/index.md
new file mode 100644
index 00000000..db1262ae
--- /dev/null
+++ b/dwm.suckless.org/patches/xinerama-monitors-xorder/index.md
_AT_@ -0,0 +1,21 @@
+xinerama monitors xorder
+========================
+
+Description
+-----------
+Sorts Xinerama monitors by their `x_org` value (horizontal position),
+ensuring directional monitor movement (e.g. `Mod+Shift+Left/Right`) reflects
+physical screen layout from left to right.
+
+This is helpful in multi-monitor setups where the logical screen order from
+Xinerama doesn't match the physical layout.
+
+Download
+--------
+- [dwm-xinerama-monitors-xorder-6.4.diff](dwm-xinerama-monitors-xorder-6.4.diff)
+
+Author
+------
+* Lyciih <gnehciyil_AT_gmail.com>
+
+
Received on Mon Jul 14 2025 - 18:08:35 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 14 2025 - 18:12:51 CEST