You are not logged in.

#801 2012-07-31 05:07:31

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641
Website

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

centred-floating it's for new opened apps, and centerwindow is for already opened apps. the idea it's taken from monsterwm. smile

Offline

#802 2012-07-31 05:42:43

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

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

@DrKillPatient: Sorry, I don't actually use the patch myself (I like the default behavior); I'm actually pretty new to DWM, also.

Offline

#803 2012-07-31 19:53:37

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

I just got back from holiday and after getting my system all up-to-date, I started playing with DWM again. Now I'm trying the Pango patch cause I've heard you can get better results with this than with XFT.

I succesfully applied all my patches etc and to match dmenu, I took Cloudef's dmenu-pango from AUR. There's, of course, one issue: font outlining. On DWM, the words are placed a bit too high in the bar. In Cloudef's dmenu-pango, the outlining is fine. I took a look at the patches but can't figure out what line does it. Could you help me to get the outline of the words correctly in DWM?
Here's the dwm-pango patch: https://gist.github.com/3219965
And here's Cloudef's dmenu-pango patch: https://gist.github.com/3219964

Thanks in advance!

EDIT: Nevermind, I seem to have found it! Will now remove the gists, maybe Cloudef ain't so happy with me uploading his patch someplace else tongue

Last edited by Unia (2012-07-31 19:58:57)


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

#804 2012-08-02 01:50:29

Crunch
Member
From: -+-
Registered: 2011-02-17
Posts: 56

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

Anyone ever thought about adding a border around the bar? * random thought *


Registered Linux user #536591.

Offline

#805 2012-08-02 11:58:12

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,758
Website

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

I have no desire for that Crunch, but it would only require a single line addition of XDrawRectangle after the rest of the bard drawing.


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#806 2012-08-08 01:48:59

KoFish
Member
Registered: 2009-10-27
Posts: 7

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

Hey, just wanted to post my patch here too:

The current functionalities are:
* expand - adds keybindings to toggle maximize in all four directions
for a floating window.
* exresize - adds keybindings to incrementally resize a floating
window around it's center. If the window is within snap distance of
monitor border or center it will resize around that point otherwise it
will resize around the window center. If the window is expanded the
expand is toggled off.
* explace - adds keybindings to place floating windows at monitor
borders or center.

It can be found on the mailinglist: http://lists.suckless.org/dev/1207/11992.html

Offline

#807 2012-08-10 11:35:33

Ypnose
Member
From: Jailed in the shell
Registered: 2011-04-21
Posts: 353
Website

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

Hi,
Do you know how to change space under font in dwm bar? It seems we have 1px above and below the font.
I know we talked about it but I can't find the related post.
Thanks


Github -- My terminal font Envypn

Offline

#808 2012-08-10 12:43:45

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

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

In dwm.c

bh = dc.h = dc.font.height + 2;

bh stands for bar height.

Offline

#809 2012-08-14 22:39:17

melw
Member
Registered: 2011-04-09
Posts: 95

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

Not really sure this is the right place for this problem, but i'm giving it a try.

I'm new to dwm, havn't been using it for long. The problem i got is simple, really. I want gaps around all "tiles", which isn't the case atm. Have a look the this screenshot and you'll know what i meen.

Anyone knows a solution for this "problem"?


I know I'm paranoid, but am I paranoid enought....

Offline

#810 2012-08-14 22:40:28

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,758
Website

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

melw: http://dwm.suckless.org/patches/uselessgap

edit: sorry, didn't pay close enough attention.  I've never used that patch - I assumed it put gaps all around.  I assumed, and made an a... out of me.

Last edited by Trilby (2012-08-15 00:11:24)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#811 2012-08-15 00:08:40

melw
Member
Registered: 2011-04-09
Posts: 95

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

Thats would be the one I'm using.


I know I'm paranoid, but am I paranoid enought....

Offline

#812 2012-08-15 00:10:47

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,074
Website

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

