mirror of
https://github.com/mintycube/dwm.git
synced 2024-10-22 14:05:45 +02:00
Adding sizehints patch
This commit is contained in:
parent
920c58421b
commit
5e0a9c49f8
@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
|
|
||||||
### Changelog:
|
### Changelog:
|
||||||
|
|
||||||
|
2020-06-15 - Added sizehints patch
|
||||||
|
|
||||||
2020-06-14 - Added RULE macro to replace rules setup making the default config less of an abomination and making it simpler to include new rules based patches
|
2020-06-14 - Added RULE macro to replace rules setup making the default config less of an abomination and making it simpler to include new rules based patches
|
||||||
|
|
||||||
2020-06-11 - Added the pango patch
|
2020-06-11 - Added the pango patch
|
||||||
@ -359,6 +361,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
|
|||||||
- [shiftviewclients](https://github.com/bakkeby/patches/blob/master/dwm/dwm-shiftviewclients-6.2.diff)
|
- [shiftviewclients](https://github.com/bakkeby/patches/blob/master/dwm/dwm-shiftviewclients-6.2.diff)
|
||||||
- variant of the shiftview patch which skips tags that has no clients
|
- variant of the shiftview patch which skips tags that has no clients
|
||||||
|
|
||||||
|
- [sizehints](https://dwm.suckless.org/patches/sizehints/)
|
||||||
|
- makes dwm obey even "soft" sizehints for new clients
|
||||||
|
|
||||||
- [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html)
|
- [sortscreens](https://www.mail-archive.com/hackers@suckless.org/msg09400.html)
|
||||||
- this patch aims to address some inconsistencies when it comes to focusmon, tagmon and similar functionality by explicitly sorting screens left to right (or top to bottom in a vertical layout)
|
- this patch aims to address some inconsistencies when it comes to focusmon, tagmon and similar functionality by explicitly sorting screens left to right (or top to bottom in a vertical layout)
|
||||||
|
|
||||||
|
14
dwm.c
14
dwm.c
@ -3950,7 +3950,11 @@ updatesizehints(Client *c)
|
|||||||
|
|
||||||
if (!XGetWMNormalHints(dpy, c->win, &size, &msize))
|
if (!XGetWMNormalHints(dpy, c->win, &size, &msize))
|
||||||
/* size is uninitialized, ensure that size.flags aren't used */
|
/* size is uninitialized, ensure that size.flags aren't used */
|
||||||
|
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
|
||||||
|
size.flags = 0;
|
||||||
|
#else
|
||||||
size.flags = PSize;
|
size.flags = PSize;
|
||||||
|
#endif // SIZEHINTS_PATCH | SIZEHINTS_RULED_PATCH
|
||||||
if (size.flags & PBaseSize) {
|
if (size.flags & PBaseSize) {
|
||||||
c->basew = size.base_width;
|
c->basew = size.base_width;
|
||||||
c->baseh = size.base_height;
|
c->baseh = size.base_height;
|
||||||
@ -3982,6 +3986,16 @@ updatesizehints(Client *c)
|
|||||||
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
c->maxa = (float)size.max_aspect.x / size.max_aspect.y;
|
||||||
} else
|
} else
|
||||||
c->maxa = c->mina = 0.0;
|
c->maxa = c->mina = 0.0;
|
||||||
|
#if SIZEHINTS_PATCH || SIZEHINTS_RULED_PATCH
|
||||||
|
if (size.flags & PSize) {
|
||||||
|
c->basew = size.base_width;
|
||||||
|
c->baseh = size.base_height;
|
||||||
|
c->isfloating = 1;
|
||||||
|
}
|
||||||
|
#if SIZEHINTS_RULED_PATCH
|
||||||
|
checkfloatingrules(c);
|
||||||
|
#endif // SIZEHINTS_RULED_PATCH
|
||||||
|
#endif // SIZEHINTS_PATCH
|
||||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,9 @@
|
|||||||
#if SHIFTVIEW_CLIENTS_PATCH
|
#if SHIFTVIEW_CLIENTS_PATCH
|
||||||
#include "shiftviewclients.c"
|
#include "shiftviewclients.c"
|
||||||
#endif
|
#endif
|
||||||
|
#if SIZEHINTS_RULED_PATCH
|
||||||
|
#include "sizehints_ruled.c"
|
||||||
|
#endif
|
||||||
#if SORTSCREENS_PATCH
|
#if SORTSCREENS_PATCH
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
#include "sortscreens.c"
|
#include "sortscreens.c"
|
||||||
|
@ -120,6 +120,9 @@
|
|||||||
#if SHIFTVIEW_CLIENTS_PATCH
|
#if SHIFTVIEW_CLIENTS_PATCH
|
||||||
#include "shiftviewclients.h"
|
#include "shiftviewclients.h"
|
||||||
#endif
|
#endif
|
||||||
|
#if SIZEHINTS_RULED_PATCH
|
||||||
|
#include "sizehints_ruled.h"
|
||||||
|
#endif
|
||||||
#if SORTSCREENS_PATCH
|
#if SORTSCREENS_PATCH
|
||||||
#ifdef XINERAMA
|
#ifdef XINERAMA
|
||||||
#include "sortscreens.h"
|
#include "sortscreens.h"
|
||||||
|
24
patch/sizehints_ruled.c
Normal file
24
patch/sizehints_ruled.c
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
void
|
||||||
|
checkfloatingrules(Client *c)
|
||||||
|
{
|
||||||
|
const char *class, *instance;
|
||||||
|
unsigned int i;
|
||||||
|
const Rule *r;
|
||||||
|
XClassHint ch = { NULL, NULL };
|
||||||
|
|
||||||
|
XGetClassHint(dpy, c->win, &ch);
|
||||||
|
class = ch.res_class ? ch.res_class : broken;
|
||||||
|
instance = ch.res_name ? ch.res_name : broken;
|
||||||
|
|
||||||
|
for (i = 0; i < LENGTH(rules); i++) {
|
||||||
|
r = &rules[i];
|
||||||
|
if ((!r->title || strstr(c->name, r->title))
|
||||||
|
&& (!r->class || strstr(class, r->class))
|
||||||
|
&& (!r->instance || strstr(instance, r->instance)))
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
}
|
||||||
|
if (ch.res_class)
|
||||||
|
XFree(ch.res_class);
|
||||||
|
if (ch.res_name)
|
||||||
|
XFree(ch.res_name);
|
||||||
|
}
|
1
patch/sizehints_ruled.h
Normal file
1
patch/sizehints_ruled.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
static void checkfloatingrules(Client *c);
|
@ -500,6 +500,23 @@
|
|||||||
*/
|
*/
|
||||||
#define SHIFTVIEW_CLIENTS_PATCH 0
|
#define SHIFTVIEW_CLIENTS_PATCH 0
|
||||||
|
|
||||||
|
/* This patch makes dwm obey even "soft" sizehints for new clients. Any window
|
||||||
|
* that requests a specific initial size will be floated and set to that size.
|
||||||
|
* Unlike with "fixed size" windows, you are able to resize and/or unfloat these
|
||||||
|
* windows freely - only the initial state is affected.
|
||||||
|
* This version of the patch is honestly of limited utility since there are many
|
||||||
|
* clients that will abuse it.
|
||||||
|
* https://dwm.suckless.org/patches/sizehints/
|
||||||
|
*/
|
||||||
|
#define SIZEHINTS_PATCH 0
|
||||||
|
|
||||||
|
/* This patch makes dwm obey even "soft" sizehints for new clients. This ruled
|
||||||
|
* version is essentially the same patch except it obeys the "isfloating" rule
|
||||||
|
* if it is available in config.h for the given client.
|
||||||
|
* https://dwm.suckless.org/patches/sizehints/
|
||||||
|
*/
|
||||||
|
#define SIZEHINTS_RULED_PATCH 0
|
||||||
|
|
||||||
/* In a multi-head setup monitor 0 is by default the primary screen, with the left and right
|
/* In a multi-head setup monitor 0 is by default the primary screen, with the left and right
|
||||||
* screen being monitor 1 and 2 respectively. This patch sorts screens left to right (or
|
* screen being monitor 1 and 2 respectively. This patch sorts screens left to right (or
|
||||||
* top to bottom in a vertical layout) which aims to address some inconsistencies when it
|
* top to bottom in a vertical layout) which aims to address some inconsistencies when it
|
||||||
|
Loading…
Reference in New Issue
Block a user