You are not logged in.
NOTE: THE PATCH IS POSTED BELOW IN MY SECOND POST IN THIS THREAD. INSTRUCTIONS FOR FORMATTING THE ROOT WINDOW REMAIN THE SAME AS IN THIS POST.
I modified the DWM code so that instead of one bar, it is possible to have two at the same time, one on the top and one on the bottom. They can both be hidden separately with key combinations and are managed by DWM, and so both act like normal status bars (i.e. windows behave properly around them). The top bar shows the standard DWM info, along with anything that is piped to the root window with xsetroot (as is standard). But if the bottom bar is enabled, a second bar shows up. This bar also shows information from the root window. If you were to want the text "this is the top" to appear in the top bar and "this is the bottom" to appear in the bottom bar, you would format it to the root window like so: "this is the topBOTTOM=this is the bottom".
I was just asking to check if there is a demand for such a patch; if there is, I will clean up my version and post it here.
Screenshot of the two bars "in action":
http://img59.imageshack.us/img59/1943/t … enshot.jpg
The scrolling breaking news on the bottom is another patch for conky that enables rss feeds to scroll on one line. If anyone wants this patch I will provide it as well.
Moderator edit: read the rules on posting screenshots
Last edited by .:B:. (2010-06-27 12:43:28)
Offline
This is relevant to my interests.
I've recently made the switch from Awesome to dwm.
arst
Offline
Patches are always welcome within the dwm community. The absolute best place to post it would be to the dwm website (it's a wiki so you can edit it). Check out their guidelines and if/when you do post it, send out a blurb on the suckless mailing list. I'm sure there are interested parties!
http://dwm.suckless.org/patches/
http://suckless.org/wiki/
Mailing List: dev+subscribe@suckless.org
Last edited by thayer (2010-01-22 14:54:00)
thayer williams ~ cinderwick.ca
Offline
I modified the DWM code so that instead of one bar, it is possible to have two at the same time, one on the top and one on the bottom. (...)
I was just asking to check if there is a demand for such a patch; if there is, I will clean up my version and post it here.
Hello,
I'd would be happy to see your patch.
I checked the dwm mailing list, it seems you didn't post it there,
if you prefer to post it here, I'm sure it will be welcomed as well.
Offline
Alright, after a long while (sorry), here's the patch and instructions. First, download and extract (I had to compress it for the upload sites to work) this patch to a directory on your computer:
http://www.mediafire.com/file/q2nq5mwml … ar.diff.gz
The text of the patch is provided below ONLY FOR REFERENCE. The formatting is off and the patch ends up not working. Use the linked patch.
diff -r fd72a695c7f2 -r 02377b01f0c6 dwm.c
--- a/dwm.c Sat Feb 06 18:11:01 2010 -0500
+++ b/dwm.c Sat Feb 06 18:17:56 2010 -0500
@@ -125,6 +125,7 @@
float mfact;
int num;
int by; /* bar geometry */
+ int bby; /* ADDED bottom bar geometry */
int mx, my, mw, mh; /* screen size */
int wx, wy, ww, wh; /* window area */
unsigned int seltags;
@@ -132,11 +133,16 @@
unsigned int tagset[2];
Bool showbar;
Bool topbar;
+ // ADDED info on bottom bar
+ Bool showbottombar;
+ Bool bottombar;
Client *clients;
Client *sel;
Client *stack;
Monitor *next;
Window barwin;
+ // ADDED bottom bar window pointer
+ Window bbarwin;
const Layout *lt[2];
};
@@ -242,6 +248,7 @@
/* variables */
static const char broken[] = "broken";
static char stext[256];
+static char btext[256];
static int screen;
static int sw, sh; /* X display screen geometry width, height */
static int bh, blw = 0; /* bar geometry */
@@ -505,6 +512,8 @@
}
XUnmapWindow(dpy, mon->barwin);
XDestroyWindow(dpy, mon->barwin);
+ XUnmapWindow(dpy, mon->bbarwin);
+ XDestroyWindow(dpy, mon->bbarwin);
free(mon);
}
@@ -553,6 +562,7 @@
updatebars();
for(m = mons; m; m = m->next)
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
+ XMoveResizeWindow(dpy, m->bbarwin, m->wx, m->bby, m->ww, bh);
arrange(NULL);
}
}
@@ -613,6 +623,9 @@
m->mfact = mfact;
m->showbar = showbar;
m->topbar = topbar;
+ // ADDED monitor setup
+ m->bottombar = bottombar;
+ m->showbottombar = bottombar ? True : False;
m->lt[0] = &layouts[0];
m->lt[1] = &layouts[1 % LENGTH(layouts)];
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
@@ -723,6 +736,16 @@
drawtext(NULL, dc.norm, False);
}
XCopyArea(dpy, dc.drawable, m->barwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
+ if (m->showbottombar)
+ {
+ dc.x = 0;
+ dc.w = TEXTW(btext);
+ drawtext(btext, dc.norm, False);
+ dc.x += dc.w;
+ dc.w = m->ww - dc.x;
+ drawtext(NULL, dc.norm, False);
+ XCopyArea(dpy, dc.drawable, m->bbarwin, dc.gc, 0, 0, m->ww, bh, 0, 0);
+ }
XSync(dpy, False);
}
@@ -1716,6 +1739,14 @@
CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]);
XMapRaised(dpy, m->barwin);
+ // ADDED drawing bottom bar
+ if (m->bottombar) {
+ m->bbarwin = XCreateWindow(dpy, root, m->wx, m->bby, m->ww, bh, 0, DefaultDepth(dpy, screen),
+ CopyFromParent, DefaultVisual(dpy, screen),
+ CWOverrideRedirect|CWBackPixmap|CWEventMask, &wa);
+ XDefineCursor(dpy, m->bbarwin, cursor[CurNormal]);
+ XMapRaised(dpy, m->bbarwin);
+ }
}
}
@@ -1730,6 +1761,13 @@
}
else
m->by = -bh;
+ // ADDED geometry of window
+ if (m->showbottombar) {
+ m->wh -= bh;
+ m->bby = m->wy + m->wh;
+ }
+ else
+ m->bby = -bh;
}
Bool
@@ -1890,8 +1928,43 @@
void
updatestatus(void) {
- if(!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
+ char buftext[512];
+ if(!gettextprop(root, XA_WM_NAME, buftext, sizeof(buftext)))
strcpy(stext, "dwm-"VERSION);
+ else {
+ // Parse input; currently delimited by BOTTOM=
+ char* blocation = strstr(buftext,"BOTTOM=");
+ if (blocation != NULL)
+ {
+ int c = 0;
+ for (char* i = buftext; i < blocation; i++)
+ {
+ if (c < sizeof(stext) - 1)
+ stext[c] = *i;
+ else
+ break;
+ c++;
+ }
+ stext[c] = '\0';
+ blocation += 7;
+ c = 0;
+ for (char* i = blocation; i < (blocation + sizeof(buftext)); i++)
+ {
+ if (c < sizeof(btext) - 1)
+ btext[c] = *i;
+ else
+ break;
+ c++;
+ }
+ btext[c] = '\0';
+ }
+ else
+ {
+ for (int i = 0; i < sizeof(stext); i++)
+ stext[i] = buftext[i];
+ stext[sizeof(stext) - 1] = '\0';
+ }
+ }
drawbar(selmon);
}
Now apply the patch (if you are using the tarball) by running
patch -p1 < path/to/patch.diff
Next, add the following lines to config.h:
under the line "static const Bool topbar = True; /* False means bottom bar */" (keep in mind this must be true for this patch to be useful)
put the following:
static const Bool bottombar = True; /* True means an extra bar on the bottom */
(This is used as your switch for turning the bottom bar on and off)
IMPORTANT: so that you can show and hide the bottom bar with a keybinding do the following:
before the keys[] array is declared, add the line:
#include "togglebottombar.c"
, next, in the keys array, add a line like the following:
{ MODKEY, XK_i, togglebottombar, {0} },
Obviously, any key combo can be used. This hides the bottom bar with the modkey (mine is set to the windows or "super" key) and i.
Finally, copy and paste this code into a file called "togglebottombar.c" in your dwm source directory:
void togglebottombar(const Arg *arg) {
selmon->showbottombar = !selmon->showbottombar;
updatebarpos(selmon);
XMoveResizeWindow(dpy, selmon->bbarwin, selmon->wx, selmon->bby, selmon->ww, bh);
arrange(selmon);
}
Now, format the text in your root window as described in the first post:
assuming *TEXTONTOP* is text into the top bar and *TEXTONBOTTOM* is text into the bottom bar, you would format your root window text like this:
*TEXTONTOP*BOTTOM=*TEXTONBOTTOM*
For example, I have info on the top, and network info and news on the bottom (as shown in the screenshot thread).
Last edited by RedScare (2010-02-09 03:19:38)
Offline
Thanks!
I'll try it out as soon as I can.
Offline
The file has been deleted, does anyone have it?
Offline
Please use a thumbnail instead of a full-blown screenshot. Not everyone is on a broadband connection .
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline