sites

public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log | Files | Refs

commit 91d5cd5d9d7dce34e10bb0fe2c45034a5b094276
parent e0cd8dd8fa745e682be56774ba2b15bc437a08aa
Author: Muhammed Sahin <s.muhammed.ms@gmail.com>
Date:   Thu, 13 Jan 2022 20:58:49 +0100

added a new patch that allows to add default layouts per monitor

Diffstat:
Adwm.suckless.org/patches/defaultlayoutpermonitor/defaultlayoutpermonitor.diff | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/defaultlayoutpermonitor/index.md | 15+++++++++++++++
2 files changed, 73 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/defaultlayoutpermonitor/defaultlayoutpermonitor.diff b/dwm.suckless.org/patches/defaultlayoutpermonitor/defaultlayoutpermonitor.diff @@ -0,0 +1,58 @@ +diff --git a/config.def.h b/config.def.h +index a2ac963..7c87de8 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -37,6 +37,11 @@ static const int nmaster = 1; /* number of clients in master area */ + static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ + static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ + ++static const int lpm[] = { ++ /* Index of preferred layout], if LENGTH(lpm)<#monitors -> default layout */ ++ 0, 1 ++}; ++ + static const Layout layouts[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ +diff --git a/dwm.c b/dwm.c +index a96f33c..64cec29 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -142,6 +142,7 @@ typedef struct { + } Rule; + + /* function declarations */ ++static void applydefaultlayouts(); + static void applyrules(Client *c); + static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact); + static void arrange(Monitor *m); +@@ -276,6 +277,21 @@ static Window root, wmcheckwin; + struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; }; + + /* function implementations */ ++void ++applydefaultlayouts() ++{ ++ Monitor *m; ++ int i = 0; ++ for (m = mons; m; m = m->next) { ++ if (i < LENGTH(lpm)) { ++ m->lt[0] = &layouts[lpm[i]]; ++ m->lt[1] = &layouts[(lpm[i] + 1)/ % LENGTH(layouts)]; ++ strncpy(m->ltsymbol, layouts[i].symbol, sizeof m->ltsymbol); ++ } ++ i++; ++ } ++} ++ + void + applyrules(Client *c) + { +@@ -1911,6 +1927,7 @@ updategeom(void) + cleanupmon(m); + } + } ++ applydefaultlayouts(); + free(unique); + } else + #endif /* XINERAMA */ diff --git a/dwm.suckless.org/patches/defaultlayoutpermonitor/index.md b/dwm.suckless.org/patches/defaultlayoutpermonitor/index.md @@ -0,0 +1,15 @@ +defaultlayoutpermonitor +================ + +Description +----------- +This patch allows to set a default layout for each monitor. + + +Download +-------- +* [defaultlayoutpermonitor.diff](defaultlayoutpermonitor.diff) + +Authors +------- +* Muhammed Sahin - <m.sahin@tum.de>