sites

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

commit 7b071c6a7b3d1c1a63bebac5fca46c4892f19c8d
parent 86bf29b6a33e931055cf64cf0c3cdcae4cecadab
Author: runlikeforrestgump <runlikeforrestgump@users.noreply.github.com>
Date:   Sat,  8 Nov 2014 00:39:49 -0700

Add the fancybarclickable dwm patch.

Diffstat:
Adwm.suckless.org/patches/dwm-6.1-fancybarclickable.diff | 261+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/fancybarclickable.md | 21+++++++++++++++++++++
2 files changed, 282 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/dwm-6.1-fancybarclickable.diff b/dwm.suckless.org/patches/dwm-6.1-fancybarclickable.diff @@ -0,0 +1,261 @@ +diff --git a/config.def.h b/config.def.h +index 875885b..05865bb 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -97,6 +97,7 @@ static Button buttons[] = { + /* click event mask button function argument */ + { ClkLtSymbol, 0, Button1, setlayout, {0} }, + { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, ++ { ClkWinTitle, 0, Button1, focusonclick, {0} }, + { ClkWinTitle, 0, Button2, zoom, {0} }, + { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkClientWin, MODKEY, Button1, movemouse, {0} }, +diff --git a/dwm.c b/dwm.c +index f896170..cc2a4f2 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -129,6 +129,8 @@ struct Monitor { + Monitor *next; + Window barwin; + const Layout *lt[2]; ++ int titlebarbegin; ++ int titlebarend; + }; + + typedef struct { +@@ -163,9 +165,11 @@ static void detachstack(Client *c); + static Monitor *dirtomon(int dir); + static void drawbar(Monitor *m); + static void drawbars(void); ++static void drawline(int x, int y); + static void enternotify(XEvent *e); + static void expose(XEvent *e); + static void focus(Client *c); ++static void focusonclick(const Arg *arg); + static void focusin(XEvent *e); + static void focusmon(const Arg *arg); + static void focusstack(const Arg *arg); +@@ -432,10 +436,12 @@ buttonpress(XEvent *e) { + } + else if(ev->x < x + blw) + click = ClkLtSymbol; +- else if(ev->x > selmon->ww - TEXTW(stext)) ++ else if(ev->x > selmon->titlebarend) + click = ClkStatusText; +- else ++ else { ++ arg.ui = ev->x; + click = ClkWinTitle; ++ } + } + else if((c = wintoclient(ev->window))) { + focus(c); +@@ -444,7 +450,7 @@ buttonpress(XEvent *e) { + for(i = 0; i < LENGTH(buttons); i++) + if(click == buttons[i].click && buttons[i].func && buttons[i].button == ev->button + && CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) +- buttons[i].func(click == ClkTagBar && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); ++ buttons[i].func((click == ClkTagBar || click == ClkWinTitle) && buttons[i].arg.i == 0 ? &arg : &buttons[i].arg); + } + + void +@@ -692,11 +698,14 @@ dirtomon(int dir) { + + void + drawbar(Monitor *m) { +- int x, xx, w; +- unsigned int i, occ = 0, urg = 0; +- Client *c; ++ int x, xx, w, ow, mw = 0, extra, tw, a = 0, s = 0; ++ char posbuf[10]; ++ unsigned int i, occ = 0, urg = 0, n = 0; ++ Client *c, *firstvis, *lastvis = NULL; + + for(c = m->clients; c; c = c->next) { ++ if(ISVISIBLE(c)) ++ n++; + occ |= c->tags; + if(c->isurgent) + urg |= c->tags; +@@ -716,32 +725,109 @@ drawbar(Monitor *m) { + x += w; + xx = x; + if(m == selmon) { /* status is only drawn on selected monitor */ +- w = TEXTW(stext); ++ if(m->lt[m->sellt]->arrange == monocle){ ++ x = xx; ++ for(c = nexttiled(m->clients), a = 0, s = 0; c; c = nexttiled(c->next), a++) { ++ if(c == m->stack) ++ s = a; ++ } ++ if(!s && a) ++ s = a; ++ snprintf(posbuf, LENGTH(posbuf), "[%d/%d]", s, a); ++ w = TEXTW(posbuf); ++ drw_text(drw, x, 0, w, bh, posbuf, 0); ++ xx = x + w; ++ } ++ ++ /* ++ char *buf = stext, *ptr = buf; ++ while (*ptr) { ++ for (i = 0; *ptr < 0; i++, ptr++); ++ w 2+= drw_font_getexts_width(drw->font, buf, i); ++ w += TEXTW(buf); ++ buf=++ptr; ++ }*/ ++ w = TEXTW(stext); ++ + x = m->ww - w; + if(x < xx) { + x = xx; + w = m->ww - xx; + } ++ m->titlebarend=x; + drw_text(drw, x, 0, w, bh, stext, 0); + } +- else ++ else { + x = m->ww; +- if((w = x - xx) > bh) { +- x = xx; +- if(m->sel) { +- drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]); +- drw_text(drw, x, 0, w, bh, m->sel->name, 0); +- drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, 0); +- } +- else { ++ m->titlebarbegin=x; ++ } ++ for(c = m->clients; c && !ISVISIBLE(c); c = c->next); ++ firstvis = c; ++ ++ drw_setscheme(drw, m == selmon ? &scheme[SchemeSel] : &scheme[SchemeNorm]); ++ w = x - xx; ++ x = xx; ++ ++ if(n > 0) { ++ mw = w / n; ++ extra = 0; ++ i = 0; ++ ++ while(c) { ++ lastvis = c; ++ tw = TEXTW(c->name); ++ if(tw < mw) extra += (mw - tw); else i++; ++ for(c = c->next; c && !ISVISIBLE(c); c = c->next); ++ } ++ ++ if(i > 0) mw += extra / i; ++ ++ c = firstvis; ++ xx = x; ++ } ++ m->titlebarbegin=x; ++ while(w > bh) { ++ if(c) { ++ ow = w; ++ tw = TEXTW(c->name); ++ w = MIN(ow, tw); ++ ++ if(w > mw) w = mw; ++ if(c == lastvis) w = ow; ++ ++ drw_text(drw, x, 0, w, bh, c->name, False); ++ if(c != firstvis) drawline(x, 0); ++ drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, True); ++ ++ x += w; ++ w = ow - w; ++ for(c = c->next; c && !ISVISIBLE(c); c = c->next); ++ } else { + drw_setscheme(drw, &scheme[SchemeNorm]); + drw_text(drw, x, 0, w, bh, NULL, 0); ++ break; + } + } ++ ++ if(m == selmon && m->sel && ISVISIBLE(m->sel)) { ++ drw_text(drw, x, 0, w, bh, m->sel->name, True); ++ drw_rect(drw, x, 0, w, bh, m->sel->isfixed, m->sel->isfloating, True); ++ } ++ + drw_map(drw, m->barwin, 0, 0, m->ww, bh); + } + + void ++drawline(int x, int y) { ++ XGCValues gcv; ++ ++ gcv.foreground = drw->scheme->fg->rgb; ++ ++ XChangeGC(dpy, drw->gc, GCForeground, &gcv); ++ XDrawLine(dpy, drw->drawable, drw->gc, x, y, x, y + (drw->font->ascent + drw->font->descent + 2)); ++} ++ ++void + drawbars(void) { + Monitor *m; + +@@ -804,6 +890,51 @@ focus(Client *c) { + } + + void ++focusonclick(const Arg *arg) { ++ int x, w, mw = 0, tw, n = 0, i = 0, extra = 0; ++ Monitor *m = selmon; ++ Client *c, *firstvis; ++ ++ for(c = m->clients; c && !ISVISIBLE(c); c = c->next); ++ firstvis = c; ++ ++ for(c = m->clients; c; c = c->next) ++ if (ISVISIBLE(c)) ++ n++; ++ ++ if(n > 0) { ++ mw = (m->titlebarend - m->titlebarbegin) / n; ++ c = firstvis; ++ while(c) { ++ tw = TEXTW(c->name); ++ if(tw < mw) extra += (mw - tw); else i++; ++ for(c = c->next; c && !ISVISIBLE(c); c = c->next); ++ } ++ if(i > 0) mw += extra / i; ++ } ++ ++ x=m->titlebarbegin; ++ ++ c = firstvis; ++ while(x < m->titlebarend) { ++ if(c) { ++ w=MIN(TEXTW(c->name), mw); ++ if (x < arg->i && x+w > arg->i) { ++ focus(c); ++ restack(selmon); ++ break; ++ } else { ++ x+=w; ++ } ++ ++ for(c = c->next; c && !ISVISIBLE(c); c = c->next); ++ } else { ++ break; ++ } ++ } ++} ++ ++void + focusin(XEvent *e) { /* there are some broken focus acquiring clients */ + XFocusChangeEvent *ev = &e->xfocus; + +@@ -1221,8 +1352,7 @@ propertynotify(XEvent *e) { + } + if(ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { + updatetitle(c); +- if(c == c->mon->sel) +- drawbar(c->mon); ++ drawbar(c->mon); + } + if(ev->atom == netatom[NetWMWindowType]) + updatewindowtype(c); diff --git a/dwm.suckless.org/patches/fancybarclickable.md b/dwm.suckless.org/patches/fancybarclickable.md @@ -0,0 +1,21 @@ +fancybarclickable +================= + +Description +----------- +`fancybarclickable` is basically [fancycoloredbarclickable](fancycoloredbarclickable) +minus the [statuscolors](statuscolors). It uses the dwm bar to show you the +titles of all the windows in the current tag and lets you select windows by +selecting their title in the dwm bar. + +Download +-------- +* [dwm-6.1-fancybarclickable.diff](dwm-6.1-fancybarclickable.diff) + +Authors +------- + +* Stefan Mark wrote fancycoloredbarclickable. +* Mate Nagy wrote fancybar. +* An anonymous Canadian updated the fancybar patch and added the + selectby-click-on-title function from fancycoloredbarclickable to it.