sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit ccebb4f32e267395ea1c72e51bb89b6ae56dc998
parent 3504ee791cc43e1e2fbfda26cf468b2b1df52f55
Author: Andrew Milkovich <amilkovich@gmail.com>
Date:   Sun,  8 Sep 2013 12:58:34 -0700

dualstatus minor change, added 6.0 patch

Diffstat:
Mdwm.suckless.org/patches/dualstatus.md | 5+++--
Adwm.suckless.org/patches/dwm-6.0-dualstatus.diff | 158+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdwm.suckless.org/patches/dwm-6.1-dualstatus.diff | 18+++++++++---------
3 files changed, 170 insertions(+), 11 deletions(-)

diff --git a/dwm.suckless.org/patches/dualstatus.md b/dwm.suckless.org/patches/dualstatus.md @@ -6,12 +6,13 @@ Description This patch will enable an extra status bar in dwm. The extra bar can be toggled along with the standard bar or independently. The status bar text can be set as follows: -xsetroot -name "Top text;Bottom text" +xsetroot -name "top text;bottom text" Download -------- - * [dwm-6.1-dualstatus.diff](dwm-6.1-dualstatus.diff) (4690b) (20130628) + * [dwm-6.1-dualstatus.diff](dwm-6.1-dualstatus.diff) (4688b) (20130908) + * [dwm-6.0-dualstatus.diff](dwm-6.0-dualstatus.diff) (4794b) (20130908) Screenshot ---------- diff --git a/dwm.suckless.org/patches/dwm-6.0-dualstatus.diff b/dwm.suckless.org/patches/dwm-6.0-dualstatus.diff @@ -0,0 +1,158 @@ +diff --git a/config.def.h b/config.def.h +index 77ff358..ea9758d 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -12,6 +12,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ + static const unsigned int snap = 32; /* snap pixel */ + static const Bool showbar = True; /* False means no bar */ + static const Bool topbar = True; /* False means bottom bar */ ++static const Bool extrabar = True; /* False means no extra bar */ + + /* tagging */ + static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +@@ -54,6 +55,7 @@ static Key keys[] = { + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, ++ { MODKEY, XK_b, toggleextrabar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { MODKEY, XK_i, incnmaster, {.i = +1 } }, +diff --git a/dwm.c b/dwm.c +index 1d78655..b322ff5 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -154,6 +154,13 @@ typedef struct { + int monitor; + } Rule; + ++typedef struct { ++ int y; ++ Bool show; ++ Window win; ++ char text[256]; ++} Bar; ++ + /* function declarations */ + static void applyrules(Client *c); + static Bool applysizehints(Client *c, int *x, int *y, int *w, int *h, Bool interact); +@@ -229,6 +236,7 @@ static void tagmon(const Arg *arg); + static int textnw(const char *text, unsigned int len); + static void tile(Monitor *); + static void togglebar(const Arg *arg); ++static void toggleextrabar(const Arg *arg); + static void togglefloating(const Arg *arg); + static void toggletag(const Arg *arg); + static void toggleview(const Arg *arg); +@@ -283,6 +291,7 @@ static Display *dpy; + static DC dc; + static Monitor *mons = NULL, *selmon = NULL; + static Window root; ++static Bar eb; + + /* configuration, allows nested code to access above variables */ + #include "config.h" +@@ -495,6 +504,8 @@ cleanup(void) { + XFreeCursor(dpy, cursor[CurNormal]); + XFreeCursor(dpy, cursor[CurResize]); + XFreeCursor(dpy, cursor[CurMove]); ++ XUnmapWindow(dpy, eb.win); ++ XDestroyWindow(dpy, eb.win); + while(mons) + cleanupmon(mons); + XSync(dpy, False); +@@ -584,6 +595,7 @@ configurenotify(XEvent *e) { + updatebars(); + for(m = mons; m; m = m->next) + XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); ++ XMoveResizeWindow(dpy, eb.win, mons->wx, eb.y, mons->ww, bh); + focus(NULL); + arrange(NULL); + } +@@ -762,6 +774,10 @@ drawbar(Monitor *m) { + drawtext(NULL, dc.norm, False); + } + XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0); ++ dc.x = 0; ++ dc.w = m->ww; ++ drawtext(eb.text, dc.norm, False); ++ XCopyArea(dpy, dc.drawable, eb.win, dc.gc, 0, 0, m->ww, bh, 0, 0); + XSync(dpy, False); + } + +@@ -1594,6 +1610,7 @@ setup(void) { + sw = DisplayWidth(dpy, screen); + sh = DisplayHeight(dpy, screen); + bh = dc.h = dc.font.height + 2; ++ eb.show = extrabar; + updategeom(); + /* init atoms */ + wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); +@@ -1736,6 +1753,16 @@ togglebar(const Arg *arg) { + } + + void ++toggleextrabar(const Arg *arg) { ++ if(selmon == mons) { ++ eb.show = !eb.show; ++ updatebarpos(selmon); ++ XMoveResizeWindow(dpy, eb.win, selmon->wx, eb.y, selmon->ww, bh); ++ arrange(selmon); ++ } ++} ++ ++void + togglefloating(const Arg *arg) { + if(!selmon->sel) + return; +@@ -1833,6 +1860,13 @@ updatebars(void) { + XDefineCursor(dpy, m->barwin, cursor[CurNormal]); + XMapRaised(dpy, m->barwin); + } ++ if(!eb.win) { ++ eb.win = XCreateWindow(dpy, root, mons->wx, eb.y, mons->ww, bh, 0, DefaultDepth(dpy, screen), ++ CopyFromParent, DefaultVisual(dpy, screen), ++ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); ++ XDefineCursor(dpy, eb.win, cursor[CurNormal]); ++ XMapRaised(dpy, eb.win); ++ } + } + + void +@@ -1846,6 +1880,13 @@ updatebarpos(Monitor *m) { + } + else + m->by = -bh; ++ if(m == mons && eb.show) { ++ m->wh -= bh; ++ eb.y = topbar ? m->wy + m->wh : m->wy; ++ m->wy = m->topbar ? m->wy : m->wy + bh; ++ } ++ else ++ eb.y = -bh; + } + + Bool +@@ -2005,8 +2046,21 @@ updatetitle(Client *c) { + + void + updatestatus(void) { +- if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) ++ char text[512]; ++ if(!gettextprop(root, XA_WM_NAME, text, sizeof(text))) { + strcpy(stext, "dwm-"VERSION); ++ eb.text[0] = '\0'; ++ } ++ else { ++ char *e = strchr(text, ';'); ++ if(e) { ++ *e = '\0'; e++; ++ strncpy(eb.text, e, sizeof(eb.text)-1); ++ } ++ else ++ eb.text[0] = '\0'; ++ strncpy(stext, text, sizeof(stext)-1); ++ } + drawbar(selmon); + } + diff --git a/dwm.suckless.org/patches/dwm-6.1-dualstatus.diff b/dwm.suckless.org/patches/dwm-6.1-dualstatus.diff @@ -1,5 +1,5 @@ diff --git a/config.def.h b/config.def.h -index d300687..e286e5d 100644 +index 875885b..f319123 100644 --- a/config.def.h +++ b/config.def.h @@ -12,6 +12,7 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ @@ -10,7 +10,7 @@ index d300687..e286e5d 100644 /* tagging */ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; -@@ -58,6 +59,7 @@ static Key keys[] = { +@@ -59,6 +60,7 @@ static Key keys[] = { { MODKEY, XK_p, spawn, {.v = dmenucmd } }, { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, { MODKEY, XK_b, togglebar, {0} }, @@ -19,7 +19,7 @@ index d300687..e286e5d 100644 { MODKEY, XK_k, focusstack, {.i = -1 } }, { MODKEY, XK_i, incnmaster, {.i = +1 } }, diff --git a/dwm.c b/dwm.c -index 314adf4..09a14f8 100644 +index 1bbb4b3..e0f4f44 100644 --- a/dwm.c +++ b/dwm.c @@ -140,6 +140,13 @@ typedef struct { @@ -87,7 +87,7 @@ index 314adf4..09a14f8 100644 updategeom(); /* init atoms */ wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False); -@@ -1631,6 +1647,16 @@ togglebar(const Arg *arg) { +@@ -1634,6 +1650,16 @@ togglebar(const Arg *arg) { } void @@ -104,21 +104,21 @@ index 314adf4..09a14f8 100644 togglefloating(const Arg *arg) { if(!selmon->sel) return; -@@ -1735,6 +1761,13 @@ updatebars(void) { +@@ -1738,6 +1764,13 @@ updatebars(void) { XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); XMapRaised(dpy, m->barwin); } + if(!eb.win) { + eb.win = XCreateWindow(dpy, root, mons->wx, eb.y, mons->ww, bh, 0, DefaultDepth(dpy, screen), -+ CopyFromParent, DefaultVisual(dpy, screen), -+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); ++ CopyFromParent, DefaultVisual(dpy, screen), ++ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa); + XDefineCursor(dpy, eb.win, cursor[CurNormal]->cursor); + XMapRaised(dpy, eb.win); + } } void -@@ -1748,6 +1781,13 @@ updatebarpos(Monitor *m) { +@@ -1751,6 +1784,13 @@ updatebarpos(Monitor *m) { } else m->by = -bh; @@ -132,7 +132,7 @@ index 314adf4..09a14f8 100644 } void -@@ -1920,8 +1960,21 @@ updatetitle(Client *c) { +@@ -1923,8 +1963,21 @@ updatetitle(Client *c) { void updatestatus(void) {