diff --git a/README.md b/README.md index 95f6203..0f631dd 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: -2020-08-10 - Added cool autostart and insets patches +2020-08-10 - Added cool autostart, insets and steam patches 2020-08-02 - Added reorganizetags patch @@ -446,6 +446,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [statuspadding](https://dwm.suckless.org/patches/statuspadding/) - adds configuration options for horizontal and vertical padding in the status bar + - [steam](https://github.com/bakkeby/patches/wiki/steam) + - a minor patch that works around the issue of floating Steam windows jumping around the screen when they receive focus + - [sticky](https://dwm.suckless.org/patches/sticky/) - adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags diff --git a/dwm.c b/dwm.c index 09261a4..014ade0 100644 --- a/dwm.c +++ b/dwm.c @@ -294,6 +294,9 @@ struct Client { int isterminal, noswallow; pid_t pid; #endif // SWALLOW_PATCH + #if STEAM_PATCH + int issteam; + #endif // STEAM_PATCH #if STICKY_PATCH int issticky; #endif // STICKY_PATCH @@ -685,6 +688,11 @@ applyrules(Client *c) gettextprop(c->win, wmatom[WMWindowRole], role, sizeof(role)); #endif // WINDOWROLERULE_PATCH + #if STEAM_PATCH + if (strstr(class, "Steam") || strstr(class, "steam_app_")) + c->issteam = 1; + #endif // STEAM_PATCH + for (i = 0; i < LENGTH(rules); i++) { r = &rules[i]; if ((!r->title || strstr(c->name, r->title)) @@ -1198,6 +1206,18 @@ configurerequest(XEvent *e) c->bw = ev->border_width; else if (c->isfloating || !selmon->lt[selmon->sellt]->arrange) { m = c->mon; + #if STEAM_PATCH + if (!c->issteam) { + if (ev->value_mask & CWX) { + c->oldx = c->x; + c->x = m->mx + ev->x; + } + if (ev->value_mask & CWY) { + c->oldy = c->y; + c->y = m->my + ev->y; + } + } + #else if (ev->value_mask & CWX) { c->oldx = c->x; c->x = m->mx + ev->x; @@ -1206,6 +1226,7 @@ configurerequest(XEvent *e) c->oldy = c->y; c->y = m->my + ev->y; } + #endif // STEAM_PATCH if (ev->value_mask & CWWidth) { c->oldw = c->w; c->w = ev->width; diff --git a/patches.def.h b/patches.def.h index 9ba99f7..c595516 100644 --- a/patches.def.h +++ b/patches.def.h @@ -717,6 +717,17 @@ */ #define STACKER_PATCH 0 +/* Steam, and steam windows (games), trigger a ConfigureNotify request every time the window + * gets focus. More so, the configure event passed along from Steam tends to have the wrong + * x and y co-ordinates which can make the window, if floating, jump around the screen. + * + * This patch works around this age-old issue by ignoring the x and y co-ordinates for + * ConfigureNotify requests relating to Steam windows. + * + * https://github.com/bakkeby/patches/wiki/steam + */ +#define STEAM_PATCH 0 + /* Adds toggleable keyboard shortcut to make a client 'sticky', i.e. visible on all tags. * https://dwm.suckless.org/patches/sticky/ */