summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md12
-rw-r--r--config.def.h121
-rw-r--r--config.mk4
-rw-r--r--dwm.c313
-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
-rw-r--r--patches.def.h22
36 files changed, 501 insertions, 513 deletions
diff --git a/README.md b/README.md
index f1e32c2..477baed 100644
--- a/README.md
+++ b/README.md
@@ -289,8 +289,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [keymodes](https://dwm.suckless.org/patches/keymodes/)
- this patch adds key modes (like in vim or emacs) where chains of keyboard shortcuts can be performed
- - [leftlayout](http://dwm.suckless.org/patches/leftlayout/)
- - moves the layout symbol in the status bar to the left hand side
+ - [-leftlayout-](http://dwm.suckless.org/patches/leftlayout/)
+ - -moves the layout symbol in the status bar to the left hand side-
- [losefullscreen](https://github.com/bakkeby/patches/tree/master/dwm/dwm-losefullscreen-6.2.diff)
- by default in dwm it is possible to make an application fullscreen, then use the focusstack keybindings to focus on other windows beneath the current window
@@ -396,14 +396,14 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t
- [stacker](https://dwm.suckless.org/patches/stacker/)
- provides comprehensive utilities for managing the client stack
- - [staticstatus](https://dwm.suckless.org/patches/staticstatus/)
- - allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor
+ - [-staticstatus-](https://dwm.suckless.org/patches/staticstatus/)
+ - -allows the status text to be fixed to the bar on a specific monitor rather than being drawn on the focused monitor-
- [status2d](https://dwm.suckless.org/patches/status2d/)
- allows colors and rectangle drawing in the dwm status bar
- - [statusallmons](https://dwm.suckless.org/patches/statuspadding/)
- - this patch draws and updates the statusbar on all monitors
+ - [-statusallmons-](https://dwm.suckless.org/patches/statuspadding/)
+ - -this patch draws and updates the statusbar on all monitors-
- [statusbutton](https://dwm.suckless.org/patches/statusbutton/)
- adds a clickable button to the left hand side of the statusbar
diff --git a/config.def.h b/config.def.h
index 7e91c43..f7e2238 100644
--- a/config.def.h
+++ b/config.def.h
@@ -39,25 +39,18 @@ static int floatposgrid_y = 5; /* float grid rows */
static const int horizpadbar = 2; /* horizontal padding for statusbar */
static const int vertpadbar = 0; /* vertical padding for statusbar */
#endif // BAR_STATUSPADDING_PATCH
-#if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
-static const int statmonval = 0;
-#endif // BAR_STATICSTATUS_PATCH
-#if STATUSBUTTON_PATCH
+#if BAR_STATUSBUTTON_PATCH
static const char buttonbar[] = "<O>";
-#endif // STATUSBUTTON_PATCH
-#if SYSTRAY_PATCH
+#endif // BAR_STATUSBUTTON_PATCH
+#if BAR_SYSTRAY_PATCH
static const unsigned int systrayspacing = 2; /* systray spacing */
static const int showsystray = 1; /* 0 means no systray */
-#endif // SYSTRAY_PATCH
+#endif // BAR_SYSTRAY_PATCH
#if ONLYQUITONEMPTY_PATCH
static const int quit_empty_window_count = 2; /* only allow dwm to quit if no windows are open, value here represents number of deamons */
#endif // ONLYQUITONEMPTY_PATCH
#if BAR_EXTRABAR_PATCH
static const char statussep = ';'; /* separator between status bars */
-static const int ebalign = 0; /* extrabar alignment: 0 - left, 1 - right, 2 - center */
-#if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
-static const int statebmonval = statmonval;
-#endif // BAR_STATICSTATUS_PATCH
#endif // BAR_EXTRABAR_PATCH
#if BAR_PANGO_PATCH
static const char font[] = "monospace 10";
@@ -101,14 +94,14 @@ static char urgfloatcolor[] = "#000000";
#endif // FLOAT_BORDER_COLOR_PATCH
#endif // URGENTBORDER_PATCH // BAR_STATUSCOLORS_PATCH
-#if AWESOMEBAR_PATCH
+#if BAR_AWESOMEBAR_PATCH
static char hidfgcolor[] = "#005577";
static char hidbgcolor[] = "#222222";
static char hidbordercolor[] = "#005577";
#if FLOAT_BORDER_COLOR_PATCH
static char hidfloatcolor[] = "#f76e0c";
#endif // FLOAT_BORDER_COLOR_PATCH
-#endif // AWESOMEBAR_PATCH
+#endif // BAR_AWESOMEBAR_PATCH
#if BAR_TITLECOLOR_PATCH
static char titlefgcolor[] = "#eeeeee";
@@ -133,9 +126,9 @@ static const unsigned int alphas[][3] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { OPAQUE, baralpha, borderalpha },
#endif // URGENTBORDER_PATCH / BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { OPAQUE, baralpha, borderalpha },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
#if BAR_VTCOLORS_PATCH
[SchemeTagsNorm] = { OPAQUE, baralpha, borderalpha },
[SchemeTagsSel] = { OPAQUE, baralpha, borderalpha },
@@ -160,9 +153,9 @@ static const int color_ptrs[][ColCount] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { 7, 9, 9, 15 },
#endif // URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { 5, 0, 0, -1 },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
[SchemeTagsNorm] = { 2, 0, 0, -1 },
[SchemeTagsSel] = { 6, 5, 5, -1 },
[SchemeTitleNorm] = { 6, -1, -1, -1 },
@@ -179,9 +172,9 @@ static char colors[][ColCount][8] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { "#000000", "#000000", "#000000", "#000000" },
#endif // URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { "#000000", "#000000", "#000000", "#000000" },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
[SchemeTagsNorm] = { "#000000", "#000000", "#000000", "#000000" },
[SchemeTagsSel] = { "#000000", "#000000", "#000000", "#000000" },
[SchemeTitleNorm] = { "#000000", "#000000", "#000000", "#000000" },
@@ -201,9 +194,9 @@ static const int color_ptrs[][ColCount] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { 7, 9, 9 },
#endif // URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { 5, 0, 0 },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
[SchemeTagsNorm] = { 2, 0, 0 },
[SchemeTagsSel] = { 6, 5, 5 },
[SchemeTitleNorm] = { 6, -1, -1 },
@@ -220,9 +213,9 @@ static char colors[][ColCount][8] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { "#000000", "#000000", "#000000" },
#endif // URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { "#000000", "#000000", "#000000" },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
[SchemeTagsNorm] = { "#000000", "#000000", "#000000" },
[SchemeTagsSel] = { "#000000", "#000000", "#000000" },
[SchemeTitleNorm] = { "#000000", "#000000", "#000000" },
@@ -244,9 +237,9 @@ char *colors[][ColCount] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor },
#endif // URGENTBORDER_PATCH / BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { hidfgcolor, hidbgcolor, hidbordercolor, hidfloatcolor },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
#if BAR_TITLECOLOR_PATCH
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor, titlefloatcolor },
#endif // BAR_TITLECOLOR_PATCH
@@ -266,9 +259,9 @@ char *colors[][ColCount] = {
#if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH
[SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor },
#endif // URGENTBORDER_PATCH / BAR_STATUSCOLORS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
[SchemeHid] = { hidfgcolor, hidbgcolor, hidbordercolor },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
#if BAR_TITLECOLOR_PATCH
[SchemeTitle] = { titlefgcolor, titlebgcolor, titlebordercolor },
#endif // BAR_TITLECOLOR_PATCH
@@ -297,7 +290,7 @@ static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
#endif // BAR_ALTERNATIVE_TAGS_PATCH
-#if TAGGRID_PATCH
+#if BAR_TAGGRID_PATCH
/* grid of tags */
#define DRAWCLASSICTAGS 1 << 0
#define DRAWTAGGRID 1 << 1
@@ -313,7 +306,7 @@ static const char *tagsalt[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const unsigned int drawtagmask = DRAWTAGGRID; /* | DRAWCLASSICTAGS to show classic row of tags */
static const int tagrows = 2;
-#endif // TAGGRID_PATCH
+#endif // BAR_TAGGRID_PATCH
/* There are two options when it comes to per-client rules:
* - a typical struct table or
@@ -369,6 +362,62 @@ static const MonitorRule monrules[] = {
#endif // PERTAG_PATCH
#endif // MONITOR_RULES_PATCH
+/* Bar rules allow you to configure what is shown where on the bar, as well as
+ * introducing your own bar modules.
+ *
+ * monitor:
+ * -1 show on all monitors
+ * 0 show on monitor 0
+ * 'A' show on active monitor (i.e. focused / selected) (or just -1 for active?)
+ * bar - bar index, 0 is default, 1 is extrabar
+ * alignment - how the module is aligned compared to other modules
+ * widthfunc, drawfunc, clickfunc - providing bar module width, draw and click functions
+ * name - does nothing, intended for visual clue and for logging / debugging
+ */
+static const BarRule barrules[] = {
+ /* monitor bar alignment widthfunc drawfunc clickfunc name */
+ #if BAR_STATUSBUTTON_PATCH
+ { -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" },
+ #endif // BAR_STATUSBUTTON_PATCH
+ #if BAR_TAGS_PATCH
+ { -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" },
+ #endif // BAR_TAGGRID_PATCH
+ #if BAR_LTSYMBOL_PATCH
+ { -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" },
+ #endif // BAR_SYSTRAY_PATCH
+ #if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
+ { '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" },
+ #elif BAR_STATUS_PATCH
+ { '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" },
+ #elif BAR_FANCYBAR_PATCH
+ { -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" },
+ #endif // BAR_AWESOMEBAR_PATCH | BAR_FANCYBAR_PATCH BAR_WINTITLE_PATCH
+ #if BAR_EXTRABAR_PATCH
+ #if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH
+ { 'A', 1, BAR_ALIGN_CENTER, width_status2d_eb, draw_status2d_eb, click_statuscmd_eb, "status2d_eb" },
+ #elif BAR_STATUS2D_PATCH
+ { 'A', 1, BAR_ALIGN_CENTER, width_status2d_eb, draw_status2d_eb, click_status2d, "status2d_eb" },
+ #elif BAR_STATUSCMD_PATCH
+ { 'A', 1, BAR_ALIGN_CENTER, width_status_eb, draw_status_eb, click_statuscmd_eb, "status_eb" },
+ #elif BAR_STATUS_PATCH
+ { 'A', 1, BAR_ALIGN_CENTER, width_status_eb, draw_status_eb, click_status, "status_eb" },
+ #endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH
+ #endif // BAR_EXTRABAR_PATCH
+};
+
#if DWMC_PATCH
/* signal definitions */
/* signum must be greater than 0 */
@@ -465,9 +514,9 @@ static Signal signals[] = {
#if SELFRESTART_PATCH
{ "self_restart", self_restart },
#endif // SELFRESTART_PATCH
- #if TAGGRID_PATCH
+ #if BAR_TAGGRID_PATCH
{ "switchtag", switchtag },
- #endif // TAGGRID_PATCH
+ #endif // BAR_TAGGRID_PATCH
#if STICKY_PATCH
{ "togglesticky", togglesticky },
#endif // STICKY_PATCH
@@ -547,7 +596,7 @@ static const int nmaster = 1; /* number of clients in master area */
#if FLEXTILE_DELUXE_LAYOUT
static const int nstack = 0; /* number of clients in primary stack area */
#endif // FLEXTILE_DELUXE_LAYOUT
-static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
+static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
#if NROWGRID_LAYOUT
#define FORCE_VSPLIT 1
@@ -872,9 +921,9 @@ static Key keys[] = {
{ MODKEY|Mod4Mask, XK_Tab, shiftviewclients, { .i = -1 } },
{ MODKEY|Mod4Mask, XK_backslash, shiftviewclients, { .i = +1 } },
#endif // SHIFTVIEW_CLIENTS_PATCH
- #if AWESOMEBAR_PATCH
+ #if BAR_AWESOMEBAR_PATCH
{ MODKEY|ControlMask, XK_z, showhideclient, {0} },
- #endif // AWESOMEBAR_PATCH
+ #endif // BAR_AWESOMEBAR_PATCH
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
#if KILLUNSEL_PATCH
{ MODKEY|ShiftMask, XK_x, killunsel, {0} },
@@ -996,7 +1045,7 @@ static Key keys[] = {
#if BAR_ALTERNATIVE_TAGS_PATCH
{ MODKEY, XK_n, togglealttag, {0} },
#endif // BAR_ALTERNATIVE_TAGS_PATCH
- #if TAGGRID_PATCH
+ #if BAR_TAGGRID_PATCH
{ MODKEY|ControlMask, XK_Up, switchtag, { .ui = SWITCHTAG_UP | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_VIEW } },
{ MODKEY|ControlMask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_VIEW } },
@@ -1005,7 +1054,7 @@ static Key keys[] = {
{ MODKEY|Mod4Mask, XK_Down, switchtag, { .ui = SWITCHTAG_DOWN | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Right, switchtag, { .ui = SWITCHTAG_RIGHT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
{ MODKEY|Mod4Mask, XK_Left, switchtag, { .ui = SWITCHTAG_LEFT | SWITCHTAG_TAG | SWITCHTAG_VIEW } },
- #endif // TAGGRID_PATCH
+ #endif // BAR_TAGGRID_PATCH
#if MOVEPLACE_PATCH
{ MODKEY, XK_KP_7, moveplace, {.ui = WIN_NW }}, /* XK_KP_Home, */
{ MODKEY, XK_KP_8, moveplace, {.ui = WIN_N }}, /* XK_KP_Up, */
diff --git a/config.mk b/config.mk
index e92e380..8694c43 100644
--- a/config.mk
+++ b/config.mk
@@ -21,7 +21,7 @@ FREETYPEINC = /usr/include/freetype2
#FREETYPEINC = ${X11INC}/freetype2
# Uncomment this for the alpha patch / BAR_ALPHA_PATCH
-#XRENDER = -lXrender
+XRENDER = -lXrender
# Uncomment this for the mdpcontrol patch / MDPCONTROL_PATCH
#MPDCLIENT = -lmpdclient
@@ -34,7 +34,7 @@ FREETYPEINC = /usr/include/freetype2
#XEXTLIB = -lXext
# Uncomment this for the swallow patch / SWALLOW_PATCH
-#XCBLIBS = -lX11-xcb -lxcb -lxcb-res
+XCBLIBS = -lX11-xcb -lxcb -lxcb-res
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC} ${PANGOINC}
diff --git a/dwm.c b/dwm.c
index 7828403..1e0d51d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -198,15 +198,17 @@ typedef union {
const void *v;
} Arg;
+typedef struct Monitor Monitor;
typedef struct Bar Bar;
struct Bar {
Window win;
+ Monitor *mon;
+ int idx;
int bx, by, bw, bh; /* bar geometry */
int w[BARRULES]; // width, array length == barrules, then use r index for lookup purposes
int x[BARRULES]; // x position, array length == ^
};
-
typedef struct {
int max_width;
} BarWidthArg;
@@ -223,14 +225,13 @@ typedef struct {
int rel_h;
} BarClickArg;
-typedef struct Monitor Monitor;
typedef struct {
int monitor;
int bar;
int alignment; // see bar alignment enum
- int (*widthfunc)(Monitor *m, BarWidthArg *a);
- int (*drawfunc)(Monitor *m, BarDrawArg *a);
- int (*clickfunc)(Monitor *m, Arg *arg, BarClickArg *a);
+ int (*widthfunc)(Bar *bar, BarWidthArg *a);
+ int (*drawfunc)(Bar *bar, BarDrawArg *a);
+ int (*clickfunc)(Bar *bar, Arg *arg, BarClickArg *a);
char *name; // for debugging
int x, w; // position, width for internal use
} BarRule;
@@ -465,6 +466,7 @@ static void detachstack(Client *c);
static Monitor *dirtomon(int dir);
static void drawbar(Monitor *m);
static void drawbars(void);
+static void drawbarwin(Bar *bar);
#if !FOCUSONCLICK_PATCH
static void enternotify(XEvent *e);
#endif // FOCUSONCLICK_PATCH
@@ -631,12 +633,6 @@ static Clr **scheme;
static Display *dpy;
static Drw *drw;
static Monitor *mons, *selmon;
-#if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
-static Monitor *statmon;
-#if BAR_EXTRABAR_PATCH
-static Monitor *statebmon;
-#endif // BAR_EXTRABAR_PATCH
-#endif // BAR_STATICSTATUS_PATCH
static Window root, wmcheckwin;
/* configuration, allows nested code to access above variables */
@@ -907,14 +903,16 @@ buttonpress(XEvent *e)
if (ev->window == selmon->bars[b]->win) {
for (r = 0; r < LENGTH(barrules); r++) {
br = &barrules[r];
- if (br->bar != b || (br->monitor == 'A' && m != selmon) || (br->monitor != -1 && br->monitor != mi) || br->clickfunc == NULL)
+ if (br->bar != b || (br->monitor == 'A' && m != selmon) || br->clickfunc == NULL)
+ continue;
+ if (br->monitor != 'A' && br->monitor != -1 && br->monitor != mi)
continue;
if (selmon->bars[b]->x[r] <= ev->x && ev->x <= selmon->bars[b]->x[r] + selmon->bars[b]->w[r]) {
carg.rel_x = ev->x - selmon->bars[b]->x[r];
carg.rel_y = ev->y;
carg.rel_w = selmon->bars[b]->w[r];
carg.rel_h = selmon->bars[b]->bh;
- click = br->clickfunc(m, &arg, &carg);
+ click = br->clickfunc(selmon->bars[b], &arg, &carg);
if (click < 0)
return;
break;
@@ -1049,7 +1047,11 @@ clientmessage(XEvent *e)
return;
}
+ #if BAR_SYSTRAY_WIN_PATCH
+ c->mon = selmon;
+ #else
c->mon = systray->mon;
+ #endif // BAR_SYSTRAY_WIN_PATCH
c->next = systray->icons;
systray->icons = c;
XGetWindowAttributes(dpy, c->win, &wa);
@@ -1243,8 +1245,8 @@ createmon(void)
Monitor *m;
int i;
#if MONITOR_RULES_PATCH
- int mc, j;
- Monitor *mi;
+ int mi, j;
+ Monitor *mon;
const MonitorRule *mr;
#endif // MONITOR_RULES_PATCH
@@ -1270,17 +1272,23 @@ createmon(void)
m->gappoh = gappoh;
m->gappov = gappov;
#endif // VANITYGAPS_PATCH
- for (i = 0; i < LENGTH(m->bars); i++)
+
+ for (i = 0; i < LENGTH(m->bars); i++) {
+ fprintf(stderr, "creating bar, idx = %d\n", i);
m->bars[i] = ecalloc(1, sizeof(Bar));
+ m->bars[i]->mon = m;
+ m->bars[i]->idx = i;
+ fprintf(stderr, "%s\n", "finished creating bar");
+ }
// for (r = 0; r < LENGTH(barrules); r++) {
// for (b = 0; b < LENGTH(selmon->bars); b++) {
#if MONITOR_RULES_PATCH
- for (mc = 0, mi = mons; mi; mi = mi->next, mc++);
+ for (mi = 0, mon = mons; mon; mon = mon->next, mi++); // monitor index
for (j = 0; j < LENGTH(monrules); j++) {
mr = &monrules[j];
- if ((mr->monitor == -1 || mr->monitor == mc)
+ if ((mr->monitor == -1 || mr->monitor == mi)
#if PERTAG_PATCH
&& (mr->tag == -1 || mr->tag == 0)
#endif // PERTAG_PATCH
@@ -1343,7 +1351,7 @@ createmon(void)
#if MONITOR_RULES_PATCH
for (j = 0; j < LENGTH(monrules); j++) {
mr = &monrules[j];
- if ((mr->monitor == -1 || mr->monitor == mc) && (mr->tag == -1 || mr->tag == i)) {
+ if ((mr->monitor == -1 || mr->monitor == mi) && (mr->tag == -1 || mr->tag == i)) {
m->pertag->ltidxs[i][0] = &layouts[mr->layout];
m->pertag->ltidxs[i][1] = m->lt[0];
m->pertag->nmasters[i] = (mr->nmaster > -1 ? mr->nmaster : m->nmaster);
@@ -1396,7 +1404,7 @@ destroynotify(XEvent *e)
#if BAR_SYSTRAY_PATCH
else if (showsystray && (c = wintosystrayicon(ev->window))) {
removesystrayicon(c);
- updatesystray();
+ drawbarwin(systray->bar);
}
#endif // BAR_SYSTRAY_PATCH
}
@@ -1442,123 +1450,122 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
+ for (int b = 0; b < LENGTH(m->bars); b++)
+ drawbarwin(m->bars[b]);
+}
+
+void
+drawbars(void)
+{
+ Monitor *m;
+ for (m = mons; m; m = m->next)
+ drawbar(m);
+}
+
+void
+drawbarwin(Bar *bar)
+{
+ if (!bar->win)
+ return;
Monitor *mon;
- int b, r, w, mi;
+ int r, w, mi;
int rx, lx, rw, lw; // bar size, split between left and right if a center module is added
const BarRule *br;
- Bar *bar;
BarWidthArg warg = { 0 };
BarDrawArg darg = { 0, 0 };
- for (mi = 0, mon = mons; mon && mon != m; mon = mon->next, mi++); // get the monitor index
- for (b = LENGTH(m->bars) - 1; b >= 0; b--) {
- bar = m->bars[b];
- if (!bar->win)
- continue;
-
- rw = lw = bar->bw;
- rx = lx = 0;
+ for (mi = 0, mon = mons; mon && mon != bar->mon; mon = mon->next, mi++); // get the monitor index
+ rw = lw = bar->bw;
+ rx = lx = 0;
+ #if BAR_VTCOLORS_PATCH
+ drw_setscheme(drw, scheme[SchemeTagsNorm]);
+ #else
+ drw_setscheme(drw, scheme[SchemeNorm]);
+ #endif // BAR_VTCOLORS_PATCH
+ drw_rect(drw, lx, 0, lw, bh, 1, 1);
+ for (r = 0; r < LENGTH(barrules); r++) {
+ br = &barrules[r];
+ if (br->bar != bar->idx || br->drawfunc == NULL || (br->monitor == 'A' && bar->mon != selmon))
+ continue;
+ if (br->monitor != 'A' && br->monitor != -1 && br->monitor != mi)
+ continue;
#if BAR_VTCOLORS_PATCH
drw_setscheme(drw, scheme[SchemeTagsNorm]);
#else
drw_setscheme(drw, scheme[SchemeNorm]);
#endif // BAR_VTCOLORS_PATCH
- drw_rect(drw, lx, 0, lw, bh, 1, 1);
- for (r = 0; r < LENGTH(barrules); r++) {
- br = &barrules[r];
- if (br->bar != b || (br->monitor == 'A' && m != selmon) || (br->monitor != -1 && br->monitor != mi) || br->drawfunc == NULL)
- continue;
- #if BAR_VTCOLORS_PATCH
- drw_setscheme(drw, scheme[SchemeTagsNorm]);
- #else
- drw_setscheme(drw, scheme[SchemeNorm]);
- #endif // BAR_VTCOLORS_PATCH
- warg.max_width = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw);
- w = br->widthfunc(m, &warg);
- w = MIN(warg.max_width, w);
-
- if (lw <= 0) { // if left is exhausted, switch to right side
- lw = rw;
- lx = rx;
- } else if (rw <= 0) {
- rw = lw;
- rx = lx;
- }
+ warg.max_width = (br->alignment < BAR_ALIGN_RIGHT_LEFT ? lw : rw);
+ w = br->widthfunc(bar, &warg);
+ w = MIN(warg.max_width, w);
+
+ if (lw <= 0) { // if left is exhausted, switch to right side
+ lw = rw;
+ lx = rx;
+ } else if (rw <= 0) {
+ rw = lw;
+ rx = lx;
+ }
- switch(br->alignment) {
- default:
- case BAR_ALIGN_NONE:
- case BAR_ALIGN_LEFT_LEFT:
- case BAR_ALIGN_LEFT:
- bar->x[r] = lx;
- bar->w[r] = w;
- if (lx == rx) {
- rx += w;
- rw -= w;
- }
- lx += w;
- lw -= w;
- break;
- case BAR_ALIGN_LEFT_RIGHT:
- case BAR_ALIGN_RIGHT:
- bar->x[r] = lx + lw - w;
- bar->w[r] = w;
- if (lx == rx)
- rw -= w;
- lw -= w;
- break;
- case BAR_ALIGN_LEFT_CENTER:
- case BAR_ALIGN_CENTER:
- bar->x[r] = lx + lw / 2 - w / 2;
- bar->w[r] = w;
- if (lx == rx) {
- rw = rx + rw - bar->x[r] - bar->w[r];
- rx = bar->x[r] + bar->w[r];
- }
- lw = bar->x[r] - lx;
- break;
- case BAR_ALIGN_RIGHT_LEFT:
- bar->x[r] = rx;
- bar->w[r] = w;
- if (lx == rx) {
- lx += w;
- lw -= w;
- }
+ switch(br->alignment) {
+ default:
+ case BAR_ALIGN_NONE:
+ case BAR_ALIGN_LEFT_LEFT:
+ case BAR_ALIGN_LEFT:
+ bar->x[r] = lx;
+ if (lx == rx) {
rx += w;
rw -= w;
- break;
- case BAR_ALIGN_RIGHT_RIGHT:
- bar->x[r] = rx + rw - w;
- bar->w[r] = w;
- if (lx == rx)
- lw -= w;
+ }
+ lx += w;
+ lw -= w;
+ break;
+ case BAR_ALIGN_LEFT_RIGHT:
+ case BAR_ALIGN_RIGHT:
+ bar->x[r] = lx + lw - w;
+ if (lx == rx)
rw -= w;
- break;
- case BAR_ALIGN_RIGHT_CENTER:
- bar->x[r] = rx + rw / 2 - w / 2;
- bar->w[r] = w;
- if (lx == rx) {
- lw = lx + lw - bar->x[r] + bar->w[r];
- lx = bar->x[r] + bar->w[r];
- }
- rw = bar->x[r] - rx;
- break;
+ lw -= w;
+ break;
+ case BAR_ALIGN_LEFT_CENTER:
+ case BAR_ALIGN_CENTER:
+ bar->x[r] = lx + lw / 2 - w / 2;
+ if (lx == rx) {
+ rw = rx + rw - bar->x[r] - w;
+ rx = bar->x[r] + w;
+ }
+ lw = bar->x[r] - lx;
+ break;
+ case BAR_ALIGN_RIGHT_LEFT:
+ bar->x[r] = rx;
+ if (lx == rx) {
+ lx += w;
+ lw -= w;
}
- darg.x = bar->x[r];
- darg.w = bar->w[r];
- br->drawfunc(m, &darg);
+ rx += w;
+ rw -= w;
+ break;
+ case BAR_ALIGN_RIGHT_RIGHT:
+ bar->x[r] = rx + rw - w;
+ if (lx == rx)
+ lw -= w;
+ rw -= w;
+ break;
+ case BAR_ALIGN_RIGHT_CENTER:
+ bar->x[r] = rx + rw / 2 - w / 2;
+ if (lx == rx) {
+ lw = lx + lw - bar->x[r] + w;
+ lx = bar->x[r] + w;
+ }
+ rw = bar->x[r] - rx;
+ break;
}
- drw_map(drw, bar->win, 0, 0, bar->bw, bar->bh);
+ bar->w[r] = w;
+ darg.x = bar->x[r];
+ darg.w = bar->w[r];
+ br->drawfunc(bar, &darg);
}
-}
-
-void
-drawbars(void)
-{
- Monitor *m;
- for (m = mons; m; m = m->next)
- drawbar(m);
+ drw_map(drw, bar->win, 0, 0, bar->bw, bar->bh);
}
#if !FOCUSONCLICK_PATCH
@@ -2060,7 +2067,7 @@ maprequest(XEvent *e)
Client *i;
if (showsystray && (i = wintosystrayicon(ev->window))) {
sendevent(i->win, netatom[Xembed], StructureNotifyMask, CurrentTime, XEMBED_WINDOW_ACTIVATE, 0, systray->win, XEMBED_EMBEDDED_VERSION);
- updatesystray();
+ drawbarwin(systray->bar);
}
#endif // BAR_SYSTRAY_PATCH
@@ -2209,7 +2216,7 @@ propertynotify(XEvent *e)
}
else
updatesystrayiconstate(c, ev);
- updatesystray();
+ drawbarwin(systray->bar);
}
#endif // BAR_SYSTRAY_PATCH
@@ -2235,11 +2242,8 @@ propertynotify(XEvent *e)
break;
case XA_WM_HINTS:
updatewmhints(c);
- drawbars();
- #if URGENTBORDER_PATCH
if (c->isurgent)
- XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColBorder].pixel);
- #endif // URGENTBORDER_PATCH
+ drawbars();
break;
}
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
@@ -3413,7 +3417,7 @@ unmapnotify(XEvent *e)
* _not_ destroy them. We map those windows back */
XMapRaised(dpy, c->win);
removesystrayicon(c);
- updatesystray();
+ drawbarwin(systray->bar);
#endif // BAR_SYSTRAY_PATCH
}
}
@@ -3534,14 +3538,6 @@ updategeom(void)
mons = createmon();
}
for (i = 0, m = mons; i < nn && m; m = m->next, i++) {
- #if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
- if (i == statmonval)
- statmon = m;
- #if BAR_EXTRABAR_PATCH
- if (i == statebmonval)
- statebmon = m;
- #endif // BAR_EXTRABAR_PATCH
- #endif // BAR_STATICSTATUS_PATCH
if (i >= n
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|| unique[i].width != m->mw || unique[i].height != m->mh)
@@ -3568,14 +3564,6 @@ updategeom(void)
}
if (m == selmon)
selmon = mons;
- #if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
- if (m == statmon)
- statmon = mons;
- #if BAR_EXTRABAR_PATCH
- if (m == statebmon)
- statebmon = mons;
- #endif // BAR_EXTRABAR_PATCH
- #endif // BAR_STATICSTATUS_PATCH
cleanupmon(m);
}
}
@@ -3592,14 +3580,6 @@ updategeom(void)
updatebarpos(mons);
}
}
- #if BAR_STATICSTATUS_PATCH && !BAR_STATUSALLMONS_PATCH
- if (!statmon)
- statmon = mons;
- #if BAR_EXTRABAR_PATCH
- if (!statebmon)
- statebmon = mons;
- #endif // BAR_EXTRABAR_PATCH
- #endif // BAR_STATICSTATUS_PATCH
if (dirty) {
selmon = mons;
selmon = wintomon(root);
@@ -3683,9 +3663,7 @@ updatesizehints(Client *c)
void
updatestatus(void)
{
- #if BAR_STATUSALLMONS_PATCH
- Monitor* m;
- #endif // BAR_STATUSALLMONS_PATCH
+ Monitor *m;
#if BAR_EXTRABAR_PATCH
if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) {
strcpy(stext, "dwm-"VERSION);
@@ -3718,18 +3696,8 @@ updatestatus(void)
if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext)))
strcpy(stext, "dwm-"VERSION);
#endif // BAR_EXTRABAR_PATCH
- #if BAR_STATUSALLMONS_PATCH
for (m = mons; m; m = m->next)
drawbar(m);
- #elif BAR_STATICSTATUS_PATCH
- drawbar(statmon);
- #if BAR_EXTRABAR_PATCH
- if (statmon != statebmon)
- drawbar(statebmon);
- #endif // BAR_EXTRABAR_PATCH
- #else
- drawbar(selmon);
- #endif // BAR_STATUSALLMONS_PATCH | BAR_STATICSTATUS_PATCH
}
void
@@ -3750,19 +3718,18 @@ updatewmhints(Client *c)
if (c == selmon->sel && wmh->flags & XUrgencyHint) {
wmh->flags &= ~XUrgencyHint;
XSetWMHints(dpy, c->win, wmh);
- } else {
+ } else
c->isurgent = (wmh->flags & XUrgencyHint) ? 1 : 0;
- #if URGENTBORDER_PATCH
- if (c->isurgent) {
- #if FLOAT_BORDER_COLOR_PATCH
- if (c->isfloating)
- XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColFloat].pixel);
- else
- #endif
- XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColBorder].pixel);
- }
- #endif // URGENTBORDER_PATCH
+ #if URGENTBORDER_PATCH
+ if (c->isurgent) {
+ #if FLOAT_BORDER_COLOR_PATCH
+ if (c->isfloating)
+ XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColFloat].pixel);
+ else
+ #endif
+ XSetWindowBorder(dpy, c->win, scheme[SchemeUrg][ColBorder].pixel);
}
+ #endif // URGENTBORDER_PATCH
if (wmh->flags & InputHint)
c->neverfocus = !wmh->input;
else
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
diff --git a/patches.def.h b/patches.def.h
index a95e26e..537e042 100644
--- a/patches.def.h
+++ b/patches.def.h
@@ -79,6 +79,14 @@
/* Show window title in bar */
#define BAR_WINTITLE_PATCH 1
+/* Title bar modules such as wintitle (default), fancybar and awesomebar
+ * do not by default add left and/or right padding as they take up the
+ * remaining space. These options allow you explicitly add padding should
+ * you need it.
+ */
+#define BAR_TITLE_RIGHT_PAD 0
+#define BAR_TITLE_LEFT_PAD 1
+
/**
* Bar options
*/
@@ -191,20 +199,6 @@
*/
#define BAR_PANGO_PATCH 0
-/* This patch allows the status text to be fixed to the bar on a specific
- * monitor rather than being drawn on the focused monitor.
- * The statusallmons patch takes precedence over this patch.
- * NB: If used together with the systray patch then consider setting
- * systraypinning to statmonval+1.
- * https://dwm.suckless.org/patches/staticstatus/
- */
-#define BAR_STATICSTATUS_PATCH 0
-
-/* This patch draws and updates the statusbar on all monitors.
- * https://dwm.suckless.org/patches/statusallmons/
- */
-#define BAR_STATUSALLMONS_PATCH 0
-
/* This patch enables colored text in the status bar. It changes the way colors are defined
* in config.h allowing multiple color combinations for use in the status script.
* This patch is incompatible with and takes precedence over the status2d patch.