diff options
| author | bakkeby <[email protected]> | 2020-07-04 21:40:29 +0200 |
|---|---|---|
| committer | bakkeby <[email protected]> | 2020-07-04 21:40:29 +0200 |
| commit | 9fcb63164da434a44d118d8c10e2c4eb4c2b969b (patch) | |
| tree | 9c5e3b1cf4b5648398e90d64fab09b5b3a5c36ca | |
| parent | 8f06f9a2d54046c628b4e1f3faa5590c6616cb12 (diff) | |
| download | dwm-flexipatch-9fcb63164da434a44d118d8c10e2c4eb4c2b969b.tar.gz dwm-flexipatch-9fcb63164da434a44d118d8c10e2c4eb4c2b969b.zip | |
center patch: adding options to center transient windows
| -rw-r--r-- | dwm.c | 7 | ||||
| -rw-r--r-- | patches.def.h | 17 |
2 files changed, 24 insertions, 0 deletions
@@ -2318,6 +2318,13 @@ manage(Window w, XWindowAttributes *wa) c->bw = borderpx; #endif // SETBORDERPX_PATCH #endif // FLOATPOS_PATCH + #if CENTER_TRANSIENT_WINDOWS_BY_PARENT_PATCH + c->x = t->x + WIDTH(t) / 2 - WIDTH(c) / 2; + c->y = t->y + HEIGHT(t) / 2 - HEIGHT(c) / 2; + #elif CENTER_TRANSIENT_WINDOWS_PATCH + c->x = c->mon->wx + (c->mon->ww - WIDTH(c)) / 2; + c->y = c->mon->wy + (c->mon->wh - HEIGHT(c)) / 2; + #endif // CENTER_TRANSIENT_WINDOWS_PATCH | CENTER_TRANSIENT_WINDOWS_BY_PARENT_PATCH } else { c->mon = selmon; #if FLOATPOS_PATCH diff --git a/patches.def.h b/patches.def.h index b778a7a..81dcc7c 100644 --- a/patches.def.h +++ b/patches.def.h @@ -103,6 +103,23 @@ */ #define CENTER_PATCH 0 +/* A transient window is one that is meant to be short lived and is usually raised by a + * parent window. Such windows are typically dialog boxes and the like. + * It should be noted that in dwm transient windows are not subject to normal client rules + * and they are always floating by default. + * This patch centers transient windows on the screen like the center patch does. Note that + * the 6.2 center patch piggy-backed on the updatewindowtype function to ensure that all + * dialog boxes were centered, transient or not. This function was removed in relation to + * adding wintype as a client rule filter, hence this no longer works out of the box. This + * patch restores previous behaviour with the center patch. + */ +#define CENTER_TRANSIENT_WINDOWS_PATCH 0 + +/* As above, except that the transient window is centered within the position of the parent + * window, rather than at the center of the screen. This takes precedence over the above patch. + */ +#define CENTER_TRANSIENT_WINDOWS_BY_PARENT_PATCH 0 + /* This patch centers the WM_NAME of the currently selected window on the status bar. * Both fancybar and awesomebar patches take precedence over this patch. * https://dwm.suckless.org/patches/centeredwindowname/ |
