You are not logged in.

#1576 2021-05-24 11:45:17

gginer89
Member
Registered: 2021-03-08
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

Hello,

I've been patching and customizing DWM to my likings but there's one thing I didn't manage to find. I've seen several persons ask it before but never got a working reply. I am looking for a way to focus the last active window. Not the "view" function which opens last used tag, but a way to switch the focus between the two last active windows, no matter in which tag they are. Those two last windows could be in the same tag, it would then switch focus between the two apps inside the same tag, or in different tags and it would swap between the tags giving focus to each app.

Did you see a patch to achieve something like this?

Thank you in advance

Offline

#1577 2021-11-24 07:51:00

Pole_Prode
Member
Registered: 2021-04-27
Posts: 10

Re: DWM Hackers Unite! Share (or request) dwm patches.

Hi, i'm looking for a patch that will make floating window, when it's switched from tiled to floating, centered and resized to become smaller. Thx for help.

Offline

#1578 2021-11-24 17:20:46

sekret
Member
Registered: 2013-07-22
Posts: 248

Re: DWM Hackers Unite! Share (or request) dwm patches.

Pole_Prode wrote:

Hi, i'm looking for a patch that will make floating window, when it's switched from tiled to floating, centered and resized to become smaller. Thx for help.

That's what you are looking for.
https://dwm.suckless.org/patches/save_floats
It resizes the windows to their original size and places them centered. I use it all the time.

Offline

#1579 2021-11-24 17:22:20

sekret
Member
Registered: 2013-07-22
Posts: 248

Re: DWM Hackers Unite! Share (or request) dwm patches.

gginer89 wrote:

Hello,

I've been patching and customizing DWM to my likings but there's one thing I didn't manage to find. I've seen several persons ask it before but never got a working reply. I am looking for a way to focus the last active window. Not the "view" function which opens last used tag, but a way to switch the focus between the two last active windows, no matter in which tag they are. Those two last windows could be in the same tag, it would then switch focus between the two apps inside the same tag, or in different tags and it would swap between the tags giving focus to each app.

Did you see a patch to achieve something like this?

Thank you in advance

I'm very sure I've had such a patch applied a few years ago but cannot remember its name. Have you tried all patches on https://dwm.suckless.org/patches ?

edit: That one? https://dwm.suckless.org/patches/swapfocus

Last edited by sekret (2021-11-24 17:25:21)

Offline

#1580 2021-12-23 12:02:54

Alfodr
Member
Registered: 2021-02-28
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

I have one inconvenience using dwm since I recently started using transparent terminal. The monocle layout is actually displaying windows behind the current one and that is quite distracting.
Is there a way to use monocle layout with multiple transparent windows stacked without background windows being shown?

Offline

#1581 2021-12-23 14:49:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,075
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Alfodr, either use pseudo-transparency rather than real transparency with the added benefit of it using fewer resource (cpu / ram), or edit the monocole layout function to only place the first window in monocle position, and all the others off screen.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#1582 2021-12-24 20:36:32

Alfodr
Member
Registered: 2021-02-28
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

@Trilby I do not know how to make edits in monocle function. I would guess when we are iterating through clients, I would need to somehow set 0 size or something to all but front window (monitor->sel is first maybe?)

Offline

#1583 2021-12-24 20:47:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 27,075
Website

Re: DWM Hackers Unite! Share (or request) dwm patches.

Untested, but this should do it:

--- old/dwm.c
+++ new/dwm.c
@@ -1115,8 +1115,10 @@
 			n++;
 	if (n > 0) /* override layout symbol */
 		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
-	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
-		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+	c = nexttiled(m->clients);
+	resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+	for (; c; c = nexttiled(c->next))
+		XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
 }
 
 void

EDIT: in hindsight, the first client from "nexttiled" may be the first in the stack, but not the focused window.  If that is the case, then the resize would have to be applied to a different client prehaps m->sel ... it's been ages since I messed with dwm code.  Though if there are floating windows, m->sel might be one of them ... So this is probably better:

--- old/dwm.c
+++ new/dwm.c
@@ -1116,7 +1116,8 @@
 	if (n > 0) /* override layout symbol */
 		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
 	for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
-		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+		if (c == m->sel) resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+		else XMoveWindow(dpy, c->win, WIDTH(c) * -2, c->y);
 }
 
 void

Last edited by Trilby (2021-12-24 20:53:45)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Online

#1584 2021-12-24 21:05:24

Alfodr
Member
Registered: 2021-02-28
Posts: 4

Re: DWM Hackers Unite! Share (or request) dwm patches.

First code was hiding all but I was able to cycle between invisible windows and enter text. The second one is looking right but I cannot rotate stack. If I close he first one, next is placed ok

Offline

Board footer

Powered by FluxBB