[wiki] [sites] dualstatus minor change, added 6.0 patch || Andrew Milkovich

From: <git_AT_suckless.org>
Date: Sun, 08 Sep 2013 22:01:44 +0200

commit ccebb4f32e267395ea1c72e51bb89b6ae56dc998
Author: Andrew Milkovich <amilkovich_AT_gmail.com>
Date: Sun Sep 8 12:58:34 2013 -0700

    dualstatus minor change, added 6.0 patch

diff --git a/dwm.suckless.org/patches/dualstatus.md b/dwm.suckless.org/patches/dualstatus.md
index 8cb819b..d09def0 100644
--- a/dwm.suckless.org/patches/dualstatus.md
+++ b/dwm.suckless.org/patches/dualstatus.md
_AT_@ -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
new file mode 100644
index 0000000..bc140fe
--- /dev/null
+++ b/dwm.suckless.org/patches/dwm-6.0-dualstatus.diff
_AT_@ -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
+_AT_@ -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" };
+_AT_@ -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
+_AT_@ -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);
+_AT_@ -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);
+_AT_@ -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"
+_AT_@ -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);
+_AT_@ -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);
+ }
+_AT_@ -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);
+ }
+
+_AT_@ -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);
+_AT_@ -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;
+_AT_@ -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
+_AT_@ -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
+_AT_@ -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] = '
Received on Sun Sep 08 2013 - 22:01:44 CEST

This archive was generated by hypermail 2.3.0 : Thu Jun 18 2015 - 17:37:45 CEST