There are variants in this thread that sort out the geometry issue...


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

#813 2012-08-15 01:11:55

melw
Member
Registered: 2011-04-09
Posts: 95

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

After alot for searching i found a solution. Rather easy one, only 2 changes in dwm.c solved my problem.


I know I'm paranoid, but am I paranoid enought....

Offline

#814 2012-08-18 16:52:58

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

Hey all,

I'm trying to get rid of drawsquare() and using another color to specify occupied windows, as Crunchy did here: https://bbs.archlinux.org/viewtopic.php … 6#p1104076

When building, it builds, but I get several warnings and when I restart DWM, it won't work. These are the error messages:

dwm.c: In function ‘drawbar’:
dwm.c:848:68: warning: pointer/integer type mismatch in conditional expression [enabled by default]
dwm.c:848:32: warning: pointer type mismatch in conditional expression [enabled by default]
dwm.c:849:61: warning: left-hand operand of comma expression has no effect [-Wunused-value]
dwm.c:849:75: warning: left-hand operand of comma expression has no effect [-Wunused-value]

Those two lines are these:

col2 = urg & 1 << i ? dc.urg : m->tagset[m->seltags] & 1 << i ? 1:occupiedCol;
    if(m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i, col) {

Can you help me fix this? For reference, here's the complete patch I'm using:
https://gist.github.com/3388329


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

#815 2012-08-18 17:07:36

kuraku
Member
From: planet Earth
Registered: 2012-01-03
Posts: 199

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

Ypnose wrote:

Hi,
Do you know how to change space under font in dwm bar? It seems we have 1px above and below the font.
I know we talked about it but I can't find the related post.
Thanks

Check it out: https://github.com/djura-san/dotfiles-a … ding.patch

Besides this patch, i also created one with border that could change colors but i lost it. Try experimenting a little.

p.s. This is what Army said but in "fancy" way yikes)

Last edited by kuraku (2012-08-18 17:11:03)

Offline

#816 2012-08-18 17:11:38

graph
Member
Registered: 2010-12-21
Posts: 105

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

Would it be possible to list/cycle through open programs in DWM? As in floating-WM Alt+Tab-behaviour? (not that key combination, though).

I would very much prefer if there was a way to do it by using dmenu.

