You are not logged in.

#1126 2013-03-07 05:25:12

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

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

Unia wrote:

Otherwise, you can look at my GitHub. I still have my XFT and systray patches up there for DWM 6.0.

Thanks again. Your patches worked, when the others failed.

One thing I've noticed is that the up/down arrow characters that I used with pango no longer work with the Xft patches; same font as before (arial), but they appear as blocks now. Oh well, I'm pretty easy to please :)


thayer williams ~ cinderwick.ca

Offline

#1127 2013-03-07 08:20:02

Army
Member
Registered: 2007-12-07
Posts: 1,784

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

ivoarch wrote:

Yes you are right Army,
clicking on the tags doesn't work right.

I found this http://lists.suckless.org/dev/1208/12107.html

Ah right, I remember this post, but back then I thought I already have this, so I don't need it. But this one looks a bit more simple than what I posted.

Offline

#1128 2013-03-07 09:24:26

andmars
Member
Registered: 2012-03-13
Posts: 362

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

I'm wondering: is ther a single-window-no-border patch that also works with the bstack patch?

Offline

#1129 2013-03-07 10:05:35

Army
Member
Registered: 2007-12-07
Posts: 1,784

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

Yes

diff -paur dwm.old/dwm.c dwm.new/dwm.c
--- dwm.old/dwm.c	2012-12-14 21:13:02.818037177 +0100
+++ dwm.new/dwm.c	2012-12-14 21:13:07.648082669 +0100
@@ -1360,7 +1360,13 @@ resizeclient(Client *c, int x, int y, in
 	c->oldy = c->y; c->y = wc.y = y;
 	c->oldw = c->w; c->w = wc.width = w;
 	c->oldh = c->h; c->h = wc.height = h;
-	wc.border_width = c->bw;
+	if(selmon->wx == c->x && selmon->wy == c->y && selmon->ww - 2 * c->bw == c->w && selmon->wh - 2 * c->bw == c->h && !c->isfloating && !c->isfullscreen) {
+		wc.border_width = 0;
+		c->w = wc.width += c->bw * 2;
+		c->h = wc.height += c->bw * 2;
+	}
+	else
+		wc.border_width = c->bw;
 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 	configure(c);
 	XSync(dpy, False);

That one works for every layout.

Offline

#1130 2013-03-07 14:21:40

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

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

andmars wrote:

I'm wondering: is ther a single-window-no-border patch that also works with the bstack patch?

I've been using both without any problems for as long as I've been using DWM.  Check your patching order.  Army's solution may be better though, if you use many layouts and pertag (maybe, I don't use pertag myself).

Offline

#1131 2013-03-08 17:46:48

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

Here's a quick one I just came up with: when there is only one client visible (in Tile/Bstack layout), use Monocle instead. When more clients are spawned, it automatically switches back to the layout it was set to (e.g. Tile=Monocle -> Tile). It's diffed against a patched dwm.c, but as it's really trivial I thought I could share it anyway:

--- src/dwm-6.0/dwm.c	2013-03-08 18:43:08.565408608 +0100
+++ b/dwm-6.0/dwm.c	2013-03-08 18:42:28.615409280 +0100
@@ -1775,21 +1775,25 @@
 	if(n == 0)
 		return;
 
-	if(n > m->nmasters[m->curtag])
-		mw = m->nmasters[m->curtag] ? m->ww * m->mfacts[m->curtag] : 0;
-	else
-		mw = m->ww;
-	for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
-		if(i < m->nmasters[m->curtag]) {
-			h = (m->wh - my) / (MIN(n, m->nmasters[m->curtag]) - i);
-			resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
-			my += HEIGHT(c);
-		}
-		else {
-			h = (m->wh - ty) / (n - i);
-			resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
-			ty += HEIGHT(c);
-		}
+	if(n == 1) {
+		monocle(selmon);
+	} else {
+		if(n > m->nmasters[m->curtag])
+			mw = m->nmasters[m->curtag] ? m->ww * m->mfacts[m->curtag] : 0;
+		else
+			mw = m->ww;
+		for(i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+			if(i < m->nmasters[m->curtag]) {
+				h = (m->wh - my) / (MIN(n, m->nmasters[m->curtag]) - i);
+				resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), False);
+				my += HEIGHT(c);
+			}
+			else {
+				h = (m->wh - ty) / (n - i);
+				resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
+				ty += HEIGHT(c);
+			}
+	}
 }
 
 void
