summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch')
-rw-r--r--patch/bar_alpha.c2
-rw-r--r--patch/bar_awesomebar.c37
-rw-r--r--patch/bar_awesomebar.h6
-rw-r--r--patch/bar_fancybar.c46
-rw-r--r--patch/bar_fancybar.h6
-rw-r--r--patch/bar_ltsymbol.c12
-rw-r--r--patch/bar_ltsymbol.h6
-rw-r--r--patch/bar_status.c14
-rw-r--r--patch/bar_status.h6
-rw-r--r--patch/bar_status2d.c18
-rw-r--r--patch/bar_status2d.h12
-rw-r--r--patch/bar_status2d_eb.c6
-rw-r--r--patch/bar_status2d_eb.h4
-rw-r--r--patch/bar_status_eb.c19
-rw-r--r--patch/bar_status_eb.h2
-rw-r--r--patch/bar_statusbutton.c6
-rw-r--r--patch/bar_statusbutton.h6
-rw-r--r--patch/bar_statuscmd.c10
-rw-r--r--patch/bar_statuscmd.h6
-rw-r--r--patch/bar_systray.c149
-rw-r--r--patch/bar_systray.h9
-rw-r--r--patch/bar_taggrid.c35
-rw-r--r--patch/bar_taggrid.h6
-rw-r--r--patch/bar_tags.c13
-rw-r--r--patch/bar_tags.h6
-rw-r--r--patch/bar_wintitle.c16
-rw-r--r--patch/bar_wintitle.h6
-rw-r--r--patch/include.c3
-rw-r--r--patch/include.h3
-rw-r--r--patch/vtcolors.c70
-rw-r--r--patch/vtcolors.h2
31 files changed, 260 insertions, 282 deletions
diff --git a/patch/bar_alpha.c b/patch/bar_alpha.c
index 7da7215..d86bc1d 100644
--- a/patch/bar_alpha.c
+++ b/patch/bar_alpha.c
@@ -34,7 +34,7 @@ xinitvisual()
XFree(infos);
- if (! visual) {
+ if (!visual) {
visual = DefaultVisual(dpy, screen);
depth = DefaultDepth(dpy, screen);
cmap = DefaultColormap(dpy, screen);
diff --git a/patch/bar_awesomebar.c b/patch/bar_awesomebar.c
index ddea5ea..446b547 100644
--- a/patch/bar_awesomebar.c
+++ b/patch/bar_awesomebar.c
@@ -1,26 +1,36 @@
int
-width_awesomebar(Monitor *m, BarWidthArg *a)
+width_awesomebar(Bar *bar, BarWidthArg *a)
{
return a->max_width;
}
int
-draw_awesomebar(Monitor *m, BarDrawArg *a)
+draw_awesomebar(Bar *bar, BarDrawArg *a)
{
int n = 0, scm, remainder = 0, tabw;
- unsigned int i, x = a->x;
+ unsigned int i;
+ #if BAR_TITLE_LEFT_PAD && BAR_TITLE_RIGHT_PAD
+ int x = a->x + lrpad / 2, w = a->w - lrpad;
+ #elif BAR_TITLE_LEFT_PAD
+ int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
+ #elif BAR_TITLE_RIGHT_PAD
+ int x = a->x, w = a->w - lrpad / 2;
+ #else
+ int x = a->x, w = a->w;
+ #endif // BAR_TITLE_LEFT_PAD | BAR_TITLE_RIGHT_PAD
+
Client *c;
- for (c = m->clients; c; c = c->next)
+ for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
if (n > 0) {
- remainder = a->w % n;
- tabw = a->w / n;
- for (i = 0, c = m->clients; c; c = c->next, i++) {
+ remainder = w % n;
+ tabw = w / n;
+ for (i = 0, c = bar->mon->clients; c; c = c->next, i++) {
if (!ISVISIBLE(c))
continue;
- if (m->sel == c)
+ if (bar->mon->sel == c)
#if BAR_VTCOLORS_PATCH
scm = SchemeTitleSel;
#elif BAR_TITLECOLOR_PATCH
@@ -38,10 +48,11 @@ draw_awesomebar(Monitor *m, BarDrawArg *a)
#endif // BAR_VTCOLORS_PATCH
drw_setscheme(drw, scheme[scm]);
+ tabw += (i < remainder ? 1 : 0);
#if BAR_PANGO_PATCH
- drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0, False);
+ drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0, False);
#else
- drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, lrpad / 2, c->name, 0);
+ drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0);
#endif // BAR_PANGO_PATCH
x += tabw;
}
@@ -50,16 +61,16 @@ draw_awesomebar(Monitor *m, BarDrawArg *a)
}
int
-click_awesomebar(Monitor *m, Arg *arg, BarClickArg *a)
+click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a)
{
int x = 0, n = 0;
Client *c;
- for (c = m->clients; c; c = c->next)
+ for (c = bar->mon->clients; c; c = c->next)
if (ISVISIBLE(c))
n++;
- c = m->clients;
+ c = bar->mon->clients;
do {
if (!c || !ISVISIBLE(c))
diff --git a/patch/bar_awesomebar.h b/patch/bar_awesomebar.h
index 8e9387b..a99986e 100644
--- a/patch/bar_awesomebar.h
+++ b/patch/bar_awesomebar.h
@@ -1,6 +1,6 @@
-static int width_awesomebar(Monitor *m, BarWidthArg *a);
-static int draw_awesomebar(Monitor *m, BarDrawArg *a);
-static int click_awesomebar(Monitor *m, Arg *arg, BarClickArg *a);
+static int width_awesomebar(Bar *bar, BarWidthArg *a);
+static int draw_awesomebar(Bar *bar, BarDrawArg *a);
+static int click_awesomebar(Bar *bar, Arg *arg, BarClickArg *a);
static void hide(Client *c);
static void show(Client *c);
diff --git a/patch/bar_fancybar.c b/patch/bar_fancybar.c
index 810c73e..a193876 100644
--- a/patch/bar_fancybar.c
+++ b/patch/bar_fancybar.c
@@ -1,29 +1,33 @@
int
-width_fancybar(Monitor *m, BarWidthArg *a)
+width_fancybar(Bar *bar, BarWidthArg *a)
{
return a->max_width;
}
int
-draw_fancybar(Monitor *m, BarDrawArg *a)
+draw_fancybar(Bar *bar, BarDrawArg *a)
{
- int ftw, mw, ew = 0, n = 0, x = a->x, w = a->w;
+ int ftw, mw, ew = 0, n = 0;
unsigned int i;
Client *c;
- #if !BAR_HIDEVACANTTAGS_PATCH
- #if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
+ Monitor *m = bar->mon;
+
#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 boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
#endif // BAR_PANGO_PATCH
- #endif // BAR_HIDEVACANTTAGS_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
+ int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
+ #elif BAR_TITLE_RIGHT_PAD
+ int x = a->x, w = a->w - lrpad / 2;
+ #else
+ int x = a->x, w = a->w;
+ #endif // BAR_TITLE_LEFT_PAD | BAR_TITLE_RIGHT_PAD
for (c = m->clients; c; c = c->next) {
if (ISVISIBLE(c))
@@ -31,10 +35,11 @@ draw_fancybar(Monitor *m, BarDrawArg *a)
}
if (n > 0) {
- ftw = TEXTW(m->sel->name) + lrpad;
+ ftw = TEXTW(m->sel->name);
mw = (ftw >= w || n == 1) ? 0 : (w - ftw) / (n - 1);
i = 0;
+
for (c = m->clients; c; c = c->next) {
if (!ISVISIBLE(c) || c == m->sel)
continue;
@@ -44,6 +49,7 @@ draw_fancybar(Monitor *m, BarDrawArg *a)
else
i++;
}
+
if (i > 0)
mw += ew / i;
@@ -65,31 +71,17 @@ draw_fancybar(Monitor *m, BarDrawArg *a)
#else
drw_text(drw, x, 0, ftw, bh, lrpad / 2, c->name, 0);
#endif // BAR_PANGO_PATCH
- #if !BAR_HIDEVACANTTAGS_PATCH
if (c->isfloating)
- #if BAR_ACTIVETAGINDICATORBAR_PATCH
- drw_rect(drw, x + boxw, 0, w - ( 2 * boxw + 1), boxw, c->isfixed, 0);
- #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, c->isfixed, 0);
- #endif // BAR_ACTIVETAGINDICATORBAR_PATCH
- #endif // BAR_HIDEVACANTTAGS_PATCH
x += ftw;
w -= ftw;
}
}
- #if BAR_VTCOLORS_PATCH
- drw_setscheme(drw, scheme[SchemeTitleNorm]);
- #else
- drw_setscheme(drw, scheme[SchemeNorm]);
- #endif // BAR_VTCOLORS_PATCH
- drw_rect(drw, x, 0, w, bh, 1, 1);
return x + w;
}
int
-click_fancybar(Monitor *m, Arg *arg, BarClickArg *a)
+click_fancybar(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkWinTitle;
}
diff --git a/patch/bar_fancybar.h b/patch/bar_fancybar.h
index b7b2875..c90d189 100644
--- a/patch/bar_fancybar.h
+++ b/patch/bar_fancybar.h
@@ -1,3 +1,3 @@
-static int width_fancybar(Monitor *m, BarWidthArg *a);
-static int draw_fancybar(Monitor *m, BarDrawArg *a);
-static int click_fancybar(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
+static int width_fancybar(Bar *bar, BarWidthArg *a);
+static int draw_fancybar(Bar *bar, BarDrawArg *a);
+static int click_fancybar(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_ltsymbol.c b/patch/bar_ltsymbol.c
index c3a7baf..65ce2da 100644
--- a/patch/bar_ltsymbol.c
+++ b/patch/bar_ltsymbol.c
@@ -1,21 +1,21 @@
int
-width_ltsymbol(Monitor *m, BarWidthArg *a)
+width_ltsymbol(Bar *bar, BarWidthArg *a)
{
- return TEXTW(m->ltsymbol);
+ return TEXTW(bar->mon->ltsymbol);
}
int
-draw_ltsymbol(Monitor *m, BarDrawArg *a)
+draw_ltsymbol(Bar *bar, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
- return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, m->ltsymbol, 0, False);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0, False);
#else
- return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, m->ltsymbol, 0);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, bar->mon->ltsymbol, 0);
#endif // BAR_PANGO_PATCH
}
int
-click_ltsymbol(Monitor *m, Arg *arg, BarClickArg *a)
+click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkLtSymbol;
} \ No newline at end of file
diff --git a/patch/bar_ltsymbol.h b/patch/bar_ltsymbol.h
index 40f5c55..d9c79bf 100644
--- a/patch/bar_ltsymbol.h
+++ b/patch/bar_ltsymbol.h
@@ -1,3 +1,3 @@
-static int width_ltsymbol(Monitor *m, BarWidthArg *a);
-static int draw_ltsymbol(Monitor *m, BarDrawArg *a);
-static int click_ltsymbol(Monitor *m, Arg *arg, BarClickArg *a);
+static int width_ltsymbol(Bar *bar, BarWidthArg *a);
+static int draw_ltsymbol(Bar *bar, BarDrawArg *a);
+static int click_ltsymbol(Bar *bar, Arg *arg, BarClickArg *a);
diff --git a/patch/bar_status.c b/patch/bar_status.c
index 2d7283b..9c3aafe 100644
--- a/patch/bar_status.c
+++ b/patch/bar_status.c
@@ -1,25 +1,25 @@
int
-width_status(Monitor *m, BarWidthArg *a)
+width_status(Bar *bar, BarWidthArg *a)
{
#if BAR_PANGO_PATCH
- return TEXTWM(stext) - lrpad + 2; /* 2px right padding */
+ return TEXTWM(stext);
#else
- return TEXTW(stext) - lrpad + 2; /* 2px right padding */
+ return TEXTW(stext);
#endif // BAR_PANGO_PATCH
}
int
-draw_status(Monitor *m, BarDrawArg *a)
+draw_status(Bar *bar, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
- return drw_text(drw, a->x, 0, a->w, bh, 0, stext, 0, True);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0, True);
#else
- return drw_text(drw, a->x, 0, a->w, bh, 0, stext, 0);
+ return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, stext, 0);
#endif // BAR_PANGO_PATCH
}
int
-click_status(Monitor *m, Arg *arg, BarClickArg *a)
+click_status(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkStatusText;
}
diff --git a/patch/bar_status.h b/patch/bar_status.h
index 97cf8b8..bd169d9 100644
--- a/patch/bar_status.h
+++ b/patch/bar_status.h
@@ -1,3 +1,3 @@
-static int width_status(Monitor *m, BarWidthArg *a);
-static int draw_status(Monitor *m, BarDrawArg *a);
-static int click_status(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
+static int width_status(Bar *bar, BarWidthArg *a);
+static int draw_status(Bar *bar, BarDrawArg *a);
+static int click_status(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_status2d.c b/patch/bar_status2d.c
index 0adaadd..c4c7689 100644
--- a/patch/bar_status2d.c
+++ b/patch/bar_status2d.c
@@ -1,25 +1,25 @@
int
-width_status2d(Monitor *m, BarWidthArg *a)
+width_status2d(Bar *bar, BarWidthArg *a)
{
- return status2dtextlength(rawstext);
+ return status2dtextlength(rawstext) + lrpad;
}
int
-draw_status2d(Monitor *m, BarDrawArg *a)
+draw_status2d(Bar *bar, BarDrawArg *a)
{
- return drawstatusbar(m, a->x, a->w, rawstext);
+ return drawstatusbar(a->x, rawstext);
}
-#if !BAR_DWMBLOCKS_PATCH
+#if !BAR_STATUSCMD_PATCH
int
-click_status2d(Monitor *m, Arg *arg, BarClickArg *a)
+click_status2d(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkStatusText;
}
-#endif // BAR_DWMBLOCKS_PATCH
+#endif // BAR_STATUSCMD_PATCH
int
-drawstatusbar(Monitor *m, int x, int ow, char* stext)
+drawstatusbar(int x, char* stext)
{
int i, w, len;
short isCode = 0;
@@ -36,6 +36,8 @@ drawstatusbar(Monitor *m, int x, int ow, char* stext)
memcpy(text, stext, len);
#endif // BAR_STATUSCMD_PATCH
+ x += lrpad / 2;
+
/* process status text */
i = -1;
while (text[++i]) {
diff --git a/patch/bar_status2d.h b/patch/bar_status2d.h
index fa9fbeb..555b093 100644
--- a/patch/bar_status2d.h
+++ b/patch/bar_status2d.h
@@ -1,7 +1,7 @@
-static int width_status2d(Monitor *m, BarWidthArg *a);
-static int draw_status2d(Monitor *m, BarDrawArg *a);
-#if !BAR_DWMBLOCKS_PATCH
-static int click_status2d(Monitor *m, Arg *arg, BarClickArg *a);
-#endif // BAR_DWMBLOCKS_PATCH
-static int drawstatusbar(Monitor *m, int x, int w, char* text);
+static int width_status2d(Bar *bar, BarWidthArg *a);
+static int draw_status2d(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); \ No newline at end of file
diff --git a/patch/bar_status2d_eb.c b/patch/bar_status2d_eb.c
index 3e98866..5d67b88 100644
--- a/patch/bar_status2d_eb.c
+++ b/patch/bar_status2d_eb.c
@@ -1,11 +1,11 @@
int
-width_status2d_eb(Monitor *m, BarWidthArg *a)
+width_status2d_eb(Bar *bar, BarWidthArg *a)
{
return status2dtextlength(rawestext);
}
int
-draw_status2d_eb(Monitor *m, BarDrawArg *a)
+draw_status2d_eb(Bar *bar, BarDrawArg *a)
{
- return drawstatusbar(m, a->x, a->w, rawestext);
+ return drawstatusbar(a->x, rawestext);
} \ No newline at end of file
diff --git a/patch/bar_status2d_eb.h b/patch/bar_status2d_eb.h
index 2a43537..a20f8d5 100644
--- a/patch/bar_status2d_eb.h
+++ b/patch/bar_status2d_eb.h
@@ -1,2 +1,2 @@
-static int width_status2d_eb(Monitor *m, BarWidthArg *a);
-static int draw_status2d_eb(Monitor *m, BarDrawArg *a); \ No newline at end of file
+static int width_status2d_eb(Bar *bar, BarWidthArg *a);
+static int draw_status2d_eb(Bar *bar, BarDrawArg *a); \ No newline at end of file
diff --git a/patch/bar_status_eb.c b/patch/bar_status_eb.c
new file mode 100644
index 0000000..71944b4
--- /dev/null
+++ b/patch/bar_status_eb.c
@@ -0,0 +1,19 @@
+int
+width_status_eb(Bar *bar, BarWidthArg *a)
+{
+ #if BAR_PANGO_PATCH
+ return TEXTWM(estext) - lrpad;
+ #else
+ return TEXTW(estext) - lrpad;
+ #endif // BAR_PANGO_PATCH
+}
+
+int
+draw_status_eb(Bar *bar, BarDrawArg *a)
+{
+ #if BAR_PANGO_PATCH
+ return drw_text(drw, a->x, 0, a->w, bh, 0, estext, 0, True);
+ #else
+ return drw_text(drw, a->x, 0, a->w, bh, 0, estext, 0);
+ #endif // BAR_PANGO_PATCH
+} \ No newline at end of file
diff --git a/patch/bar_status_eb.h b/patch/bar_status_eb.h
new file mode 100644
index 0000000..c2ec004
--- /dev/null
+++ b/patch/bar_status_eb.h
@@ -0,0 +1,2 @@
+static int width_status_eb(Bar *bar, BarWidthArg *a);
+static int draw_status_eb(Bar *bar, BarDrawArg *a); \ No newline at end of file
diff --git a/patch/bar_statusbutton.c b/patch/bar_statusbutton.c
index 5f60b76..f5c9c9d 100644
--- a/patch/bar_statusbutton.c
+++ b/patch/bar_statusbutton.c
@@ -1,11 +1,11 @@
int
-width_stbutton(Monitor *m, BarWidthArg *a)
+width_stbutton(Bar *bar, BarWidthArg *a)
{
return TEXTW(buttonbar);
}
int
-draw_stbutton(Monitor *m, BarDrawArg *a)
+draw_stbutton(Bar *bar, BarDrawArg *a)
{
#if BAR_PANGO_PATCH
return drw_text(drw, a->x, 0, a->w, bh, lrpad / 2, buttonbar, 0, False);
@@ -15,7 +15,7 @@ draw_stbutton(Monitor *m, BarDrawArg *a)
}
int
-click_stbutton(Monitor *m, Arg *arg, BarClickArg *a)
+click_stbutton(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkButton;
}
diff --git a/patch/bar_statusbutton.h b/patch/bar_statusbutton.h
index 47055ad..8e9d6fe 100644
--- a/patch/bar_statusbutton.h
+++ b/patch/bar_statusbutton.h
@@ -1,3 +1,3 @@
-static int width_stbutton(Monitor *m, BarWidthArg *a);
-static int draw_stbutton(Monitor *m, BarDrawArg *a);
-static int click_stbutton(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
+static int width_stbutton(Bar *bar, BarWidthArg *a);
+static int draw_stbutton(Bar *bar, BarDrawArg *a);
+static int click_stbutton(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_statuscmd.c b/patch/bar_statuscmd.c
index 14b4076..5825647 100644
--- a/patch/bar_statuscmd.c
+++ b/patch/bar_statuscmd.c
@@ -5,21 +5,21 @@ static int lastbutton;
#endif // BAR_DWMBLOCKS_PATCH
int
-click_statuscmd(Monitor *m, Arg *arg, BarClickArg *a)
+click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a)
{
- return click_statuscmd_text(m, arg, a->rel_x, rawstext);
+ return click_statuscmd_text(arg, a->rel_x, rawstext);
}
#if BAR_EXTRABAR_PATCH
int
-click_statuscmd_eb(Monitor *m, Arg *arg, BarClickArg *a)
+click_statuscmd_eb(Bar *bar, Arg *arg, BarClickArg *a)
{
- return click_statuscmd_text(m, arg, a->rel_x, rawestext);
+ return click_statuscmd_text(arg, a->rel_x, rawestext);
}
#endif // BAR_EXTRABAR_PATCH
int
-click_statuscmd_text(Monitor *m, Arg *arg, int rel_x, char *text)
+click_statuscmd_text(Arg *arg, int rel_x, char *text)
{
int i = -1;
int x = 0;
diff --git a/patch/bar_statuscmd.h b/patch/bar_statuscmd.h
index 7619ec3..bcbcb33 100644
--- a/patch/bar_statuscmd.h
+++ b/patch/bar_statuscmd.h
@@ -1,6 +1,6 @@
-static int click_statuscmd(Monitor *m, Arg *arg, BarClickArg *a);
+static int click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a);
#if BAR_EXTRABAR_PATCH
-static int click_statuscmd_eb(Monitor *m, Arg *arg, BarClickArg *a);
+static int click_statuscmd_eb(Bar *bar, Arg *arg, BarClickArg *a);
#endif // BAR_EXTRABAR_PATCH
-static int click_statuscmd_text(Monitor *m, Arg *arg, int rel_x, char *text);
+static int click_statuscmd_text(Arg *arg, int rel_x, char *text);
static void copyvalidchars(char *text, char *rawtext); \ No newline at end of file
diff --git a/patch/bar_systray.c b/patch/bar_systray.c
index e9df765..0ff730d 100644
--- a/patch/bar_systray.c
+++ b/patch/bar_systray.c
@@ -1,11 +1,8 @@
static Systray *systray = NULL;
static unsigned long systrayorientation = _NET_SYSTEM_TRAY_ORIENTATION_HORZ;
-static int systraybaridx = -1;
-static int systraybarrule = -1;
-static int systrayxpos = 0;
int
-width_systray(Monitor *m, BarWidthArg *a)
+width_systray(Bar *bar, BarWidthArg *a)
{
unsigned int w = 0;
Client *i;
@@ -13,87 +10,40 @@ width_systray(Monitor *m, BarWidthArg *a)
return 1;
if (showsystray)
for (i = systray->icons; i; w += i->w + systrayspacing, i = i->next);
- return w ? w + systrayspacing : 0;
+ return w ? w + lrpad - systrayspacing : 0;
}
int
-draw_systray(Monitor *m, BarDrawArg *a)
-{
- systrayxpos = a->x;
- updatesystray();
- return systrayxpos + a->w;
-}
-
-int
-click_systray(Monitor *m, Arg *arg, BarClickArg *a)
-{
- return -1;
-}
-
-void
-removesystrayicon(Client *i)
-{
- Client **ii;
-
- if (!showsystray || !i)
- return;
- for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
- if (ii)
- *ii = i->next;
- free(i);
-}
-
-void
-resizerequest(XEvent *e)
-{
- XResizeRequestEvent *ev = &e->xresizerequest;
- Client *i;
-
- if ((i = wintosystrayicon(ev->window))) {
- updatesystrayicongeom(i, ev->width, ev->height);
- updatesystray();
- }
-}
-
-void
-updatesystray(void)
+draw_systray(Bar *bar, BarDrawArg *a)
{
if (!showsystray)
- return;
+ return a->x;
+
XSetWindowAttributes wa;
Client *i;
- Monitor *m;
- unsigned int w = 1, r, mi;
- const BarRule *br;
+ unsigned int w;
if (!systray) {
/* init systray */
if (!(systray = (Systray *)calloc(1, sizeof(Systray))))
die("fatal: could not malloc() %u bytes\n", sizeof(Systray));
- /* Work out which bar the systray is to be displayed on */
- for (r = 0; r < LENGTH(barrules); r++) {
- br = &barrules[r];
- if (br->drawfunc == &draw_systray) {
- systraybaridx = br->bar;
- systraybarrule = r;
- if (br->monitor == -1 || br->monitor == 'A')
- m = selmon;
- else
- for (m = mons, mi = 0; m && mi < br->monitor && m->next; m = m->next, mi++);
- systray->win = m->bars[systraybaridx]->win;
- systray->mon = m;
-
- break;
- }
- }
- if (systraybaridx == -1) {
- fprintf(stderr, "dwm: unable to obtain system tray, no draw_systray in bar rules.\n");
- free(systray);
- systray = NULL;
- return;
- }
+ wa.override_redirect = True;
+ wa.event_mask = ButtonPressMask|ExposureMask;
+ wa.border_pixel = 0;
+ #if BAR_ALPHA_PATCH
+ wa.background_pixel = 0;
+ wa.colormap = cmap;
+ systray->win = XCreateWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by, MAX(a->w + 40, 1), bar->bh, 0, depth,
+ InputOutput, visual,
+ CWOverrideRedirect|CWBorderPixel|CWBackPixel|CWColormap|CWEventMask, &wa); // CWBackPixmap
+ #else
+ wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ systray->win = XCreateSimpleWindow(dpy, root, bar->bx + a->x + lrpad / 2, bar->by, MIN(a->w, 1), bar->bh, 0, 0, scheme[SchemeNorm][ColBg].pixel);
+ XChangeWindowAttributes(dpy, systray->win, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &wa);
+ #endif // BAR_ALPHA_PATCH
+ XSelectInput(dpy, systray->win, SubstructureNotifyMask);
XChangeProperty(dpy, systray->win, netatom[NetSystemTrayOrientation], XA_CARDINAL, 32,
PropModeReplace, (unsigned char *)&systrayorientation, 1);
#if BAR_ALPHA_PATCH
@@ -111,21 +61,63 @@ updatesystray(void)
fprintf(stderr, "dwm: unable to obtain system tray.\n");
free(systray);
systray = NULL;
- return;
+ return a->x;
}
}
+ systray->bar = bar;
+
+ drw_setscheme(drw, scheme[SchemeNorm]);
for (w = 0, i = systray->icons; i; i = i->next) {
- /* make sure the background color stays the same */
+ #if BAR_ALPHA_PATCH
+ wa.background_pixel = 0;
+ #else
wa.background_pixel = scheme[SchemeNorm][ColBg].pixel;
+ #endif // BAR_ALPHA_PATCH
XChangeWindowAttributes(dpy, i->win, CWBackPixel, &wa);
XMapRaised(dpy, i->win);
- w += systrayspacing;
- i->x = systrayxpos + w;
+ i->x = w;
XMoveResizeWindow(dpy, i->win, i->x, 0, i->w, i->h);
w += i->w;
- if (i->mon != systray->mon)
- i->mon = systray->mon;
+ if (i->next)
+ w += systrayspacing;
+ if (i->mon != bar->mon)
+ i->mon = bar->mon;
+ }
+
+ XMoveResizeWindow(dpy, systray->win, bar->bx + a->x + lrpad / 2, (w ? bar->by : -bar->by), MAX(w, 1), bar->bh);
+ return a->x + a->w;
+}
+
+int
+click_systray(Bar *bar, Arg *arg, BarClickArg *a)
+{
+ return -1;
+}
+
+void
+removesystrayicon(Client *i)
+{
+ Client **ii;
+
+ if (!showsystray || !i)
+ return;
+ for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
+ if (ii)
+ *ii = i->next;
+ free(i);
+ drawbarwin(systray->bar);
+}
+
+void
+resizerequest(XEvent *e)
+{
+ XResizeRequestEvent *ev = &e->xresizerequest;
+ Client *i;
+
+ if ((i = wintosystrayicon(ev->window))) {
+ updatesystrayicongeom(i, ev->width, ev->height);
+ drawbarwin(systray->bar);
}
}
@@ -185,8 +177,9 @@ updatesystrayiconstate(Client *i, XPropertyEvent *ev)
Client *
wintosystrayicon(Window w)
{
+ if (!systray)
+ return NULL;
Client *i = NULL;
-
if (!showsystray || !w)
return i;
for (i = systray->icons; i && i->win != w; i = i->next);
diff --git a/patch/bar_systray.h b/patch/bar_systray.h
index 5c4f387..5123a73 100644
--- a/patch/bar_systray.h
+++ b/patch/bar_systray.h
@@ -22,19 +22,18 @@ typedef struct Systray Systray;
struct Systray {
Window win;
Client *icons;
- Monitor *mon;
+ Bar *bar;
};
/* bar integration */
-static int width_systray(Monitor *m, BarWidthArg *a);
-static int draw_systray(Monitor *m, BarDrawArg *a);
-static int click_systray(Monitor *m, Arg *arg, BarClickArg *a);
+static int width_systray(Bar *bar, BarWidthArg *a);
+static int draw_systray(Bar *bar, BarDrawArg *a);
+static int click_systray(Bar *bar, Arg *arg, BarClickArg *a);
/* function declarations */
static Atom getatomprop(Client *c, Atom prop);
static void removesystrayicon(Client *i);
static void resizerequest(XEvent *e);
-static void updatesystray(void);
static void updatesystrayicongeom(Client *i, int w, int h);
static void updatesystrayiconstate(Client *i, XPropertyEvent *ev);
static Client *wintosystrayicon(Window w);
diff --git a/patch/bar_taggrid.c b/patch/bar_taggrid.c
index 71379ba..dd439f7 100644
--- a/patch/bar_taggrid.c
+++ b/patch/bar_taggrid.c
@@ -1,43 +1,58 @@
int
-width_taggrid(Monitor *m, BarWidthArg *a)
+width_taggrid(Bar *bar, BarWidthArg *a)
{
- return (bh / 2) * (LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0));
+ return (bh / 2) * (LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0)) + lrpad;
}
int
-draw_taggrid(Monitor *m, BarDrawArg *a)
+draw_taggrid(Bar *bar, BarDrawArg *a)
{
- unsigned int x, y, h, max_x, columns, occ = 0;
+ unsigned int x, y, h, max_x = 0, columns, occ = 0;
int invert, i,j, k;
Client *c;
- for (c = m->clients; c; c = c->next)
+ for (c = bar->mon->clients; c; c = c->next)
occ |= c->tags;
+ max_x = x = a->x + lrpad / 2;
h = bh / tagrows;
- x = max_x = a->x;
y = 0;
columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0);
/* Firstly we will fill the borders of squares */
+ #if BAR_VTCOLORS_PATCH
+ XSetForeground(drw->dpy, drw->gc, scheme[SchemeTagsNorm][ColBg].pixel);
+ #else
+ XSetForeground(drw->dpy, drw->gc, scheme[SchemeNorm][ColBg].pixel);
+ #endif // BAR_VTCOLORS_PATCH
XFillRectangle(dpy, drw->drawable, drw->gc, x, y, h*columns + 1, bh);
/* We will draw LENGTH(tags) squares in tagraws raws. */
for (j = 0, i = 0; j < tagrows; j++) {
- x = a->x;
+ x = a->x + lrpad / 2;
for (k = 0; k < columns; k++, i++) {
if (i < LENGTH(tags)) {
- invert = m->tagset[m->seltags] & 1 << i ? 0 : 1;
+ invert = bar->mon->tagset[bar->mon->seltags] & 1 << i ? 0 : 1;
/* Select active color for current square */
+ #if BAR_VTCOLORS_PATCH
+ XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColBg].pixel :
+ scheme[SchemeTagsNorm][ColFg].pixel);
+ #else
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeSel][ColBg].pixel :
scheme[SchemeNorm][ColFg].pixel);
+ #endif // BAR_VTCOLORS_PATCH
XFillRectangle(dpy, drw->drawable, drw->gc, x+1, y+1, h-1, h-1);
/* Mark square if tag has client */
if (occ & 1 << i) {
+ #if BAR_VTCOLORS_PATCH
+ XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeTagsSel][ColFg].pixel :
+ scheme[SchemeTagsNorm][ColBg].pixel);
+ #else
XSetForeground(drw->dpy, drw->gc, !invert ? scheme[SchemeSel][ColFg].pixel :
scheme[SchemeNorm][ColBg].pixel);
+ #endif // BAR_VTCOLORS_PATCH
XFillRectangle(dpy, drw->drawable, drw->gc, x + 1, y + 1,
h / 2, h / 2);
}
@@ -60,12 +75,12 @@ draw_taggrid(Monitor *m, BarDrawArg *a)
}
int
-click_taggrid(Monitor *m, Arg *arg, BarClickArg *a)
+click_taggrid(Bar *bar, Arg *arg, BarClickArg *a)
{
unsigned int i, columns;
columns = LENGTH(tags) / tagrows + ((LENGTH(tags) % tagrows > 0) ? 1 : 0);
- i = (a->rel_x - 0) / (bh / tagrows) + columns * (a->rel_y / (bh / tagrows));
+ i = (a->rel_x - lrpad / 2) / (bh / tagrows) + columns * (a->rel_y / (bh / tagrows));
if (i >= LENGTH(tags)) {
i = LENGTH(tags) - 1;
}
diff --git a/patch/bar_taggrid.h b/patch/bar_taggrid.h
index d284a07..c35b337 100644
--- a/patch/bar_taggrid.h
+++ b/patch/bar_taggrid.h
@@ -1,4 +1,4 @@
-static int width_taggrid(Monitor *m, BarWidthArg *a);
-static int draw_taggrid(Monitor *m, BarDrawArg *a);
-static int click_taggrid(Monitor *m, Arg *arg, BarClickArg *a);
+static int width_taggrid(Bar *bar, BarWidthArg *a);
+static int draw_taggrid(Bar *bar, BarDrawArg *a);
+static int click_taggrid(Bar *bar, Arg *arg, BarClickArg *a);
static void switchtag(const Arg *arg); \ No newline at end of file
diff --git a/patch/bar_tags.c b/patch/bar_tags.c
index 708e61d..1296853 100644
--- a/patch/bar_tags.c
+++ b/patch/bar_tags.c
@@ -1,5 +1,5 @@
int
-width_tags(Monitor *m, BarWidthArg *a)
+width_tags(Bar *bar, BarWidthArg *a)
{
int w, i;
for (w = 0, i = 0; i < LENGTH(tags); i++) {
@@ -9,14 +9,14 @@ width_tags(Monitor *m, BarWidthArg *a)
w += TEXTW(tags[i]);
#endif // BAR_ALTERNATIVE_TAGS_PATCH
}
- return w;
+ return w + lrpad;
}
int
-draw_tags(Monitor *m, BarDrawArg *a)
+draw_tags(Bar *bar, BarDrawArg *a)
{
int invert;
- int w, x = a->x;
+ int w, x = a->x + lrpad / 2;
#if BAR_ALTERNATIVE_TAGS_PATCH
int wdelta;
#endif // BAR_ALTERNATIVE_TAGS_PATCH
@@ -36,6 +36,7 @@ draw_tags(Monitor *m, BarDrawArg *a)
#endif // BAR_HIDEVACANTTAGS_PATCH
unsigned int i, occ = 0, urg = 0;
Client *c;
+ Monitor *m = bar->mon;
for (c = m->clients; c; c = c->next) {
#if BAR_HIDEVACANTTAGS_PATCH
@@ -107,9 +108,9 @@ draw_tags(Monitor *m, BarDrawArg *a)
}
int
-click_tags(Monitor *m, Arg *arg, BarClickArg *a)
+click_tags(Bar *bar, Arg *arg, BarClickArg *a)
{
- int i = 0, x = 0;
+ int i = 0, x = lrpad / 2;
do
#if BAR_ALTERNATIVE_TAGS_PATCH
x += selmon->alttag ? TEXTW(tagsalt[i]) : TEXTW(tags[i]);
diff --git a/patch/bar_tags.h b/patch/bar_tags.h
index 9961f1a..033130e 100644
--- a/patch/bar_tags.h
+++ b/patch/bar_tags.h
@@ -1,3 +1,3 @@
-static int width_tags(Monitor *m, BarWidthArg *a);
-static int draw_tags(Monitor *m, BarDrawArg *a);
-static int click_tags(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
+static int width_tags(Bar *bar, BarWidthArg *a);
+static int draw_tags(Bar *bar, BarDrawArg *a);
+static int click_tags(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/bar_wintitle.c b/patch/bar_wintitle.c
index 36889c1..70c42ce 100644
--- a/patch/bar_wintitle.c
+++ b/patch/bar_wintitle.c
@@ -1,11 +1,11 @@
int
-width_wintitle(Monitor *m, BarWidthArg *a)
+width_wintitle(Bar *bar, BarWidthArg *a)
{
return a->max_width;
}
int
-draw_wintitle(Monitor *m, BarDrawArg *a)
+draw_wintitle(Bar *bar, BarDrawArg *a)
{
#if !BAR_ACTIVETAGINDICATORBAR_PATCH && !BAR_ACTIVETAGINDICATORBAR_ALT1_PATCH
#if BAR_PANGO_PATCH
@@ -19,7 +19,17 @@ draw_wintitle(Monitor *m, BarDrawArg *a)
#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;
+ #elif BAR_TITLE_LEFT_PAD
+ int x = a->x + lrpad / 2, w = a->w - lrpad / 2;
+ #elif BAR_TITLE_RIGHT_PAD
+ int x = a->x, w = a->w - lrpad / 2;
+ #else
int x = a->x, w = a->w;
+ #endif // BAR_TITLE_LEFT_PAD | BAR_TITLE_RIGHT_PAD
+ Monitor *m = bar->mon;
if (m->sel) {
#if BAR_VTCOLORS_PATCH
@@ -70,7 +80,7 @@ draw_wintitle(Monitor *m, BarDrawArg *a)
}
int
-click_wintitle(Monitor *m, Arg *arg, BarClickArg *a)
+click_wintitle(Bar *bar, Arg *arg, BarClickArg *a)
{
return ClkWinTitle;
}
diff --git a/patch/bar_wintitle.h b/patch/bar_wintitle.h
index d79affe..6d055a6 100644
--- a/patch/bar_wintitle.h
+++ b/patch/bar_wintitle.h
@@ -1,3 +1,3 @@
-static int width_wintitle(Monitor *m, BarWidthArg *a);
-static int draw_wintitle(Monitor *m, BarDrawArg *a);
-static int click_wintitle(Monitor *m, Arg *arg, BarClickArg *a); \ No newline at end of file
+static int width_wintitle(Bar *bar, BarWidthArg *a);
+static int draw_wintitle(Bar *bar, BarDrawArg *a);
+static int click_wintitle(Bar *bar, Arg *arg, BarClickArg *a); \ No newline at end of file
diff --git a/patch/include.c b/patch/include.c
index e35033e..7fe397f 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -19,6 +19,9 @@
#endif
#if BAR_STATUS_PATCH
#include "bar_status.c"
+#if BAR_EXTRABAR_PATCH
+#include "bar_status_eb.c"
+#endif // BAR_EXTRABAR_PATCH
#endif
#if BAR_STATUS2D_PATCH
#include "bar_status2d.c"
diff --git a/patch/include.h b/patch/include.h
index 9065c87..6e08d0e 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -19,6 +19,9 @@
#endif
#if BAR_STATUS_PATCH
#include "bar_status.h"
+#if BAR_EXTRABAR_PATCH
+#include "bar_status_eb.h"
+#endif // BAR_EXTRABAR_PATCH
#endif
#if BAR_STATUS2D_PATCH
#include "bar_status2d.h"
diff --git a/patch/vtcolors.c b/patch/vtcolors.c
deleted file mode 100644
index 349970f..0000000
--- a/patch/vtcolors.c
+++ /dev/null
@@ -1,70 +0,0 @@
-void
-get_vt_colors(void)
-{
- char *cfs[3] = {
- "/sys/module/vt/parameters/default_red",
- "/sys/module/vt/parameters/default_grn",
- "/sys/module/vt/parameters/default_blu",
- };
- char vtcs[16][8];
- char tk[] = ",";
- char cl[64];
- char *tp = NULL;
- FILE *fp;
- size_t r;
- int i, c, n;
-
- for (i = 0; i < 16; i++)
- strcpy(vtcs[i], "#000000");
-
- for (i = 0, r = 0; i < 3; i++) {
- if ((fp = fopen(cfs[i], "r")) == NULL)
- continue;
- while ((cl[r] = fgetc(fp)) != EOF && cl[r] != '\n')
- r++;
- cl[r] = '\0';
- for (c = 0, tp = cl, n = 0; c < 16; c++, tp++) {
- if ((r = strcspn(tp, tk)) == -1)
- break;
- for (n = 0; r && *tp >= 48 && *tp < 58; r--, tp++)
- n = n * 10 - 48 + *tp;
- vtcs[c][i * 2 + 1] = n / 16 < 10 ? n / 16 + 48 : n / 16 + 87;
- vtcs[c][i * 2 + 2] = n % 16 < 10 ? n % 16 + 48 : n % 16 + 87;
- }
- fclose(fp);
- }
- for (i = 0; i < LENGTH(colors); i++) {
- #if FLOAT_BORDER_COLOR_PATCH
- for (c = 0; c < 4; c++)
- #else
- for (c = 0; c < 3; c++)
- #endif // FLOAT_BORDER_COLOR_PATCH
- {
- n = color_ptrs[i][c];
- if (n > -1 && strlen(colors[i][c]) >= strlen(vtcs[n]))
- memcpy(colors[i][c], vtcs[n], 7);
- }
- }
-}
-
-int get_luminance(char *r)
-{
- char *c = r;
- int n[3] = {0};
- int i = 0;
-
- while (*c) {
- if (*c >= 48 && *c < 58)
- n[i / 2] = n[i / 2] * 16 - 48 + *c;
- else if (*c >= 65 && *c < 71)
- n[i / 2] = n[i / 2] * 16 - 55 + *c;
- else if (*c >= 97 && *c < 103)
- n[i / 2] = n[i / 2] * 16 - 87 + *c;
- else
- i--;
- i++;
- c++;
- }
-
- return (0.299 * n[0] + 0.587 * n[1] + 0.114 * n[2]) / 2.55;
-} \ No newline at end of file
diff --git a/patch/vtcolors.h b/patch/vtcolors.h
deleted file mode 100644
index 7341e6a..0000000
--- a/patch/vtcolors.h
+++ /dev/null
@@ -1,2 +0,0 @@
-static void get_vt_colors(void);
-static int get_luminance(char *rgb); \ No newline at end of file