wmctrl reports "Cannot get client list properties" (It appears that DWM isn't supporting the EWMH/NetWM specification).

Last edited by graph (2012-08-18 17:20:27)

Offline

#817 2012-08-20 16:27:26

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

I've worked some more on the occupied color patch and I've now narrowed it down to just two error messages:

dwm.c: In function ‘drawbar’:
dwm.c:848:67: error: expected expression before ‘=’ token
dwm.c:849:63: warning: left-hand operand of comma expression has no effect [-Wunused-value]

Those two lines are the following:

col2 = urg & 1 << i ? dc.urg : m->tagset[m->seltags] & 1 << i ? OCCUPIEDCOL;
if( m == selmon && selmon->sel && selmon->sel->tags & 1 << i, occ & 1 << i ) {

And lastly, here's the up-to-date patch:
https://gist.github.com/3388329

Who can help me fix these last two issues? I really don't know how to do this myself


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

#818 2012-08-20 17:09:02

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,758
Website

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

Unia, I didn't read that close enough to get the intended logic of it - but I can say there is a much simpler way:

    for(i = 0; i < LENGTH(tags); i++) {
        dc.w = TEXTW(tags[i]);
        col = dc.colors[ (m->tagset[m->seltags] & 1 << i) ?
            4 : (urg & 1 << i ? 2:(occ & 1 << i ? 1:0)) ];
        drawtext(tags[i], col, True);
        dc.x += dc.w;
    }

Edit: now I get it.  You create variables for a "normal" color, and yet another color for occied tags.  Then you have another conditional block to decide which to use.  I just stuck with the one variable and put the conditional logic in a ternary operator nested in the one that was already there.

Edit: in yours I suspect the error is from your ternary operator only getting two operands.  Also, it may just be a style issue but parentheses help readability when these are nested.  In some cases they may be necessary for proper parsing ... I'm not even sure how the compiler priorities these, I just always use parentheses to make my intent explicit.

Also note that I just 'hardcoded' in the color numbers 0,1,2, and 4 (for normal, occupied, urgent, selected).  These could be switched to constants if you like.

Last edited by Trilby (2012-08-20 17:23:53)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#819 2012-08-20 17:26:23

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

^ Thanks. I'll have to read your post again to fully understand what you're saying though. For now I get you've come up with a better way that probably works tongue

The only reason I did it like I did, is because Crunchy shared his patch that does it this way at page 31 of this topic. I will now play around with what you suggested and see how that works out!

EDIT: Yours seems to be working with statuscolors patch. I don't have that, sadly, so I'll have to figure out how to adapt it to my setup (I use urgentcolor only). Certainly looks alot cleaner, tho!
EDIT2: And how would I 'convert' your hardcoded colors to the normal color system DWM uses? Gonna play with this... wink

Last edited by Unia (2012-08-20 17:36:45)


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

#820 2012-08-20 18:44:35

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,758
Website

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

Oops, yes, I neglected to mention that this is with the statuscolors patch already applied.

I've always applied the statuscolors patch right away, so I'm not even that familiar with the "vanilla" dwm code.  But judging from your (or crunchy's) version I suspect that one line would be changed to something like this:

    col = (m->tagset[m->seltags] & 1 << i) ?
            dc.sel : (urg & 1 << i ? dc.urg :(occ & 1 << i ? dc.occ : dc.norm));

Assuming you add a dc.occ for the occupied color.  Or just replace dc.occ with OCCUPIEDCOLOR as appropriate.

edit: this could be read as:
Set col equal to ... if tag is selected dc.sel else ( if tag is urgent  dc.urg else (if tag is occupied dc.occ else dc.norm) )

Last edited by Trilby (2012-08-20 18:47:21)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#821 2012-08-20 19:40:12

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

Oke, I got it! Thanks for your help Trilby, and with the last explanation as to how I can actually read it; that helps in some understanding!

So, I now have another color I can set in config.h that colors the tags that are occupied. Also, I have removed the entire drawsquare() function, as I won't need this anymore. Here's a screenshot:
tZjY4cg

And the patch (it's currently meant to be used with XFT patch, but I'm sure you guys can edit this wink):

--- dwm.c.orig.occ.tril	2012-08-20 19:30:40.883200412 +0200
+++ src/dwm-6.0/dwm.c	2012-08-20 21:34:25.729988929 +0200
@@ -122,6 +122,7 @@
 	XftColor norm[ColLast];
 	XftColor sel[ColLast];
 	XftColor urg[ColLast];
+	XftColor occ[ColLast];
    Drawable drawable;
 	GC gc;
 	struct {
@@ -216,7 +217,6 @@
 static Monitor *dirtomon(int dir);
 static void drawbar(Monitor *m);
 static void drawbars(void);
-static void drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]);
 static void drawtext(const char *text, XftColor col[ColLast], Bool invert);
 static void enternotify(XEvent *e);
 static void expose(XEvent *e);
@@ -843,12 +843,14 @@
 			urg |= c->tags;
 	}
 	dc.x = 0;
+ 
+
+
 	for(i = 0; i < LENGTH(tags); i++) {
         dc.w = TEXTW(tags[i].name);
-        col = urg & 1 << i ? dc.urg : m->tagset[m->seltags] & 1 << i ? dc.sel : dc.norm;
+		col = (m->tagset[m->seltags] & 1 << i) ?
+            dc.sel : (urg & 1 << i ? dc.urg :(occ & 1 << i ? dc.occ : dc.norm));
 		drawtext(tags[i].name, col, urg & 1 << i);
-		drawsquare(m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
-		           occ & 1 << i, urg & 1 << i, col);
 		dc.x += dc.w;
 	}
 	dc.w = blw = TEXTW(m->ltsymbol);
@@ -883,18 +885,6 @@
 }
 
 void