@@ -2225,22 +2229,25 @@
 	for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
 	if(n == 0)
 		return;
-
-	if(n > m->nmasters[m->curtag])
-		mh = m->nmasters[m->curtag] ? m->wh * m->mfacts[m->curtag] : 0;
-	else
-		mh = m->wh;
-	for(i = mx = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
-		if(i < m->nmasters[m->curtag]) {
-			w = (m->ww - mx) / (MIN(n, m->nmasters[m->curtag]) - i);
-			resize(c, m->wx + mx, m->wy, w - (2*c->bw), mh - (2*c->bw), False);
-			mx += WIDTH(c);
-		}
-		else {
-			w = (m->ww - tx) / (n - i);
-			resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - (2*c->bw), False);
-			tx += WIDTH(c);
-		}
+	if(n == 1) {
+		monocle(selmon);
+	} else {
+		if(n > m->nmasters[m->curtag])
+			mh = m->nmasters[m->curtag] ? m->wh * m->mfacts[m->curtag] : 0;
+		else
+			mh = m->wh;
+		for(i = mx = tx = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
+			if(i < m->nmasters[m->curtag]) {
+				w = (m->ww - mx) / (MIN(n, m->nmasters[m->curtag]) - i);
+				resize(c, m->wx + mx, m->wy, w - (2*c->bw), mh - (2*c->bw), False);
+				mx += WIDTH(c);
+			}
+			else {
+				w = (m->ww - tx) / (n - i);
+				resize(c, m->wx + tx, m->wy + mh, w - (2*c->bw), m->wh - mh - (2*c->bw), False);
+				tx += WIDTH(c);
+			}
+	}
 }
 
 int

If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1132 2013-03-10 04:25:52

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

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

Army wrote:

Yes

