Adding powerline patch

pull/48/head
bakkeby 4 years ago
parent 23c0e9450f
commit 023aa218e4

@ -15,7 +15,7 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
### Changelog:
2020-07-19 - Added bar_modules patch - making extrabar, leftlayout, staticstatus and statusallmons patches redundant
2020-07-19 - Added bar_modules patch - making extrabar, leftlayout, staticstatus and statusallmons patches redundant, added powerline patch
2020-07-18 - **Note**: Up until now building dwm-flexipath without any patches selected would have given you something more or less identical with mainstream dwm. In order to reduce complexity when it comes to maintainance future versions of dwm-flexipatch may diverge from this by making some patches non-optional. For the classic dwm-flexipatch and its many patch integration hints refer to branch [dwm-flexipatch-1.0](https://github.com/bakkeby/dwm-flexipatch/tree/dwm-flexipatch-1.0) which will be subject to bug fixes and mainstream dwm updates as far as feasible.
@ -348,6 +348,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [pertag](https://dwm.suckless.org/patches/pertag/)
- adds nmaster, mfact, layouts and more per tag rather than per monitor
- [powerline](https://gitlab.com/udiboy1209-suckless/dwm/-/commit/071f5063e8ac4280666828179f92788d893eea40#4b1a539194be7467cefbda22f675a3b7c19ceca7)
- adds drawing of powerline arrows (and diagonal lines) for both the status bar and the tags
- [push](https://dwm.suckless.org/patches/push/)
- this patch provides a way to move clients up and down inside the client list

@ -375,45 +375,52 @@ static const MonitorRule monrules[] = {
* name - does nothing, intended for visual clue and for logging / debugging
*/
static const BarRule barrules[] = {
/* monitor bar alignment widthfunc drawfunc clickfunc name */
/* monitor bar alignment widthfunc drawfunc clickfunc name */
#if BAR_STATUSBUTTON_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" },
{ -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" },
#endif // BAR_STATUSBUTTON_PATCH
#if BAR_POWERLINE_TAGS_PATCH
{ 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, "powerline_tags" },
#endif // BAR_POWERLINE_TAGS_PATCH
#if BAR_TAGS_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
{ -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" },
#endif // BAR_TAGS_PATCH
#if BAR_TAGGRID_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" },
{ -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" },
#endif // BAR_TAGGRID_PATCH
#if BAR_LTSYMBOL_PATCH
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
{ -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" },
#endif // BAR_LTSYMBOL_PATCH
#if BAR_SYSTRAY_PATCH
{ 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
{ 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" },
#endif // BAR_SYSTRAY_PATCH
#if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
{ 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" },
{ 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" },
#elif BAR_STATUS2D_PATCH
{ 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" },
{ 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" },
#elif BAR_POWERLINE_STATUS_PATCH
{ 0, 0, BAR_ALIGN_RIGHT, width_pwrl_status, draw_pwrl_status, click_pwrl_status, "powerline_status" },
#elif BAR_STATUS_PATCH
{ 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
{ 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" },
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
#if BAR_AWESOMEBAR_PATCH
{ -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" },
{ -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" },
#elif BAR_FANCYBAR_PATCH
{ -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" },
{ -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" },
#elif BAR_WINTITLE_PATCH
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
{ -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" },
#endif // BAR_AWESOMEBAR_PATCH | BAR_FANCYBAR_PATCH BAR_WINTITLE_PATCH
#if BAR_EXTRASTATUS_PATCH
#if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
{ 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" },
{ 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" },
#elif BAR_STATUS2D_PATCH
{ 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" },
#elif BAR_STATUSCMD_PATCH
{ 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" },
{ 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" },
#elif BAR_POWERLINE_STATUS_PATCH
{ 0, 1, BAR_ALIGN_RIGHT, width_pwrl_status_es, draw_pwrl_status_es, click_pwrl_status, "powerline_status" },
#elif BAR_STATUSCMD_PATCH && BAR_STATUS_PATCH
{ 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" },
#elif BAR_STATUS_PATCH
{ 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" },
{ 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" },
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
#endif // BAR_EXTRASTATUS_PATCH
};

57
drw.c

@ -17,6 +17,9 @@ static const unsigned char utfbyte[UTF_SIZ + 1] = {0x80, 0, 0xC0, 0xE0, 0xF0}
static const unsigned char utfmask[UTF_SIZ + 1] = {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
static const long utfmin[UTF_SIZ + 1] = { 0, 0, 0x80, 0x800, 0x10000};
static const long utfmax[UTF_SIZ + 1] = {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FFFF};
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
Clr transcheme[3];
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
static long
utf8decodebyte(const char c, size_t *i)
@ -367,6 +370,17 @@ drw_setscheme(Drw *drw, Clr *scm)
drw->scheme = scm;
}
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_settrans(Drw *drw, Clr *psc, Clr *nsc)
{
if (drw) {
transcheme[0] = psc[ColBg]; transcheme[1] = nsc[ColBg]; transcheme[2] = psc[ColBorder];
drw->scheme = transcheme;
}
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert)
{
@ -425,15 +439,15 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
; /* NOP */
if (render) {
ty = y + (h - drw->font->h) / 2;
ty = y + (h - drw->fonts->h) / 2;
if (markup)
pango_layout_set_markup(drw->font->layout, buf, len);
pango_layout_set_markup(drw->fonts->layout, buf, len);
else
pango_layout_set_text(drw->font->layout, buf, len);
pango_layout_set_text(drw->fonts->layout, buf, len);
pango_xft_render_layout(d, &drw->scheme[invert ? ColBg : ColFg],
drw->font->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
drw->fonts->layout, x * PANGO_SCALE, ty * PANGO_SCALE);
if (markup) /* clear markup attributes */
pango_layout_set_attributes(drw->font->layout, NULL);
pango_layout_set_attributes(drw->fonts->layout, NULL);
}
x += ew;
w -= ew;
@ -581,6 +595,39 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
}
#endif // BAR_PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void
drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash)
{
if (!drw || !drw->scheme)
return;
/* direction=1 draws right arrow */
x = direction ? x : x + w;
w = direction ? w : -w;
/* slash=1 draws slash instead of arrow */
unsigned int hh = slash ? (direction ? 0 : h) : h/2;
XPoint points[] = {
{x , y },
{x + w, y + hh },
{x , y + h },
};
XPoint bg[] = {
{x , y },
{x + w, y },
{x + w, y + h},
{x , y + h},
};
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColBg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, bg, 4, Convex, CoordModeOrigin);
XSetForeground(drw->dpy, drw->gc, drw->scheme[ColFg].pixel);
XFillPolygon(drw->dpy, drw->drawable, drw->gc, points, 3, Nonconvex, CoordModeOrigin);
}
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
void
drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h)
{

10
drw.h

@ -41,11 +41,7 @@ typedef struct {
Drawable drawable;
GC gc;
Clr *scheme;
#if BAR_PANGO_PATCH
Fnt *font;
#else
Fnt *fonts;
#endif // BAR_PANGO_PATCH
} Drw;
/* Drawable abstraction */
@ -107,6 +103,9 @@ void drw_cur_free(Drw *drw, Cur *cursor);
void drw_setfontset(Drw *drw, Fnt *set);
#endif // BAR_PANGO_PATCH
void drw_setscheme(Drw *drw, Clr *scm);
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_settrans(Drw *drw, Clr *psc, Clr *nsc);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Drawing functions */
void drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int invert);
@ -115,6 +114,9 @@ int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned in
#else
int drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert);
#endif // BAR_PANGO_PATCH
#if BAR_POWERLINE_TAGS_PATCH || BAR_POWERLINE_STATUS_PATCH
void drw_arrow(Drw *drw, int x, int y, unsigned int w, unsigned int h, int direction, int slash);
#endif // BAR_POWERLINE_TAGS_PATCH | BAR_POWERLINE_STATUS_PATCH
/* Map functions */
void drw_map(Drw *drw, Window win, int x, int y, unsigned int w, unsigned int h);

29
dwm.c

@ -132,10 +132,13 @@ enum {
#if BAR_VTCOLORS_PATCH
,SchemeTagsNorm
,SchemeTagsSel
,SchemeStatus
#endif
#if BAR_VTCOLORS_PATCH || BAR_POWERLINE_STATUS_PATCH
,SchemeTitleNorm
,SchemeTitleSel
,SchemeStatus
#elif BAR_TITLECOLOR_PATCH
#endif // BAR_POWERLINE_STATUS_PATCH
#if BAR_TITLECOLOR_PATCH
,SchemeTitle
#endif // BAR_VTCOLORS_PATCH
}; /* color schemes */
@ -579,9 +582,7 @@ static char estext[512];
#endif // BAR_STATUS2D_PATCH
#if BAR_STATUSCMD_PATCH
static char rawestext[1024];
#else
static char rawestext[512];
#endif // BAR_STATUSCMD_PATCH
#endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
#endif // BAR_EXTRASTATUS_PATCH
static int screen;
@ -2820,15 +2821,9 @@ setup(void)
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
#endif // BAR_PANGO_PATCH
die("no fonts could be loaded.");
#if BAR_STATUSPADDING_PATCH && BAR_PANGO_PATCH
lrpad = drw->font->h + horizpadbar;
bh = drw->font->h + vertpadbar;
#elif BAR_STATUSPADDING_PATCH
#if BAR_STATUSPADDING_PATCH
lrpad = drw->fonts->h + horizpadbar;
bh = drw->fonts->h + vertpadbar;
#elif BAR_PANGO_PATCH
lrpad = drw->font->h;
bh = drw->font->h + 2;
#else
lrpad = drw->fonts->h;
#if BAR_HEIGHT_PATCH
@ -2916,6 +2911,16 @@ setup(void)
#else
scheme[i] = drw_scm_create(drw, colors[i], ColCount);
#endif // BAR_ALPHA_PATCH
#if BAR_POWERLINE_STATUS_PATCH
statusscheme = ecalloc(LENGTH(statuscolors), sizeof(Clr *));
for (i = 0; i < LENGTH(statuscolors); i++)
#if BAR_ALPHA_PATCH
statusscheme[i] = drw_scm_create(drw, statuscolors[i], alphas[0], ColCount);
#else
statusscheme[i] = drw_scm_create(drw, statuscolors[i], ColCount);
#endif // BAR_ALPHA_PATCH
#endif // BAR_POWERLINE_STATUS_PATCH
updatebars();
updatestatus();

@ -12,13 +12,8 @@ draw_fancybar(Bar *bar, BarDrawArg *a)
Client *c;
Monitor *m = bar->mon;
#if BAR_PANGO_PATCH
int boxs = drw->font->h / 9;
int boxw = drw->font->h / 6 + 2;
#else
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_PANGO_PATCH
#if BAR_TITLE_LEFT_PAD && BAR_TITLE_RIGHT_PAD
int x = a->x + lrpad / 2, w = a->w - lrpad;
#elif BAR_TITLE_LEFT_PAD

@ -0,0 +1,121 @@
static Clr **statusscheme;
int
width_pwrl_status(Bar *bar, BarWidthArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawstext);
#else
return widthpowerlinestatus(stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
width_pwrl_status_es(Bar *bar, BarWidthArg *a)
{
#if BAR_STATUSCMD_PATCH
return widthpowerlinestatus(rawestext);
#else
return widthpowerlinestatus(estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status(Bar *bar, BarDrawArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawstext);
#else
return drawpowerlinestatus(a->x + a->w, stext);
#endif // BAR_STATUSCMD_PATCH
}
#if BAR_EXTRASTATUS_PATCH
int
draw_pwrl_status_es(Bar *bar, BarDrawArg *a)
{
#if BAR_STATUSCMD_PATCH
return drawpowerlinestatus(a->x + a->w, rawestext);
#else
return drawpowerlinestatus(a->x + a->w, estext);
#endif // BAR_STATUSCMD_PATCH
}
#endif // BAR_EXTRASTATUS_PATCH
int
click_pwrl_status(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkStatusText;
}
int
widthpowerlinestatus(char *stext)
{
char status[512];
int w = 0, i, n = strlen(stext);
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
if (bp != '|')
w += plw;
w += TEXTW(bs+2);
bp = *bs;
*bs = 0;
}
}
if (bp != '|')
w += plw * 2;
return w;
}
int
drawpowerlinestatus(int xpos, char *stext)
{
char status[512];
int i, n = strlen(stext), cn = 0;
int x = xpos, w = 0;
int plw = drw->fonts->h / 2 + 1;
char *bs, bp = '|';
Clr *prevscheme = statusscheme[0], *nxtscheme;
strcpy(status, stext);
for (i = n, bs = &status[n-1]; i >= 0; i--, bs--) {
if (*bs == '<' || *bs == '/' || *bs == '\\' || *bs == '>' || *bs == '|') { /* block start */
cn = ((int) *(bs+1)) - 1;
if (cn < LENGTH(statuscolors)) {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[cn]));
} else {
drw_settrans(drw, prevscheme, (nxtscheme = statusscheme[0]));
}
if (bp != '|') {
drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
x -= plw;
}
drw_setscheme(drw, nxtscheme);
w = TEXTW(bs+2);
drw_text(drw, x - w, 0, w, bh, lrpad / 2, bs+2, 0);
x -= w;
bp = *bs;
*bs = 0;
prevscheme = nxtscheme;
}
}
if (bp != '|') {
drw_settrans(drw, prevscheme, scheme[SchemeNorm]);
drw_arrow(drw, x - plw, 0, plw, bh, bp == '\\' || bp == '>' ? 1 : 0, bp == '<' ? 0 : 1);
drw_rect(drw, x - 2 * plw, 0, plw, bh, 1, 1);
x -= plw * 2;
}
return xpos - x;
}

@ -0,0 +1,11 @@
static int width_pwrl_status(Bar *bar, BarWidthArg *a);
#if BAR_EXTRASTATUS_PATCH
static int width_pwrl_status_es(Bar *bar, BarWidthArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status(Bar *bar, BarDrawArg *a);
#if BAR_EXTRASTATUS_PATCH
static int draw_pwrl_status_es(Bar *bar, BarDrawArg *a);
#endif // BAR_EXTRASTATUS_PATCH
static int click_pwrl_status(Bar *bar, Arg *arg, BarClickArg *a);
static int drawpowerlinestatus(int x, char *stext);
static int widthpowerlinestatus(char *stext);

@ -0,0 +1,127 @@
int
width_pwrl_tags(Bar *bar, BarWidthArg *a)
{
int w, i;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (w = 0, i = 0; i < LENGTH(tags); i++) {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
#if BAR_ALTERNATIVE_TAGS_PATCH
w += selmon->alttag ? TEXTW(tagsalt[i]) : TEXTW(tags[i]) + plw;
#else
w += TEXTW(tags[i]) + plw;
#endif // BAR_ALTERNATIVE_TAGS_PATCH
}
return w + lrpad;
}
int
draw_pwrl_tags(Bar *bar, BarDrawArg *a)
{
int x, w;
int invert;
int plw = drw->fonts->h / 2 + 1;
unsigned int i, occ = 0, urg = 0;
Client *c;
Clr *prevscheme, *nxtscheme;
#if !BAR_HIDEVACANTTAGS_PATCH
#if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
int boxs = drw->fonts->h / 9;
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH | BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_HIDEVACANTTAGS_PATCH
for (c = bar->mon->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
occ |= c->tags == 255 ? 0 : c->tags;
#else
occ |= c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
if (c->isurgent)
urg |= c->tags;
}
x = a->x;
prevscheme = scheme[SchemeNorm];
for (i = 0; i < LENGTH(tags); i++) {
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
#if URGENTBORDER_PATCH
invert = 0;
#else
invert = urg & 1 << i;
#endif // URGENTBORDER_PATCH
w = TEXTW(tags[i]);
drw_settrans(drw, prevscheme, (nxtscheme = scheme[bar->mon->tagset[bar->mon->seltags] & 1 << i ? SchemeSel : SchemeNorm]));
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, 0, plw, bh, 1, 1);
#else
drw_arrow(drw, x, 0, plw, bh, 1, 1);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
x += plw;
drw_setscheme(drw, nxtscheme);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], invert);
#if !BAR_HIDEVACANTTAGS_PATCH
if (occ & 1 << i)
#if BAR_ACTIVETAGINDICATORBAR_PATCH
drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw,
#elif BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
drw_rect(drw, x + boxw, bh - boxw/2, w - ( 2 * boxw + 1), boxw/2,
#else
drw_rect(drw, x + boxs, boxs, boxw, boxw,
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH
bar->mon == selmon && selmon->sel && selmon->sel->tags & 1 << i, invert);
#endif // BAR_HIDEVACANTTAGS_PATCH
x += w;
prevscheme = nxtscheme;
}
nxtscheme = scheme[SchemeNorm];
drw_settrans(drw, prevscheme, nxtscheme);
#if BAR_POWERLINE_TAGS_SLASH_PATCH
drw_arrow(drw, x, 0, plw, bh, 1, 1);
#else
drw_arrow(drw, x, 0, plw, bh, 1, 0);
#endif // BAR_POWERLINE_TAGS_SLASH_PATCH
return a->x + a->w;
}
int
click_pwrl_tags(Bar *bar, Arg *arg, BarClickArg *a)
{
int i = 0, x = lrpad / 2;
int plw = drw->fonts->h / 2 + 1;
#if BAR_HIDEVACANTTAGS_PATCH
Client *c;
unsigned int occ = 0;
for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags;
#endif // BAR_HIDEVACANTTAGS_PATCH
do {
#if BAR_HIDEVACANTTAGS_PATCH
if (!(occ & 1 << i || bar->mon->tagset[bar->mon->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
#if BAR_ALTERNATIVE_TAGS_PATCH
x += selmon->alttag ? TEXTW(tagsalt[i]) : TEXTW(tags[i]) + plw;
#else
x += TEXTW(tags[i]) + plw;
#endif
} while (a->rel_x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
arg->ui = 1 << i;
}
return ClkTagBar;
}

@ -0,0 +1,3 @@
static int width_pwrl_tags(Bar *bar, BarWidthArg *a);
static int draw_pwrl_tags(Bar *bar, BarDrawArg *a);
static int click_pwrl_tags(Bar *bar, Arg *arg, BarClickArg *a);

@ -9,5 +9,5 @@ static int draw_status2d_es(Bar *bar, BarDrawArg *a);
#if !BAR_STATUSCMD_PATCH
static int click_status2d(Bar *bar, Arg *arg, BarClickArg *a);
#endif // BAR_STATUSCMD_PATCH
static int drawstatusbar(int x, char* text);
static int status2dtextlength(char* stext);
static int drawstatusbar(int x, char *text);
static int status2dtextlength(char *stext);

@ -33,17 +33,9 @@ draw_tags(Bar *bar, BarDrawArg *a)
#endif // BAR_ALTERNATIVE_TAGS_PATCH
#if !BAR_HIDEVACANTTAGS_PATCH
#if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
int boxs = drw->font->h / 9;
#else
int boxs = drw->fonts->h / 9;
#endif // BAR_PANGO_PATCH
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH | BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
int boxw = drw->font->h / 6 + 2;
#else
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_PANGO_PATCH
#endif // BAR_HIDEVACANTTAGS_PATCH
unsigned int i, occ = 0, urg = 0;
Client *c;
@ -60,16 +52,16 @@ draw_tags(Bar *bar, BarDrawArg *a)
}
for (i = 0; i < LENGTH(tags); i++) {
#if URGENTBORDER_PATCH
invert = 0;
#else
invert = urg & 1 << i;
#endif // URGENTBORDER_PATCH
#if BAR_HIDEVACANTTAGS_PATCH
/* do not draw vacant tags */
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
continue;
#endif // BAR_HIDEVACANTTAGS_PATCH
#if URGENTBORDER_PATCH
invert = 0;
#else
invert = urg & 1 << i;
#endif // URGENTBORDER_PATCH
w = TEXTW(tags[i]);
#if BAR_ALTERNATIVE_TAGS_PATCH
wdelta = selmon->alttag ? abs(TEXTW(tags[i]) - TEXTW(tagsalt[i])) / 2 : 0;

@ -8,17 +8,9 @@ int
draw_wintitle(Bar *bar, BarDrawArg *a)
{
#if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
int boxs = drw->font->h / 9;
#else
int boxs = drw->fonts->h / 9;
#endif // BAR_PANGO_PATCH
#endif // BAR_ACTIVETAGINDICATORBAR_PATCH | BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
int boxw = drw->font->h / 6 + 2;
#else
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_PANGO_PATCH
#if BAR_TITLE_LEFT_PAD && BAR_TITLE_RIGHT_PAD
int x = a->x + lrpad / 2, w = a->w - lrpad;

@ -20,6 +20,12 @@
#if BAR_LTSYMBOL_PATCH
#include "bar_ltsymbol.c"
#endif
#if BAR_POWERLINE_STATUS_PATCH
#include "bar_powerline_status.c"
#endif
#if BAR_POWERLINE_TAGS_PATCH
#include "bar_powerline_tags.c"
#endif
#if BAR_STATUS_PATCH
#include "bar_status.c"
#endif

@ -20,6 +20,12 @@
#if BAR_LTSYMBOL_PATCH
#include "bar_ltsymbol.h"
#endif
#if BAR_POWERLINE_STATUS_PATCH
#include "bar_powerline_status.h"
#endif
#if BAR_POWERLINE_TAGS_PATCH
#include "bar_powerline_tags.h"
#endif
#if BAR_STATUS_PATCH
#include "bar_status.h"
#endif

@ -39,6 +39,31 @@
/* Show layout symbol in bar */
#define BAR_LTSYMBOL_PATCH 1
/* Adds powerline arrows for the status.
* This uses statuscolors logic for choosing colors for the powerline. As these markers
* are also control characters there is no explicit statuscmd support for this patch.
*
* Powerline separators are defined as:
* |\xXX (creates a hard edge)
* <\xXX (creates a less than arrow)
* /\xXX (creates a diagonal line)
*
* Examples:
* xsetroot -name "$(echo -e '<\x01a<\x02b<\x03c')"
* xsetroot -name "$(echo -e '/\x01d/\x02d/\x03f')"
*
* https://gitlab.com/udiboy1209-suckless/dwm/-/commit/071f5063e8ac4280666828179f92788d893eea40#4b1a539194be7467cefbda22f675a3b7c19ceca7
* https://dwm.suckless.org/patches/statuscolors/
*/
#define BAR_POWERLINE_STATUS_PATCH 0
/* Adds powerline arrows for the tags.
* https://gitlab.com/udiboy1209-suckless/dwm/-/commit/071f5063e8ac4280666828179f92788d893eea40#4b1a539194be7467cefbda22f675a3b7c19ceca7
*/
#define BAR_POWERLINE_TAGS_PATCH 0
/* Alters the tags powerline to use forward slash instead of arrows */
#define BAR_POWERLINE_TAGS_SLASH_PATCH 0
/* This patch adds an option to place tags in rows like in many other window managers.
* https://dwm.suckless.org/patches/taggrid/
*/

Loading…
Cancel
Save