-drawsquare(Bool filled, Bool empty, Bool invert, XftColor col[ColLast]) {
-	int x;
-
-	XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG].pixel);
-	x = (dc.font.ascent + dc.font.descent + 2) / 4;
-	if(filled)
-		XFillRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x+1, x+1);
-	else if(empty)
-		XDrawRectangle(dpy, dc.drawable, dc.gc, dc.x+1, dc.y+1, x, x);
-}
-
-void
 drawtext(const char *text, XftColor col[ColLast], Bool invert) {
 	char buf[256];
 	int i, x, y, h, len, olen;
@@ -1791,6 +1781,8 @@
 	dc.urg[ColBorder] = getcolor(urgbordercolor);
    dc.urg[ColBG] = getcolor(urgbgcolor);
    dc.urg[ColFG] = getcolor(urgfgcolor);
+    dc.occ[ColFG] = getcolor(occfgcolor);
+	dc.occ[ColBG] = getcolor(occbgcolor);
    dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
 	dc.gc = XCreateGC(dpy, root, 0, NULL);
 	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);

EDIT: You'll need this in config.h:

static const char occbgcolor[]		= "#6D9F99";
static const char occfgcolor[]		= "#93C724";

Last edited by Unia (2012-08-20 19:41:04)


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

#822 2012-08-20 22:35:05

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

There was a small issue that when a tag was urgent and selected, its fg and bg colors were inverted. To fix this, I changed the col line to this:

col = urg & 1 << i ? dc.urg : (m->tagset[m->seltags] & 1 << i) ?
            dc.sel : (occ & 1 << i ? dc.occ : dc.norm);

Now it's working perfectly. You can find it on my Github, in the DWM-XFT repo wink


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

#823 2012-08-22 21:30:10

Unia
Member
From: The Netherlands
Registered: 2010-03-30
Posts: 2,476
Website

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

Oke, I'm on a roll with fixing my longstanding "issues" with DWM. Now, I've come a long way to get statuscolors working with XFT patched DWM: everything works, except that the tagnames don't show, nor does the window title. The squares above the tagnames and the one indicating floating clients do show, though; which indicates the error is somewhere in the drawtext() function.

I think it's the following line, specifically the &col[...] part:

XftDrawStringUtf8(d, &col[pad ? ColBG : ColFG], dc.font.xfont, x, y, (XftChar8 *) buf, len);

I have absolutely no clue on how to fix this (have already tried a dozen things) so again, I request your help. Upon compiling and running DWM, I receive no error messages. And yes, I have checked my config.h so I have not messed up the colors in there tongue

Lastly, here's a scrot to show what currently works:
tZjdiNw

EDIT: After trying a dozen more alternatives this morning, I finally got it! At last, I can use both XFT and statuscolors! You will be able to find the working patch on my GitHub in the DWM-XFT repo soon.

Last edited by Unia (2012-08-23 10:14:31)


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

#824 2012-09-11 06:46:53

Spanish
Member
Registered: 2012-09-11
Posts: 7

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

LordLandon wrote:

I've fixed the problem with useless gap - here is my patch. This is my first time in the dwm code, but the problem was tile() recalculating the height of a window after resizing it, and thus placing the next one right bellow.

I'm not sure if this breaks something else, but if it does, it might be better to alter the HEIGHT macro itself.

Thanks! I registered on the forums just to thank you, your patch worked perfectly for me big_smile

Offline

#825 2012-09-13 02:40:59

Crunch
Member
From: -+-
Registered: 2011-02-17
Posts: 56

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

@ Unia, glad someone took an interest in that patch tongue I knew it could use some improvements but it had worked on my setup, and still does, so I've been content with it.


Registered Linux user #536591.

Offline

Board footer

Powered by FluxBB