From 6961418d636985d96c0c3248752e642b0ec4c84b Mon Sep 17 00:00:00 2001 From: bakkeby Date: Sat, 18 Jul 2020 21:12:30 +0200 Subject: [PATCH] Extrabar --> extrastatus --- config.def.h | 16 ++++++++-------- dwm.c | 12 ++++++------ patch/bar_status.c | 24 ++++++++++++++++++++++++ patch/bar_status.h | 6 ++++++ patch/bar_status2d.c | 16 ++++++++++++++++ patch/bar_status2d.h | 6 ++++++ patch/bar_status2d_eb.c | 11 ----------- patch/bar_status_eb.c | 19 ------------------- patch/bar_status_eb.h | 2 -- patch/bar_statuscmd.c | 6 +++--- patch/bar_statuscmd.h | 6 +++--- patch/include.c | 6 ------ patch/include.h | 6 ------ patches.def.h | 8 ++++---- 14 files changed, 76 insertions(+), 68 deletions(-) delete mode 100644 patch/bar_status2d_eb.c delete mode 100644 patch/bar_status_eb.c delete mode 100644 patch/bar_status_eb.h diff --git a/config.def.h b/config.def.h index f7e2238..d957986 100644 --- a/config.def.h +++ b/config.def.h @@ -49,9 +49,9 @@ static const int showsystray = 1; /* 0 means no systray */ #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 +#if BAR_EXTRASTATUS_PATCH static const char statussep = ';'; /* separator between status bars */ -#endif // BAR_EXTRABAR_PATCH +#endif // BAR_EXTRASTATUS_PATCH #if BAR_PANGO_PATCH static const char font[] = "monospace 10"; #else @@ -405,17 +405,17 @@ static const BarRule barrules[] = { #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_EXTRASTATUS_PATCH #if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status2d_eb, draw_status2d_eb, click_statuscmd_eb, "status2d_eb" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" }, #elif BAR_STATUS2D_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status2d_eb, draw_status2d_eb, click_status2d, "status2d_eb" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" }, #elif BAR_STATUSCMD_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status_eb, draw_status_eb, click_statuscmd_eb, "status_eb" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" }, #elif BAR_STATUS_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status_eb, draw_status_eb, click_status, "status_eb" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" }, #endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH - #endif // BAR_EXTRABAR_PATCH + #endif // BAR_EXTRASTATUS_PATCH }; #if DWMC_PATCH diff --git a/dwm.c b/dwm.c index a14b48d..9de4559 100644 --- a/dwm.c +++ b/dwm.c @@ -564,14 +564,14 @@ static char stext[1024]; #else static char stext[512]; #endif // BAR_STATUS2D_PATCH -#if BAR_EXTRABAR_PATCH || BAR_STATUSCMD_PATCH +#if BAR_EXTRASTATUS_PATCH || BAR_STATUSCMD_PATCH #if BAR_STATUS2D_PATCH static char rawstext[1024]; #else static char rawstext[512]; #endif // BAR_STATUS2D_PATCH -#endif // BAR_EXTRABAR_PATCH | BAR_STATUSCMD_PATCH -#if BAR_EXTRABAR_PATCH +#endif // BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH +#if BAR_EXTRASTATUS_PATCH #if BAR_STATUS2D_PATCH && !BAR_STATUSCOLORS_PATCH static char estext[1024]; #else @@ -582,7 +582,7 @@ static char rawestext[1024]; #else static char rawestext[512]; #endif // BAR_STATUSCMD_PATCH -#endif // BAR_EXTRABAR_PATCH +#endif // BAR_EXTRASTATUS_PATCH static int screen; static int sw, sh; /* X display screen geometry width, height */ @@ -3667,7 +3667,7 @@ void updatestatus(void) { Monitor *m; - #if BAR_EXTRABAR_PATCH + #if BAR_EXTRASTATUS_PATCH if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext))) { strcpy(stext, "dwm-"VERSION); estext[0] = '\0'; @@ -3698,7 +3698,7 @@ updatestatus(void) #else if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) strcpy(stext, "dwm-"VERSION); - #endif // BAR_EXTRABAR_PATCH + #endif // BAR_EXTRASTATUS_PATCH | BAR_STATUSCMD_PATCH for (m = mons; m; m = m->next) drawbar(m); } diff --git a/patch/bar_status.c b/patch/bar_status.c index 9c3aafe..0234276 100644 --- a/patch/bar_status.c +++ b/patch/bar_status.c @@ -8,6 +8,18 @@ width_status(Bar *bar, BarWidthArg *a) #endif // BAR_PANGO_PATCH } +#if BAR_EXTRASTATUS_PATCH +int +width_status_es(Bar *bar, BarWidthArg *a) +{ + #if BAR_PANGO_PATCH + return TEXTWM(estext) - lrpad; + #else + return TEXTW(estext) - lrpad; + #endif // BAR_PANGO_PATCH +} +#endif // BAR_EXTRASTATUS_PATCH + int draw_status(Bar *bar, BarDrawArg *a) { @@ -18,6 +30,18 @@ draw_status(Bar *bar, BarDrawArg *a) #endif // BAR_PANGO_PATCH } +#if BAR_EXTRASTATUS_PATCH +int +draw_status_es(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 +} +#endif // BAR_EXTRASTATUS_PATCH + int click_status(Bar *bar, Arg *arg, BarClickArg *a) { diff --git a/patch/bar_status.h b/patch/bar_status.h index bd169d9..36fabbb 100644 --- a/patch/bar_status.h +++ b/patch/bar_status.h @@ -1,3 +1,9 @@ static int width_status(Bar *bar, BarWidthArg *a); +#if BAR_EXTRASTATUS_PATCH +static int width_status_es(Bar *bar, BarWidthArg *a); +#endif // BAR_EXTRASTATUS_PATCH static int draw_status(Bar *bar, BarDrawArg *a); +#if BAR_EXTRASTATUS_PATCH +static int draw_status_es(Bar *bar, BarDrawArg *a); +#endif // BAR_EXTRASTATUS_PATCH 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 c4c7689..e746ac6 100644 --- a/patch/bar_status2d.c +++ b/patch/bar_status2d.c @@ -4,12 +4,28 @@ width_status2d(Bar *bar, BarWidthArg *a) return status2dtextlength(rawstext) + lrpad; } +#if BAR_EXTRASTATUS_PATCH +int +width_status2d_es(Bar *bar, BarWidthArg *a) +{ + return status2dtextlength(rawestext); +} +#endif // BAR_EXTRASTATUS_PATCH + int draw_status2d(Bar *bar, BarDrawArg *a) { return drawstatusbar(a->x, rawstext); } +#if BAR_EXTRASTATUS_PATCH +int +draw_status2d_es(Bar *bar, BarDrawArg *a) +{ + return drawstatusbar(a->x, rawestext); +} +#endif // BAR_EXTRASTATUS_PATCH + #if !BAR_STATUSCMD_PATCH int click_status2d(Bar *bar, Arg *arg, BarClickArg *a) diff --git a/patch/bar_status2d.h b/patch/bar_status2d.h index 555b093..cdaa2a8 100644 --- a/patch/bar_status2d.h +++ b/patch/bar_status2d.h @@ -1,5 +1,11 @@ static int width_status2d(Bar *bar, BarWidthArg *a); +#if BAR_EXTRASTATUS_PATCH +static int width_status2d_es(Bar *bar, BarWidthArg *a); +#endif // BAR_EXTRASTATUS_PATCH static int draw_status2d(Bar *bar, BarDrawArg *a); +#if BAR_EXTRASTATUS_PATCH +static int draw_status2d_es(Bar *bar, BarDrawArg *a); +#endif // BAR_EXTRASTATUS_PATCH #if !BAR_STATUSCMD_PATCH static int click_status2d(Bar *bar, Arg *arg, BarClickArg *a); #endif // BAR_STATUSCMD_PATCH diff --git a/patch/bar_status2d_eb.c b/patch/bar_status2d_eb.c deleted file mode 100644 index 5d67b88..0000000 --- a/patch/bar_status2d_eb.c +++ /dev/null @@ -1,11 +0,0 @@ -int -width_status2d_eb(Bar *bar, BarWidthArg *a) -{ - return status2dtextlength(rawestext); -} - -int -draw_status2d_eb(Bar *bar, BarDrawArg *a) -{ - return drawstatusbar(a->x, rawestext); -} \ No newline at end of file diff --git a/patch/bar_status_eb.c b/patch/bar_status_eb.c deleted file mode 100644 index 71944b4..0000000 --- a/patch/bar_status_eb.c +++ /dev/null @@ -1,19 +0,0 @@ -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 deleted file mode 100644 index c2ec004..0000000 --- a/patch/bar_status_eb.h +++ /dev/null @@ -1,2 +0,0 @@ -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_statuscmd.c b/patch/bar_statuscmd.c index 5825647..0cd6013 100644 --- a/patch/bar_statuscmd.c +++ b/patch/bar_statuscmd.c @@ -10,13 +10,13 @@ click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a) return click_statuscmd_text(arg, a->rel_x, rawstext); } -#if BAR_EXTRABAR_PATCH +#if BAR_EXTRASTATUS_PATCH int -click_statuscmd_eb(Bar *bar, Arg *arg, BarClickArg *a) +click_statuscmd_es(Bar *bar, Arg *arg, BarClickArg *a) { return click_statuscmd_text(arg, a->rel_x, rawestext); } -#endif // BAR_EXTRABAR_PATCH +#endif // BAR_EXTRASTATUS_PATCH int click_statuscmd_text(Arg *arg, int rel_x, char *text) diff --git a/patch/bar_statuscmd.h b/patch/bar_statuscmd.h index bcbcb33..0e1e184 100644 --- a/patch/bar_statuscmd.h +++ b/patch/bar_statuscmd.h @@ -1,6 +1,6 @@ static int click_statuscmd(Bar *bar, Arg *arg, BarClickArg *a); -#if BAR_EXTRABAR_PATCH -static int click_statuscmd_eb(Bar *bar, Arg *arg, BarClickArg *a); -#endif // BAR_EXTRABAR_PATCH +#if BAR_EXTRASTATUS_PATCH +static int click_statuscmd_es(Bar *bar, Arg *arg, BarClickArg *a); +#endif // BAR_EXTRASTATUS_PATCH 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/include.c b/patch/include.c index ec8f591..cef9234 100644 --- a/patch/include.c +++ b/patch/include.c @@ -22,15 +22,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" -#if BAR_EXTRABAR_PATCH -#include "bar_status2d_eb.c" -#endif // BAR_EXTRABAR_PATCH #endif #if BAR_STATUSBUTTON_PATCH #include "bar_statusbutton.c" diff --git a/patch/include.h b/patch/include.h index e44bfbe..8b1d470 100644 --- a/patch/include.h +++ b/patch/include.h @@ -22,15 +22,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" -#if BAR_EXTRABAR_PATCH -#include "bar_status2d_eb.h" -#endif // BAR_EXTRABAR_PATCH #endif #if BAR_STATUSBUTTON_PATCH #include "bar_statusbutton.h" diff --git a/patches.def.h b/patches.def.h index 537e042..e758aad 100644 --- a/patches.def.h +++ b/patches.def.h @@ -136,12 +136,12 @@ */ #define BAR_DMENUMATCHTOP_PATCH 0 -/* This patch will enable an extra status bar in dwm in a similar manner to the dualstatus - * patch. If the primary status is at the top via topbar then the extra status bar will be - * placed at the bottom and vice versa. +/* Originally this was the extrabar patch, but as the handling of extra bars is now built-in + * only the splitting of the status by a designated separator remains. As such this has been + * renamed to more accurately reflect what it does - creating an extra status. * https://dwm.suckless.org/patches/extrabar/ */ -#define BAR_EXTRABAR_PATCH 0 +#define BAR_EXTRASTATUS_PATCH 0 /* Adds EWMH support for _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_DESKTOP_NAMES * and _NET_DESKTOP_VIEWPORT, which allows for compatibility with other bars and programs