diff -paur dwm.old/dwm.c dwm.new/dwm.c
--- dwm.old/dwm.c	2012-12-14 21:13:02.818037177 +0100
+++ dwm.new/dwm.c	2012-12-14 21:13:07.648082669 +0100
@@ -1360,7 +1360,13 @@ resizeclient(Client *c, int x, int y, in
 	c->oldy = c->y; c->y = wc.y = y;
 	c->oldw = c->w; c->w = wc.width = w;
 	c->oldh = c->h; c->h = wc.height = h;
-	wc.border_width = c->bw;
+	if(selmon->wx == c->x && selmon->wy == c->y && selmon->ww - 2 * c->bw == c->w && selmon->wh - 2 * c->bw == c->h && !c->isfloating && !c->isfullscreen) {
+		wc.border_width = 0;
+		c->w = wc.width += c->bw * 2;
+		c->h = wc.height += c->bw * 2;
+	}
+	else
+		wc.border_width = c->bw;
 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 	configure(c);
 	XSync(dpy, False);

That one works for every layout.

This never removes the border for me. It usually fails the condition check, no idea why, but even when it correctly detects a lonely window, it doesn't remove the border at all. Still derping around with fprintf, trying to find the problem...


Fear me! I have root! Sometimes...

Offline

#1133 2013-03-10 10:30:41

Army
Member
Registered: 2007-12-07
Posts: 1,784

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

Strange ... but well, there are other patches around, so no big harm wink

Offline

#1134 2013-03-10 16:54:46

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

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

The other ones I found make dwm segfault on me xD


Fear me! I have root! Sometimes...

Offline

#1135 2013-03-10 17:38:02

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

What other patches are you using? Maybe they conflict with one another


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1136 2013-03-10 18:14:25

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

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

I can't see anything that would conflict with how borders are configured... But please check out my dwm config at https://github.com/mkaito/dwm


Fear me! I have root! Sometimes...

Offline

#1137 2013-03-11 21:05:10

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

Hello everyone,

I have two things I need help with; they're the only things left I want to change that I can't do alone, I think.

1. I want to change the multimonitor handling of DWM: I don't want a double tagset, nor a singular (as mkaito uses); I want to have my second monitor have one single tag I can send clients to from my main monitor, which has all the standard tags. Kind of how GNOME Shell handles multi monitors.
2. I want to change the borders on clients. Having them like MonsterWM has them (no double borders between two clients, but overlapping) would be a start. Preferable, I would have that and no borders on screen edges (left/bottom/right)

I'm not familiar with either of these things in DWM, so if anyone could give me a pointer on where to look that'd be great! I'm going to take a look at the singular patchset right now to see if that can be altered.

Thanks!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1138 2013-03-12 13:14:22

synorgy
Member
From: $HOME
Registered: 2005-07-11
Posts: 272
Website

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

Unia wrote:

I don't want a double tagset, nor a singular (as mkaito uses); I want to have my second monitor have one single tag I can send clients to from my main monitor, which has all the standard tags. Kind of how GNOME Shell handles multi monitors.

I'm not sure how feasible this is. mkaito's single tagset approach changes a LOT of underlying behavior, and this sort of request changes a lot more. What WOULD be feasible, I believe, would be changing the bar drawing and keybind code to SHOW only one tag on the second monitor and to disable the switching of tags if the second monitor has focus. Would that be a reasonable enough change? I'm not sure I'll have time to look at this in the near future, but the approach seems to fulfill your request and not to require too many changes.

Unia wrote:

I want to change the borders on clients. Having them like MonsterWM has them (no double borders between two clients, but overlapping) would be a start. Preferable, I would have that and no borders on screen edges (left/bottom/right)

This would be a bit of an undertaking as well, though it wouldn't be as large a request as above. Mostly this would require offsetting window placement and width by some combination of border width. The code itself would be simple, but modifying the source in every possible place would be time consuming. I would start by looking at monocle() and then at tile(). You would also need to ensure that the active window always gets raised to the top (so that the active border for that window is not obscured by the overlapping borders), which is something that DWM doesn't currently handle (though this is pretty simple. Check out this for a nudge in the right direction)


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity." (Dennis Ritchie)

Offline

#1139 2013-03-12 15:34:55

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

synorgy wrote:

I'm not sure how feasible this is. mkaito's single tagset approach changes a LOT of underlying behavior, and this sort of request changes a lot more. What WOULD be feasible, I believe, would be changing the bar drawing and keybind code to SHOW only one tag on the second monitor and to disable the switching of tags if the second monitor has focus. Would that be a reasonable enough change? I'm not sure I'll have time to look at this in the near future, but the approach seems to fulfill your request and not to require too many changes.

I thought it'd actually require less changes than the single tagset patch. I'm not sure how the multimonitor thing works in DWM, but can't we do it like this:
1. Create the main monitor, which is the laptop screen. (already implemented)
2. If more monitors get attached (also already implemented), create a new tag solely on this monitor. (not implemented, because as we know currently it creates a whole new tagset).

synorgy wrote:

This would be a bit of an undertaking as well, though it wouldn't be as large a request as above. Mostly this would require offsetting window placement and width by some combination of border width. The code itself would be simple, but modifying the source in every possible place would be time consuming. I would start by looking at monocle() and then at tile(). You would also need to ensure that the active window always gets raised to the top (so that the active border for that window is not obscured by the overlapping borders), which is something that DWM doesn't currently handle (though this is pretty simple. Check out this for a nudge in the right direction)

I had a go at this last night and I could get the double borders between the master client and the stack to dissapear. However, the stack's border simply overlapped the master client's one as you said. I didn't know about XRaiseWindow so will see if that can help solve this. For monocle(), I have already done this: I keep the border at the top and the others are simply moved "off the screen" (so in a multimonitor setup, you will see them on the second monitor)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1140 2013-03-12 22:59:05

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

Oke I got a bit further with the borders: now all borders on the screen edges are removed (left/bottom/right; they are simply placed off-screen) and the double borders between the clients are gone. I do still have the overlapping border issue, so for example when master has focus and we switch to the stack, you will see master's unfocused border because it overlaps the stack's focused border. I did find out however, that once I give the stack focus with MODKEY+mouseclick, it gets moved to the top so you see the correct border.

tl;dr when I click (with MODKEY) the client to give focus the borders work correctly; when I only move my mouse into the client (and it gets focus) the border does not work correctly.

EDIT: borders do work as they should when you navigate the clients with the keyboard. So, actually, it's just the focusfollowmouse without click that's not working properly. Does anybody know how to fix that?

Last edited by Unia (2013-03-13 00:42:32)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1141 2013-03-13 00:42:17

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

All fixed! It took one call to XRaiseWindow inside focus(), thanks for the pointer on that one synorgy! You can find the complete patch on my GitHub!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1142 2013-03-13 15:50:21

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

I found out that when one has a floating client and changes focus to a tiled client, the tiled client will be raised and overlap the floating one. I'm going to look into this, but again, if someone knows a (possible) fix before I find it it'd be appreciated!

Last edited by Unia (2013-03-13 15:50:35)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1143 2013-03-13 17:30:23

synorgy
Member
From: $HOME
Registered: 2005-07-11
Posts: 272
Website

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

Glad you managed to figure the border issue out, Unia.

With regard to a separate tagset on a second monitor (with a different definition than the first), you might be able to get away with using a second tag 'struct' (quotes because I'm not sure that's how it's handled) and applying that struct to all monitors after the first one. I might find some time this coming weekend to look into this more. I'd be interested in seeing if I couldn't get a single tagset working with less intrusive changes than mkaito's solution, so I should be looking into this before long anyway.


"Unix is basically a simple operating system, but you have to be a genius to understand the simplicity." (Dennis Ritchie)

Offline

#1144 2013-03-13 17:50:15

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

synorgy wrote:

With regard to a separate tagset on a second monitor (with a different definition than the first), you might be able to get away with using a second tag 'struct' (quotes because I'm not sure that's how it's handled) and applying that struct to all monitors after the first one. I might find some time this coming weekend to look into this more. I'd be interested in seeing if I couldn't get a single tagset working with less intrusive changes than mkaito's solution, so I should be looking into this before long anyway.

Sorry if my initial explanation wasn't that clear big_smile I look forward to what you come up with!


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1145 2013-03-15 16:34:28

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

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

Would anyone know how to handle tagging of wine virtual desktops via their name attribute? It seems wine delays setting it, and tagging is done before it happens. Bad behavior on wine's part, alright, but I'm looking at different ways to handle it in dwm. Ideas?


Fear me! I have root! Sometimes...

Offline

#1146 2013-03-16 22:32:19

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

Does anyone know how to detect if a client is on top in the stack? I'm modifying push.c so it only moves window in the stack (to move windows to master, we have the zoom() function already).

I succesfully managed to do that, but now when I push a client up that is on top it will "loop" through all the clients in the stack and place it on the bottom. I'd like to prevent this and not move the window, so I need to detect if the window is on top of the stack. Here's my code so far (would also appreciate if someone could check this and see if I approached this correctly):

static Client *
prevtiled(Client *c) {
    Client *p, *r;

    for(p = selmon->clients, r = NULL; p && p != c; p = p->next)
        if(!p->isfloating && ISVISIBLE(p))
            r = p;
    return r;
}

static void
pushup(const Arg *arg) {
    Client *sel = selmon->sel, *c;

    if(!sel || sel->isfloating)
        return;
    if((c = prevtiled(sel))) {
        /* attach before c */
        detach(sel);
        if(c == nexttiled(selmon->clients))
            sel->next = NULL;
        else
            sel->next = c;
        for(c = selmon->clients; c->next != sel->next; c = c->next);
            c->next = sel;
    }
    focus(sel);
    arrange(selmon);
}

static void
pushdown(const Arg *arg) {
    Client *sel = selmon->sel, *c;

    if(!sel || sel->isfloating)
        return;
    if((c = nexttiled(sel->next))) {
        /* attach after c */
        detach(sel);
        sel->next = c->next;
        c->next = sel;
    }
    focus(sel);
    arrange(selmon);
}

Last edited by Unia (2013-03-16 22:33:12)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#1147 2013-03-18 01:04:27

mkaito
Member
From: Spain
Registered: 2010-06-12
Posts: 126
Website

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

mkaito wrote:
Army wrote:

Yes

diff -paur dwm.old/dwm.c dwm.new/dwm.c
--- dwm.old/dwm.c	2012-12-14 21:13:02.818037177 +0100
+++ dwm.new/dwm.c	2012-12-14 21:13:07.648082669 +0100
@@ -1360,7 +1360,13 @@ resizeclient(Client *c, int x, int y, in
 	c->oldy = c->y; c->y = wc.y = y;
 	c->oldw = c->w; c->w = wc.width = w;
 	c->oldh = c->h; c->h = wc.height = h;
-	wc.border_width = c->bw;
+	if(selmon->wx == c->x && selmon->wy == c->y && selmon->ww - 2 * c->bw == c->w && selmon->wh - 2 * c->bw == c->h && !c->isfloating && !c->isfullscreen) {
+		wc.border_width = 0;
+		c->w = wc.width += c->bw * 2;
+		c->h = wc.height += c->bw * 2;
+	}
+	else
+		wc.border_width = c->bw;
 	XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
 	configure(c);
 	XSync(dpy, False);

That one works for every layout.

This never removes the border for me. It usually fails the condition check, no idea why, but even when it correctly detects a lonely window, it doesn't remove the border at all. Still derping around with fprintf, trying to find the problem...

Found the problem. I was sticking it in manage() instead of resizeclient(). The woes of trying to patch a heavily patched dwm.c...

EDIT: It correctly removes the border when a window is displayed alone, but restores it when I view a tag on another monitor. Strange as hell...

Last edited by mkaito (2013-03-18 03:25:16)


Fear me! I have root! Sometimes...

Offline

#1148 2013-03-18 09:45:46

Army
Member
Registered: 2007-12-07
Posts: 1,784

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

mkaito wrote:

It correctly removes the border when a window is displayed alone, but restores it when I view a tag on another monitor. Strange as hell...

Do you mean, that the borders are there, if you e.g. move a client to an empty tag on another monitor? Because in that case the border reappears too on my machine. I hardly move windows, so I never looked into it..

Offline

#1149 2013-03-18 10:14:32

illusionist
Member
From: localhost
Registered: 2012-04-03
Posts: 498

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

Unia wrote:

Does anyone know how to detect if a client is on top in the stack?

You may use _NET_CLIENT_LIST atom for a query. There are few other functions you can try like XGetWindowProperty() and XFetchName(). DWM has some functions that may be useful, take a look at gestate() and getatomprop(). See here for some EWMH reference .

Last edited by illusionist (2013-03-18 10:16:58)


  Never argue with stupid people,They will drag you down to their level and then beat you with experience.--Mark Twain
@github

Offline

#1150 2013-03-18 15:52:48

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

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

illusionist wrote:
Unia wrote:

Does anyone know how to detect if a client is on top in the stack?

You may use _NET_CLIENT_LIST atom for a query. There are few other functions you can try like XGetWindowProperty() and XFetchName(). DWM has some functions that may be useful, take a look at gestate() and getatomprop(). See here for some EWMH reference .

I'm not sure that's what I need. The stack is only something DWM is aware of, AFAIK. Thanks though.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB