Created
November 2, 2011 16:52
-
-
Save ropery/1334192 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dynamictitle.patch for dwm 5.9 | |
Changes the way window titles are displayed in the dwm bar: | |
* The "visual length" of the title is dynamically adjusted to just long | |
enough to hold the window title. | |
diff -up a/dwm.c b/dwm.c | |
--- a/dwm.c 2011-07-11 10:18:58.794920643 +0000 | |
+++ b/dwm.c 2011-07-11 10:42:54.812150418 +0000 | |
@@ -761,8 +761,15 @@ drawbar(Monitor *m) { | |
dc.x = x; | |
if(m->sel) { | |
col = m == selmon ? dc.sel : dc.norm; | |
+ unsigned int w = dc.w; | |
+ dc.w = MIN(dc.w, TEXTW(m->sel->name)); | |
drawtext(m->sel->name, col, False); | |
drawsquare(m->sel->isfixed, m->sel->isfloating, False, col); | |
+ if (dc.w < w) { | |
+ dc.x += dc.w; | |
+ dc.w = w - dc.w; | |
+ drawtext(NULL, dc.norm, False); | |
+ } | |
} | |
else | |
drawtext(NULL, dc.norm, False); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urgcolors.patch for dwm 5.9 | |
Defines dc.urg in the same manner as dc.norm and dc.sel are defined. | |
To use this, put the following definitions in your config.h: | |
static const char urgbordercolor[] = "#ff0000"; | |
static const char urgbgcolor[] = "#ffffff"; | |
static const char urgfgcolor[] = "#ff0000"; | |
--- a/dwm.c 2011-07-11 03:53:25.848996476 +0000 | |
+++ b/dwm.c 2011-07-11 09:27:48.497175295 +0000 | |
@@ -99,6 +99,7 @@ typedef struct { | |
int x, y, w, h; | |
unsigned long norm[ColLast]; | |
unsigned long sel[ColLast]; | |
+ unsigned long urg[ColLast]; | |
Drawable drawable; | |
GC gc; | |
struct { | |
@@ -1556,6 +1557,9 @@ setup(void) { | |
dc.sel[ColBorder] = getcolor(selbordercolor); | |
dc.sel[ColBG] = getcolor(selbgcolor); | |
dc.sel[ColFG] = getcolor(selfgcolor); | |
+ dc.urg[ColBorder] = getcolor(urgbordercolor); | |
+ dc.urg[ColBG] = getcolor(urgbgcolor); | |
+ dc.urg[ColFG] = getcolor(urgfgcolor); | |
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment