diff --git a/README.md b/README.md index 976ccc0..109e54c 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t ### Changelog: +2020-08-20 - Added experimental flexwintitle patch based on bartabgroups + 2020-08-13 - Added bartabgroups patch 2020-08-11 - Added decoration hints and focusmaster patches @@ -268,6 +270,9 @@ Refer to [https://dwm.suckless.org/](https://dwm.suckless.org/) for details on t - [fancybar](https://dwm.suckless.org/patches/fancybar/) - shows the titles of all visible windows in the status bar + - flexwintitle + - based on the bartabgroups patch, this is a layout aware barmodules module for handling window titles intended to be used with flextile-deluxe + - [floatbordercolor](https://dwm.suckless.org/patches/float_border_color/) - this patch allows a different border color to be chosen for floating windows diff --git a/config.def.h b/config.def.h index 9e20c4c..a6c1c90 100644 --- a/config.def.h +++ b/config.def.h @@ -141,6 +141,42 @@ static char tabgrpinactivefloatcolor[] = "#000000"; #endif // FLOAT_BORDER_COLOR_PATCH #endif // BAR_TABGROUPS_PATCH +#if BAR_FLEXWINTITLE_PATCH +static char normTTBbgcolor[] = "#330000"; +static char normLTRbgcolor[] = "#330033"; +static char normMONObgcolor[] = "#000033"; +static char normGRIDbgcolor[] = "#003300"; +static char normGRD1bgcolor[] = "#003300"; +static char normGRD2bgcolor[] = "#003300"; +static char normGRDMbgcolor[] = "#506600"; +static char normHGRDbgcolor[] = "#b96600"; +static char normDWDLbgcolor[] = "#003333"; +static char normSPRLbgcolor[] = "#333300"; +static char normfloatbgcolor[] = "#115577"; +static char actTTBbgcolor[] = "#440000"; +static char actLTRbgcolor[] = "#440044"; +static char actMONObgcolor[] = "#000044"; +static char actGRIDbgcolor[] = "#004400"; +static char actGRD1bgcolor[] = "#004400"; +static char actGRD2bgcolor[] = "#004400"; +static char actGRDMbgcolor[] = "#507711"; +static char actHGRDbgcolor[] = "#b97711"; +static char actDWDLbgcolor[] = "#004444"; +static char actSPRLbgcolor[] = "#444400"; +static char actfloatbgcolor[] = "#116688"; +static char selTTBbgcolor[] = "#550000"; +static char selLTRbgcolor[] = "#550055"; +static char selMONObgcolor[] = "#212171"; +static char selGRIDbgcolor[] = "#005500"; +static char selGRD1bgcolor[] = "#005500"; +static char selGRD2bgcolor[] = "#005500"; +static char selGRDMbgcolor[] = "#508822"; +static char selHGRDbgcolor[] = "#b98822"; +static char selDWDLbgcolor[] = "#005555"; +static char selSPRLbgcolor[] = "#555500"; +static char selfloatbgcolor[] = "#117799"; +#endif // BAR_FLEXWINTITLE_PATCH + #if BAR_ALPHA_PATCH static const unsigned int baralpha = 0xd0; static const unsigned int borderalpha = OPAQUE; @@ -170,6 +206,41 @@ static const unsigned int alphas[][3] = { [SchemeTabActive] = { OPAQUE, baralpha, borderalpha }, [SchemeTabInactive] = { OPAQUE, baralpha, borderalpha }, #endif // BAR_TABGROUPS_PATCH + #if BAR_FLEXWINTITLE_PATCH + [SchemeFlexActTTB] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActLTR] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActMONO] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActGRID] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActGRD1] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActGRD2] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActGRDM] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActHGRD] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActDWDL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActSPRL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexActFloat] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaTTB] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaLTR] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaMONO] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaGRID] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaGRD1] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaGRD2] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaGRDM] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaHGRD] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaDWDL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaSPRL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexInaFloat] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelTTB] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelLTR] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelMONO] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelGRID] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelGRD1] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelGRD2] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelGRDM] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelHGRD] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelDWDL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelSPRL] = { OPAQUE, baralpha, borderalpha }, + [SchemeFlexSelFloat] = { OPAQUE, baralpha, borderalpha }, + #endif // BAR_FLEXWINTITLE_PATCH }; #endif // BAR_ALPHA_PATCH #if BAR_VTCOLORS_PATCH && FLOAT_BORDER_COLOR_PATCH @@ -295,6 +366,41 @@ char *colors[][ColCount] = { [SchemeTabActive] = { tabgrpactivefgcolor, tabgrpactivebgcolor, tabgrpactivebordercolor, tabgrpactivefloatcolor }, [SchemeTabInactive] = { tabgrpinactivefgcolor, tabgrpinactivebgcolor, tabgrpinactivebordercolor, tabgrpinactivefloatcolor }, #endif // BAR_TABGROUPS_PATCH + #if BAR_FLEXWINTITLE_PATCH + [SchemeFlexActTTB] = { selfgcolor, actTTBbgcolor, "#000000", "#000000" }, + [SchemeFlexActLTR] = { selfgcolor, actLTRbgcolor, "#000000", "#000000" }, + [SchemeFlexActMONO] = { selfgcolor, actMONObgcolor, "#000000", "#000000" }, + [SchemeFlexActGRID] = { selfgcolor, actGRIDbgcolor, "#000000", "#000000" }, + [SchemeFlexActGRD1] = { selfgcolor, actGRD1bgcolor, "#000000", "#000000" }, + [SchemeFlexActGRD2] = { selfgcolor, actGRD2bgcolor, "#000000", "#000000" }, + [SchemeFlexActGRDM] = { selfgcolor, actGRDMbgcolor, "#000000", "#000000" }, + [SchemeFlexActHGRD] = { selfgcolor, actHGRDbgcolor, "#000000", "#000000" }, + [SchemeFlexActDWDL] = { selfgcolor, actDWDLbgcolor, "#000000", "#000000" }, + [SchemeFlexActSPRL] = { selfgcolor, actSPRLbgcolor, "#000000", "#000000" }, + [SchemeFlexActFloat] = { selfgcolor, actfloatbgcolor, "#000000", "#000000" }, + [SchemeFlexInaTTB] = { normfgcolor, normTTBbgcolor, "#000000", "#000000" }, + [SchemeFlexInaLTR] = { normfgcolor, normLTRbgcolor, "#000000", "#000000" }, + [SchemeFlexInaMONO] = { normfgcolor, normMONObgcolor, "#000000", "#000000" }, + [SchemeFlexInaGRID] = { normfgcolor, normGRIDbgcolor, "#000000", "#000000" }, + [SchemeFlexInaGRD1] = { normfgcolor, normGRD1bgcolor, "#000000", "#000000" }, + [SchemeFlexInaGRD2] = { normfgcolor, normGRD2bgcolor, "#000000", "#000000" }, + [SchemeFlexInaGRDM] = { normfgcolor, normGRDMbgcolor, "#000000", "#000000" }, + [SchemeFlexInaHGRD] = { normfgcolor, normHGRDbgcolor, "#000000", "#000000" }, + [SchemeFlexInaDWDL] = { normfgcolor, normDWDLbgcolor, "#000000", "#000000" }, + [SchemeFlexInaSPRL] = { normfgcolor, normSPRLbgcolor, "#000000", "#000000" }, + [SchemeFlexInaFloat] = { normfgcolor, normfloatbgcolor, "#000000", "#000000" }, + [SchemeFlexSelTTB] = { selfgcolor, selTTBbgcolor, "#000000", "#000000" }, + [SchemeFlexSelLTR] = { selfgcolor, selLTRbgcolor, "#000000", "#000000" }, + [SchemeFlexSelMONO] = { selfgcolor, selMONObgcolor, "#000000", "#000000" }, + [SchemeFlexSelGRID] = { selfgcolor, selGRIDbgcolor, "#000000", "#000000" }, + [SchemeFlexSelGRD1] = { selfgcolor, selGRD1bgcolor, "#000000", "#000000" }, + [SchemeFlexSelGRD2] = { selfgcolor, selGRD2bgcolor, "#000000", "#000000" }, + [SchemeFlexSelGRDM] = { selfgcolor, selGRDMbgcolor, "#000000", "#000000" }, + [SchemeFlexSelHGRD] = { selfgcolor, selHGRDbgcolor, "#000000", "#000000" }, + [SchemeFlexSelDWDL] = { selfgcolor, selDWDLbgcolor, "#000000", "#000000" }, + [SchemeFlexSelSPRL] = { selfgcolor, selSPRLbgcolor, "#000000", "#000000" }, + [SchemeFlexSelFloat] = { selfgcolor, selfloatbgcolor, "#000000", "#000000" }, + #endif // BAR_FLEXWINTITLE_PATCH }; #else // !BAR_VTCOLORS_PATCH && !FLOAT_BORDER_COLOR_PATCH static @@ -321,6 +427,41 @@ char *colors[][ColCount] = { [SchemeTabActive] = { tabgrpactivefgcolor, tabgrpactivebgcolor, tabgrpactivebordercolor }, [SchemeTabInactive] = { tabgrpinactivefgcolor, tabgrpinactivebgcolor, tabgrpinactivebordercolor }, #endif // BAR_TABGROUPS_PATCH + #if BAR_FLEXWINTITLE_PATCH + [SchemeFlexActTTB] = { selfgcolor, actTTBbgcolor, "#000000" }, + [SchemeFlexActLTR] = { selfgcolor, actLTRbgcolor, "#000000" }, + [SchemeFlexActMONO] = { selfgcolor, actMONObgcolor, "#000000" }, + [SchemeFlexActGRID] = { selfgcolor, actGRIDbgcolor, "#000000" }, + [SchemeFlexActGRD1] = { selfgcolor, actGRD1bgcolor, "#000000" }, + [SchemeFlexActGRD2] = { selfgcolor, actGRD2bgcolor, "#000000" }, + [SchemeFlexActGRDM] = { selfgcolor, actGRDMbgcolor, "#000000" }, + [SchemeFlexActHGRD] = { selfgcolor, actHGRDbgcolor, "#000000" }, + [SchemeFlexActDWDL] = { selfgcolor, actDWDLbgcolor, "#000000" }, + [SchemeFlexActSPRL] = { selfgcolor, actSPRLbgcolor, "#000000" }, + [SchemeFlexActFloat] = { selfgcolor, actfloatbgcolor, "#000000" }, + [SchemeFlexInaTTB] = { normfgcolor, normTTBbgcolor, "#000000" }, + [SchemeFlexInaLTR] = { normfgcolor, normLTRbgcolor, "#000000" }, + [SchemeFlexInaMONO] = { normfgcolor, normMONObgcolor, "#000000" }, + [SchemeFlexInaGRID] = { normfgcolor, normGRIDbgcolor, "#000000" }, + [SchemeFlexInaGRD1] = { normfgcolor, normGRD1bgcolor, "#000000" }, + [SchemeFlexInaGRD2] = { normfgcolor, normGRD2bgcolor, "#000000" }, + [SchemeFlexInaGRDM] = { normfgcolor, normGRDMbgcolor, "#000000" }, + [SchemeFlexInaHGRD] = { normfgcolor, normHGRDbgcolor, "#000000" }, + [SchemeFlexInaDWDL] = { normfgcolor, normDWDLbgcolor, "#000000" }, + [SchemeFlexInaSPRL] = { normfgcolor, normSPRLbgcolor, "#000000" }, + [SchemeFlexInaFloat] = { normfgcolor, normfloatbgcolor, "#000000" }, + [SchemeFlexSelTTB] = { selfgcolor, selTTBbgcolor, "#000000" }, + [SchemeFlexSelLTR] = { selfgcolor, selLTRbgcolor, "#000000" }, + [SchemeFlexSelMONO] = { selfgcolor, selMONObgcolor, "#000000" }, + [SchemeFlexSelGRID] = { selfgcolor, selGRIDbgcolor, "#000000" }, + [SchemeFlexSelGRD1] = { selfgcolor, selGRD1bgcolor, "#000000" }, + [SchemeFlexSelGRD2] = { selfgcolor, selGRD2bgcolor, "#000000" }, + [SchemeFlexSelGRDM] = { selfgcolor, selGRDMbgcolor, "#000000" }, + [SchemeFlexSelHGRD] = { selfgcolor, selHGRDbgcolor, "#000000" }, + [SchemeFlexSelDWDL] = { selfgcolor, selDWDLbgcolor, "#000000" }, + [SchemeFlexSelSPRL] = { selfgcolor, selSPRLbgcolor, "#000000" }, + [SchemeFlexSelFloat] = { selfgcolor, selfloatbgcolor, "#000000" }, + #endif // BAR_FLEXWINTITLE_PATCH }; #endif // BAR_VTCOLORS_PATCH / FLOAT_BORDER_COLOR_PATCH @@ -469,56 +610,68 @@ static const Inset default_inset = { * name - does nothing, intended for visual clue and for logging / debugging */ static const BarRule barrules[] = { - /* monitor bar alignment widthfunc drawfunc clickfunc name */ + /* monitor bar alignment widthfunc drawfunc clickfunc name */ #if BAR_STATUSBUTTON_PATCH - { -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" }, + { -1, 0, BAR_ALIGN_LEFT, width_stbutton, draw_stbutton, click_stbutton, "statusbutton" }, #endif // BAR_STATUSBUTTON_PATCH #if BAR_POWERLINE_TAGS_PATCH - { 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, "powerline_tags" }, + { 0, 0, BAR_ALIGN_LEFT, width_pwrl_tags, draw_pwrl_tags, click_pwrl_tags, "powerline_tags" }, #endif // BAR_POWERLINE_TAGS_PATCH #if BAR_TAGS_PATCH - { -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" }, + { -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, "tags" }, #endif // BAR_TAGS_PATCH #if BAR_TAGGRID_PATCH - { -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" }, + { -1, 0, BAR_ALIGN_LEFT, width_taggrid, draw_taggrid, click_taggrid, "taggrid" }, #endif // BAR_TAGGRID_PATCH - #if BAR_LTSYMBOL_PATCH - { -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" }, - #endif // BAR_LTSYMBOL_PATCH #if BAR_SYSTRAY_PATCH - { 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" }, + { 0, 0, BAR_ALIGN_RIGHT, width_systray, draw_systray, click_systray, "systray" }, #endif // BAR_SYSTRAY_PATCH + #if BAR_LTSYMBOL_PATCH + { -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, "layout" }, + #endif // BAR_LTSYMBOL_PATCH #if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH - { 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" }, + { 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_statuscmd, "status2d" }, #elif BAR_STATUS2D_PATCH - { 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" }, + { 'A', 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, "status2d" }, #elif BAR_POWERLINE_STATUS_PATCH - { 0, 0, BAR_ALIGN_RIGHT, width_pwrl_status, draw_pwrl_status, click_pwrl_status, "powerline_status" }, + { 0, 0, BAR_ALIGN_RIGHT, width_pwrl_status, draw_pwrl_status, click_pwrl_status, "powerline_status" }, + #elif BAR_STATUS_PATCH && BAR_STATUSCMD_PATCH + { 0, 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_statuscmd, "status" }, #elif BAR_STATUS_PATCH - { 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" }, + { 'A', 0, BAR_ALIGN_RIGHT, width_status, draw_status, click_status, "status" }, #endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH - #if BAR_TABGROUPS_PATCH - { -1, 0, BAR_ALIGN_NONE, width_bartabgroups, draw_bartabgroups, click_bartabgroups, "bartabgroups" }, + #if BAR_FLEXWINTITLE_PATCH + { -1, 0, BAR_ALIGN_NONE, width_flexwintitle, draw_flexwintitle, click_flexwintitle, "flexwintitle" }, + #elif BAR_TABGROUPS_PATCH + { -1, 0, BAR_ALIGN_NONE, width_bartabgroups, draw_bartabgroups, click_bartabgroups, "bartabgroups" }, #elif BAR_AWESOMEBAR_PATCH - { -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" }, + { -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, "awesomebar" }, #elif BAR_FANCYBAR_PATCH - { -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" }, + { -1, 0, BAR_ALIGN_NONE, width_fancybar, draw_fancybar, click_fancybar, "fancybar" }, #elif BAR_WINTITLE_PATCH - { -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" }, + { -1, 0, BAR_ALIGN_NONE, width_wintitle, draw_wintitle, click_wintitle, "wintitle" }, #endif // BAR_TABGROUPS_PATCH | BAR_AWESOMEBAR_PATCH | BAR_FANCYBAR_PATCH | BAR_WINTITLE_PATCH #if BAR_EXTRASTATUS_PATCH #if BAR_STATUS2D_PATCH && BAR_STATUSCMD_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_statuscmd_es, "status2d_es" }, #elif BAR_STATUS2D_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status2d_es, draw_status2d_es, click_status2d, "status2d_es" }, #elif BAR_POWERLINE_STATUS_PATCH - { 0, 1, BAR_ALIGN_RIGHT, width_pwrl_status_es, draw_pwrl_status_es, click_pwrl_status, "powerline_status" }, + { 0, 1, BAR_ALIGN_RIGHT, width_pwrl_status_es, draw_pwrl_status_es, click_pwrl_status, "powerline_status" }, #elif BAR_STATUSCMD_PATCH && BAR_STATUS_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_statuscmd_es, "status_es" }, #elif BAR_STATUS_PATCH - { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" }, + { 'A', 1, BAR_ALIGN_CENTER, width_status_es, draw_status_es, click_status, "status_es" }, #endif // BAR_STATUS2D_PATCH | BAR_STATUSCMD_PATCH #endif // BAR_EXTRASTATUS_PATCH + #if BAR_FLEXWINTITLE_PATCH + #if BAR_WINTITLE_HIDDEN_PATCH + { -1, 1, BAR_ALIGN_RIGHT_RIGHT, width_wintitle_hidden, draw_wintitle_hidden, click_wintitle_hidden, "wintitle_hidden" }, + #endif + #if BAR_WINTITLE_FLOATING_PATCH + { -1, 1, BAR_ALIGN_LEFT, width_wintitle_floating, draw_wintitle_floating, click_wintitle_floating, "wintitle_floating" }, + #endif // BAR_WINTITLE_FLOATING_PATCH + #endif // BAR_FLEXWINTITLE_PATCH }; #if DWMC_PATCH diff --git a/dwm.c b/dwm.c index 6242655..e64f1f0 100644 --- a/dwm.c +++ b/dwm.c @@ -142,6 +142,41 @@ enum { SchemeTabActive, SchemeTabInactive, #endif // BAR_TABGROUPS_PATCH + #if BAR_FLEXWINTITLE_PATCH + SchemeFlexActTTB, + SchemeFlexActLTR, + SchemeFlexActMONO, + SchemeFlexActGRID, + SchemeFlexActGRD1, + SchemeFlexActGRD2, + SchemeFlexActGRDM, + SchemeFlexActHGRD, + SchemeFlexActDWDL, + SchemeFlexActSPRL, + SchemeFlexInaTTB, + SchemeFlexInaLTR, + SchemeFlexInaMONO, + SchemeFlexInaGRID, + SchemeFlexInaGRD1, + SchemeFlexInaGRD2, + SchemeFlexInaGRDM, + SchemeFlexInaHGRD, + SchemeFlexInaDWDL, + SchemeFlexInaSPRL, + SchemeFlexSelTTB, + SchemeFlexSelLTR, + SchemeFlexSelMONO, + SchemeFlexSelGRID, + SchemeFlexSelGRD1, + SchemeFlexSelGRD2, + SchemeFlexSelGRDM, + SchemeFlexSelHGRD, + SchemeFlexSelDWDL, + SchemeFlexSelSPRL, + SchemeFlexActFloat, + SchemeFlexInaFloat, + SchemeFlexSelFloat, + #endif // BAR_FLEXWINTITLE_PATCH }; /* color schemes */ enum { @@ -2978,7 +3013,7 @@ setup(void) scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], alphas[0], ColCount); #else scheme[LENGTH(colors)] = drw_scm_create(drw, colors[0], ColCount); - #endif // BAR_ALPHA_PATCH | FLOAT_BORDER_COLOR_PATCH + #endif // BAR_ALPHA_PATCH #else scheme = ecalloc(LENGTH(colors), sizeof(Clr *)); #endif // BAR_STATUS2D_PATCH diff --git a/patch/bar_flexwintitle.c b/patch/bar_flexwintitle.c new file mode 100644 index 0000000..bf5b4f2 --- /dev/null +++ b/patch/bar_flexwintitle.c @@ -0,0 +1,453 @@ +/* Flexwintitle properties, you can override these in your config.h if you want. */ +#ifndef FLEXWINTITLE_BORDERS +#define FLEXWINTITLE_BORDERS 1 // 0 = off, 1 = on +#endif +#ifndef FLEXWINTITLE_TAGSINDICATOR +#define FLEXWINTITLE_TAGSINDICATOR 1 // 0 = off, 1 = on if >1 client/view tag, 2 = always on +#endif +#ifndef FLEXWINTITLE_TAGSPX +#define FLEXWINTITLE_TAGSPX 5 // # pixels for tag grid boxes +#endif +#ifndef FLEXWINTITLE_TAGSROWS +#define FLEXWINTITLE_TAGSROWS 3 // # rows in tag grid (9 tags, e.g. 3x3) +#endif +#ifndef FLEXWINTITLE_SHOWFLOATING +#define FLEXWINTITLE_SHOWFLOATING 0 // whether to show titles for floating windows, hidden clients are always shown +#endif +#ifndef FLEXWINTITLE_MASTERWEIGHT +#define FLEXWINTITLE_MASTERWEIGHT 9 // master weight compared to stack, hidden and floating window titles +#endif +#ifndef FLEXWINTITLE_STACKWEIGHT +#define FLEXWINTITLE_STACKWEIGHT 3 // stack weight compared to master, hidden and floating window titles +#endif +#ifndef FLEXWINTITLE_HIDDENWEIGHT +#define FLEXWINTITLE_HIDDENWEIGHT 1 // hidden window title weight +#endif +#ifndef FLEXWINTITLE_FLOATWEIGHT +#define FLEXWINTITLE_FLOATWEIGHT 1 // floating window title weight, set to 0 to not show floating windows +#endif +#ifndef FLEXWINTITLE_CENTERTEXT +#define FLEXWINTITLE_CENTERTEXT 1 // center windowtitle text +#endif + +#define SCHEMEFOR(c) getschemefor(m, c, groupactive == c) + +enum { GRP_NOSELECTION, GRP_MASTER, GRP_STACK1, GRP_STACK2, GRP_FLOAT, GRP_HIDDEN }; + +int +width_flexwintitle(Bar *bar, BarWidthArg *a) +{ + return a->max_width; +} + +int +draw_flexwintitle(Bar *bar, BarDrawArg *a) +{ + drw_rect(drw, a->x, 0, a->w, bh, 1, 1); + flextitlecalculate(bar->mon, a->x, a->w, -1, flextitledraw, NULL); + return a->x + a->w; +} + +int +click_flexwintitle(Bar *bar, Arg *arg, BarClickArg *a) +{ + flextitlecalculate(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + return ClkWinTitle; +} + +Client * +flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int scheme, int draw_tiled, int draw_hidden, int draw_floating, + int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg) +{ + int i; + for (i = 0; c && i < max_clients; c = c->next) { + if ( + ISVISIBLE(c) && + ( + (draw_tiled && !c->isfloating && !HIDDEN(c)) || + (draw_floating && c->isfloating && !HIDDEN(c)) || + (draw_hidden && HIDDEN(c)) + ) + ) { + tabfn(m, c, passx, x, w + (i < r ? 1 : 0), scheme, arg); + x += w + (i < r ? 1 : 0); + i++; + } + } + return c; +} + +int +getschemefor(Monitor *m, int group, int activegroup) +{ + switch (group) { + case GRP_NOSELECTION: + case GRP_MASTER: + case GRP_STACK1: + case GRP_STACK2: + #if BSTACK_LAYOUT + if (m->lt[m->sellt]->arrange == &bstack) + return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR); + #endif // BSTACK_LAYOUT + #if BSTACKHORIZ_LAYOUT + if (m->lt[m->sellt]->arrange == &bstackhoriz) { + if (group == GRP_MASTER) + return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR); + else + return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB); + } + #endif // BSTACKHORIZ_LAYOUT + #if CENTEREDMASTER_LAYOUT + if (m->lt[m->sellt]->arrange == ¢eredmaster) + return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB); + #endif // CENTEREDMASTER_LAYOUT + #if CENTEREDFLOATINGMASTER_LAYOUT + if (m->lt[m->sellt]->arrange == ¢eredfloatingmaster) + return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR); + #endif // CENTEREDFLOATINGMASTER_LAYOUT + #if COLUMNS_LAYOUT + if (m->lt[m->sellt]->arrange == &col) { + if (group == GRP_MASTER) + return (activegroup ? SchemeFlexActLTR : SchemeFlexInaLTR); + else + return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB); + } + #endif // COLUMNS_LAYOUT + #if DECK_LAYOUT + if (m->lt[m->sellt]->arrange == &deck) { + if (group == GRP_MASTER) + return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB); + else + return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO); + } + #endif // DECK_LAYOUT + #if FIBONACCI_DWINDLE_LAYOUT + if (m->lt[m->sellt]->arrange == &dwindle) + return (activegroup ? SchemeFlexActDWDL : SchemeFlexInaDWDL); + #endif // FIBONACCI_DWINDLE_LAYOUT + #if FIBONACCI_SPIRAL_LAYOUT + if (m->lt[m->sellt]->arrange == &spiral) + return (activegroup ? SchemeFlexActSPRL : SchemeFlexInaSPRL); + #endif // FIBONACCI_SPIRAL_LAYOUT + #if FLEXTILE_DELUXE_LAYOUT + if (m->lt[m->sellt]->arrange == &flextile) + return (activegroup ? SchemeFlexActTTB + m->ltaxis[group] : SchemeFlexInaTTB + m->ltaxis[group]); + #endif // FLEXTILE_DELUXE_LAYOUT + #if GAPPLESSGRID_LAYOUT + if (m->lt[m->sellt]->arrange == &gaplessgrid) + return (activegroup ? SchemeFlexActGRID : SchemeFlexInaGRID); + #endif // GAPPLESSGRID_LAYOUT + #if GRIDMODE_LAYOUT + if (m->lt[m->sellt]->arrange == &grid) + return (activegroup ? SchemeFlexActGRDM : SchemeFlexInaGRDM); + #endif // GRIDMODE_LAYOUT + #if HORIZGRID_LAYOUT + if (m->lt[m->sellt]->arrange == &horizgrid) + return (activegroup ? SchemeFlexActHGRD : SchemeFlexInaHGRD); + #endif // HORIZGRID_LAYOUT + #if NROWGRID_LAYOUT + if (m->lt[m->sellt]->arrange == &nrowgrid) + return (activegroup ? SchemeFlexActGRD1 : SchemeFlexInaGRD1); + #endif // NROWGRID_LAYOUT + #if TILE_LAYOUT + if (m->lt[m->sellt]->arrange == &tile) + return (activegroup ? SchemeFlexActTTB : SchemeFlexInaTTB); + #endif // TILE_LAYOUT + #if MONOCLE_LAYOUT + if (m->lt[m->sellt]->arrange == &monocle) + return (activegroup ? SchemeFlexActMONO : SchemeFlexInaMONO); + #endif // MONOCLE_LAYOUT + return SchemeNorm; + case GRP_HIDDEN: + return SchemeHid; + case GRP_FLOAT: + return (activegroup ? SchemeFlexActFloat : SchemeFlexInaFloat); + } + return SchemeNorm; +} + +int +getselschemefor(int scheme) +{ + if (scheme == SchemeFlexActFloat || scheme == SchemeFlexInaFloat) + return SchemeFlexSelFloat; + if (scheme >= SchemeFlexInaTTB) + return scheme + SchemeFlexInaTTB - SchemeFlexActTTB; + if (scheme >= SchemeFlexActTTB) + return scheme + SchemeFlexSelTTB - SchemeFlexActTTB; + return SchemeSel; +} + +void +flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int tabscheme, Arg *arg) +{ + if (!c) + return; + int i, nclienttags = 0, nviewtags = 0, pad = lrpad / 2; + + drw_setscheme(drw, scheme[( + c == m->sel + ? getselschemefor(tabscheme) + : HIDDEN(c) + ? SchemeHid + #if URGENTBORDER_PATCH || BAR_STATUSCOLORS_PATCH + : c->isurgent + ? SchemeUrg + #endif + : tabscheme + )]); + if (w <= TEXTW("A") - lrpad + pad) // reduce text padding if wintitle is too small + pad = (w - TEXTW("A") + lrpad < 0 ? 0 : (w - TEXTW("A") + lrpad) / 2); + #if FLEXWINTITLE_CENTERTEXT + else if (TEXTW(c->name) < w) + pad = (w - TEXTW(c->name) + lrpad) / 2; + #endif // FLEXWINTITLE_CENTERTEXT + + drw_text(drw, x, 0, w, bh, pad, c->name, 0); + if (c->isfloating) + drw_rect(drw, x + 2, 2, 5, 5, 0, 0); + + if (FLEXWINTITLE_BORDERS) { + XSetForeground(drw->dpy, drw->gc, scheme[SchemeSel][ColBorder].pixel); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, 0, 1, bh); + XFillRectangle(drw->dpy, drw->drawable, drw->gc, x + w, 0, 1, bh); + } + /* Optional tags icons */ + for (i = 0; i < LENGTH(tags); i++) { + if ((m->tagset[m->seltags] >> i) & 1) + nviewtags++; + if ((c->tags >> i) & 1) + nclienttags++; + } + + if (FLEXWINTITLE_TAGSINDICATOR == 2 || nclienttags > 1 || nviewtags > 1) { + for (i = 0; i < LENGTH(tags); i++) { + drw_rect(drw, + ( x + w - 2 - ((LENGTH(tags) / FLEXWINTITLE_TAGSROWS) * FLEXWINTITLE_TAGSPX) + - (i % (LENGTH(tags)/FLEXWINTITLE_TAGSROWS)) + ((i % (LENGTH(tags) / FLEXWINTITLE_TAGSROWS)) * FLEXWINTITLE_TAGSPX) + ), + ( 2 + ((i / (LENGTH(tags)/FLEXWINTITLE_TAGSROWS)) * FLEXWINTITLE_TAGSPX) + - ((i / (LENGTH(tags)/FLEXWINTITLE_TAGSROWS))) + ), + FLEXWINTITLE_TAGSPX, FLEXWINTITLE_TAGSPX, (c->tags >> i) & 1, 0 + ); + } + } +} + +#ifndef HIDDEN +#define HIDDEN(C) 0 +#endif + +void +flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg) +{ + if (passx >= x && passx <= x + w) + arg->v = c; +} + +void +flextitlecalculate( + Monitor *m, int offx, int tabw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg +) { + Client *c; + int n, center = 0, mirror = 0, fixed = 0; // layout configuration + int clientsnmaster = 0, clientsnstack = 0, clientsnfloating = 0, clientsnhidden = 0; + int i, w, r, num = 0, den, fulllayout = 0; + int clientsnstack2 = 0; + int groupactive = 0; + int selidx = 0; + int dualstack = 0; + int rw, rr; + + int mas_x = offx, st1_x = offx, st2_x = offx, hid_x = offx, flt_x = offx; + int mas_w, st1_w, st2_w, hid_w; + + for (i = 0, c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c)) + continue; + if (HIDDEN(c)) { + if (FLEXWINTITLE_HIDDENWEIGHT) + clientsnhidden++; + continue; + } + + if (c->isfloating) { + if (FLEXWINTITLE_FLOATWEIGHT) + clientsnfloating++; + continue; + } + + if (m->sel == c) + selidx = i; + + if (i < m->nmaster) + clientsnmaster++; + else if (m->nstack) { + if (clientsnstack < m->nstack) + clientsnstack++; + else + clientsnstack2++; + } + else if (i % 2) + clientsnstack++; + else + clientsnstack2++; + i++; + } + + if (!m->sel) + groupactive = GRP_NOSELECTION; + else if (HIDDEN(m->sel)) + groupactive = GRP_HIDDEN; + else if (m->sel->isfloating) + groupactive = GRP_FLOAT; + else if (selidx < clientsnmaster) + groupactive = GRP_MASTER; + else if (selidx < clientsnmaster + clientsnstack) + groupactive = GRP_STACK1; + else if (selidx < clientsnmaster + clientsnstack + clientsnstack2) + groupactive = GRP_STACK2; + + n = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden; + if (n == 0) + return; + #if FLEXTILE_DELUXE_LAYOUT + else if (m->lt[m->sellt]->arrange == &flextile) { + int layout = m->ltaxis[LAYOUT]; + if (layout < 0) { + mirror = 1; + layout *= -1; + } + if (layout > FLOATING_MASTER) { + layout -= FLOATING_MASTER; + fixed = 1; + } + + if (layout == SPLIT_HORIZONTAL_DUAL_STACK || layout == SPLIT_HORIZONTAL_DUAL_STACK_FIXED) + dualstack = 1; + else if (layout == SPLIT_CENTERED_VERTICAL && (fixed || n - m->nmaster > 1)) + center = 1; + else if (layout == FLOATING_MASTER) + center = 1; + else if (layout == SPLIT_CENTERED_HORIZONTAL) { + if (fixed || n - m->nmaster > 1) + center = 1; + } + } + #endif // FLEXTILE_DELUXE_LAYOUT + #if CENTEREDMASTER_LAYOUT + else if (m->lt[m->sellt]->arrange == ¢eredmaster && (fixed || n - m->nmaster > 1)) + center = 1; + #endif // CENTEREDMASTER_LAYOUT + #if CENTEREDFLOATINGMASTER_LAYOUT + else if (m->lt[m->sellt]->arrange == ¢eredfloatingmaster) + center = 1; + #endif // CENTEREDFLOATINGMASTER_LAYOUT + + /* Certain layouts have no master / stack areas */ + if (!m->lt[m->sellt]->arrange // floating layout + || (!n || (!fixed && m->nmaster && n <= m->nmaster)) // no master + #if MONOCLE_LAYOUT + || m->lt[m->sellt]->arrange == &monocle + #endif // MONOCLE_LAYOUT + #if GRIDMODE_LAYOUT + || m->lt[m->sellt]->arrange == &grid + #endif // GRIDMODE_LAYOUT + #if HORIZGRID_LAYOUT + || m->lt[m->sellt]->arrange == &horizgrid + #endif // HORIZGRID_LAYOUT + #if GAPPLESSGRID_LAYOUT + || m->lt[m->sellt]->arrange == &gaplessgrid + #endif // GAPPLESSGRID_LAYOUT + #if NROWGRID_LAYOUT + || m->lt[m->sellt]->arrange == &nrowgrid + #endif // NROWGRID_LAYOUT + #if FLEXTILE_DELUXE_LAYOUT + || (m->lt[m->sellt]->arrange == &flextile && m->ltaxis[LAYOUT] == NO_SPLIT) + #endif // FLEXTILE_DELUXE_LAYOUT + ) + fulllayout = 1; + + num = tabw; + c = m->clients; + + /* floating mode */ + if ((fulllayout && FLEXWINTITLE_FLOATWEIGHT > 0) || clientsnmaster + clientsnstack == 0 || !m->lt[m->sellt]->arrange) { + den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnfloating + clientsnhidden; + w = num / den; + r = num % den; // rest + c = flextitledrawarea(m, c, mas_x, r, w, den, !m->lt[m->sellt]->arrange ? SchemeFlexActFloat : SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, FLEXWINTITLE_FLOATWEIGHT, passx, tabfn, arg); // floating + /* no master and stack mode, e.g. monocole, grid layouts, fibonacci */ + } else if (fulllayout) { + den = clientsnmaster + clientsnstack + clientsnstack2 + clientsnhidden; + w = num / den; + r = num % den; // rest + c = flextitledrawarea(m, c, mas_x, r, w, den, SCHEMEFOR(GRP_MASTER), 1, FLEXWINTITLE_HIDDENWEIGHT, 0, passx, tabfn, arg); // full + /* tiled mode */ + } else { + den = clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (clientsnstack + clientsnstack2) * FLEXWINTITLE_STACKWEIGHT + clientsnfloating * FLEXWINTITLE_FLOATWEIGHT + clientsnhidden * FLEXWINTITLE_HIDDENWEIGHT; + w = num / den; // weight width per client + r = num % den; // weight rest width + rw = r / n; // rest incr per client + rr = r % n; // rest rest + if ((!center && !dualstack) || (center && n <= m->nmaster + (m->nstack ? m->nstack : 1))) { + clientsnstack += clientsnstack2; + clientsnstack2 = 0; + if (groupactive == GRP_STACK2) + groupactive = GRP_STACK1; + } + + mas_w = clientsnmaster * rw + w * clientsnmaster * FLEXWINTITLE_MASTERWEIGHT + (rr > 0 ? MIN(rr, clientsnmaster) : 0); + rr -= clientsnmaster; + st1_w = clientsnstack * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack) : 0); + rr -= clientsnstack; + st2_w = clientsnstack2 * (rw + w * FLEXWINTITLE_STACKWEIGHT) + (rr > 0 ? MIN(rr, clientsnstack2) : 0); + rr -= clientsnstack2; + hid_w = clientsnhidden * (rw + w * FLEXWINTITLE_HIDDENWEIGHT) + (rr > 0 ? MIN(rr, clientsnhidden) : 0); + rr -= clientsnhidden; + rr = r % n; + + if (mirror) { + if (center && clientsnstack2) { + mas_x = st1_x + st1_w; + st2_x = mas_x + mas_w; + hid_x = st2_x + st2_w; + } else { + if (clientsnstack2) { + st2_x = st1_x + st1_w; + mas_x = st2_x + st2_w; + } else + mas_x = st1_x + st1_w; + hid_x = mas_x + mas_w; + } + } else { + if (center && clientsnstack2) { + mas_x = st2_x + st2_w; + st1_x = mas_x + mas_w; + hid_x = st1_x + st1_w; + } else { + st1_x = mas_x + mas_w; + if (clientsnstack2) { + st2_x = st1_x + st1_w; + hid_x = st2_x + st2_w; + } else + hid_x = st1_x + st1_w; + } + } + + flt_x = hid_x + hid_w; + c = flextitledrawarea(m, c, mas_x, rr, w * FLEXWINTITLE_MASTERWEIGHT + rw, clientsnmaster, SCHEMEFOR(GRP_MASTER), 1, 0, 0, passx, tabfn, arg); // master + rr -= clientsnmaster; + c = flextitledrawarea(m, c, st1_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack, SCHEMEFOR(GRP_STACK1), 1, 0, 0, passx, tabfn, arg); // stack1 + rr -= clientsnstack; + if (clientsnstack2) { + c = flextitledrawarea(m, c, st2_x, rr, w * FLEXWINTITLE_STACKWEIGHT + rw, clientsnstack2, SCHEMEFOR(GRP_STACK2), 1, 0, 0, passx, tabfn, arg); // stack2 + rr -= clientsnstack2; + } + c = flextitledrawarea(m, m->clients, hid_x, rr, w * FLEXWINTITLE_HIDDENWEIGHT + rw, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg); // hidden + rr -= clientsnhidden; + c = flextitledrawarea(m, m->clients, flt_x, rr, w * FLEXWINTITLE_FLOATWEIGHT + rw, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg); // floating + } +} \ No newline at end of file diff --git a/patch/bar_flexwintitle.h b/patch/bar_flexwintitle.h new file mode 100644 index 0000000..56647c6 --- /dev/null +++ b/patch/bar_flexwintitle.h @@ -0,0 +1,10 @@ +static int width_flexwintitle(Bar *bar, BarWidthArg *a); +static int draw_flexwintitle(Bar *bar, BarDrawArg *a); +static int click_flexwintitle(Bar *bar, Arg *arg, BarClickArg *a); + +static void flextitledraw(Monitor *m, Client *c, int unused, int x, int w, int groupactive, Arg *arg); +static void flextitleclick(Monitor *m, Client *c, int passx, int x, int w, int unused, Arg *arg); +static void flextitlecalculate(Monitor *m, int offx, int w, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); +static int getschemefor(Monitor *m, int group, int activegroup); +static int getselschemefor(int scheme); +static Client *flextitledrawarea(Monitor *m, Client *c, int x, int r, int w, int max_clients, int tabscheme, int draw_tiled, int draw_hidden, int draw_floating, int passx, void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg); \ No newline at end of file diff --git a/patch/bar_wintitle_floating.c b/patch/bar_wintitle_floating.c new file mode 100644 index 0000000..3fea3c2 --- /dev/null +++ b/patch/bar_wintitle_floating.c @@ -0,0 +1,44 @@ +int +width_wintitle_floating(Bar *bar, BarWidthArg *a) +{ + return a->max_width; +} + +int +draw_wintitle_floating(Bar *bar, BarDrawArg *a) +{ + drw_rect(drw, a->x, 0, a->w, bh, 1, 1); + calc_wintitle_floating(bar->mon, a->x, a->w, -1, flextitledraw, NULL); + return a->x + a->w; +} + +int +click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a) +{ + calc_wintitle_floating(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + return ClkWinTitle; +} + +void +calc_wintitle_floating( + Monitor *m, int offx, int tabw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg +) { + Client *c; + int clientsnfloating = 0, w, r; + int groupactive = GRP_FLOAT; + + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c) || HIDDEN(c)) + continue; + if (c->isfloating) + clientsnfloating++; + } + + if (!clientsnfloating) + return; + + w = tabw / clientsnfloating; + r = tabw % clientsnfloating; + c = flextitledrawarea(m, m->clients, offx, r, w, clientsnfloating, SCHEMEFOR(GRP_FLOAT), 0, 0, 1, passx, tabfn, arg); +} \ No newline at end of file diff --git a/patch/bar_wintitle_floating.h b/patch/bar_wintitle_floating.h new file mode 100644 index 0000000..3e6164a --- /dev/null +++ b/patch/bar_wintitle_floating.h @@ -0,0 +1,7 @@ +static int width_wintitle_floating(Bar *bar, BarWidthArg *a); +static int draw_wintitle_floating(Bar *bar, BarDrawArg *a); +static int click_wintitle_floating(Bar *bar, Arg *arg, BarClickArg *a); +static void calc_wintitle_floating( + Monitor *m, int offx, int tabw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg +); \ No newline at end of file diff --git a/patch/bar_wintitle_hidden.c b/patch/bar_wintitle_hidden.c new file mode 100644 index 0000000..729f6aa --- /dev/null +++ b/patch/bar_wintitle_hidden.c @@ -0,0 +1,44 @@ +int +width_wintitle_hidden(Bar *bar, BarWidthArg *a) +{ + return a->max_width; +} + +int +draw_wintitle_hidden(Bar *bar, BarDrawArg *a) +{ + drw_rect(drw, a->x, 0, a->w, bh, 1, 1); + calc_wintitle_hidden(bar->mon, a->x, a->w, -1, flextitledraw, NULL); + return a->x + a->w; +} + +int +click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a) +{ + calc_wintitle_hidden(bar->mon, 0, a->rel_w, a->rel_x, flextitleclick, arg); + return ClkWinTitle; +} + +void +calc_wintitle_hidden( + Monitor *m, int offx, int tabw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg +) { + Client *c; + int clientsnhidden = 0, w, r; + int groupactive = GRP_HIDDEN; + + for (c = m->clients; c; c = c->next) { + if (!ISVISIBLE(c)) + continue; + if (HIDDEN(c)) + clientsnhidden++; + } + + if (!clientsnhidden) + return; + + w = tabw / clientsnhidden; + r = tabw % clientsnhidden; + c = flextitledrawarea(m, m->clients, offx, r, w, clientsnhidden, SCHEMEFOR(GRP_HIDDEN), 0, 1, 0, passx, tabfn, arg); +} \ No newline at end of file diff --git a/patch/bar_wintitle_hidden.h b/patch/bar_wintitle_hidden.h new file mode 100644 index 0000000..2382e91 --- /dev/null +++ b/patch/bar_wintitle_hidden.h @@ -0,0 +1,7 @@ +static int width_wintitle_hidden(Bar *bar, BarWidthArg *a); +static int draw_wintitle_hidden(Bar *bar, BarDrawArg *a); +static int click_wintitle_hidden(Bar *bar, Arg *arg, BarClickArg *a); +static void calc_wintitle_hidden( + Monitor *m, int offx, int tabw, int passx, + void(*tabfn)(Monitor *, Client *, int, int, int, int, Arg *arg), Arg *arg +); \ No newline at end of file diff --git a/patch/include.c b/patch/include.c index b9be27f..d990f0c 100644 --- a/patch/include.c +++ b/patch/include.c @@ -56,6 +56,15 @@ #if BAR_FANCYBAR_PATCH #include "bar_fancybar.c" #endif +#if BAR_FLEXWINTITLE_PATCH +#include "bar_flexwintitle.c" +#if BAR_WINTITLE_FLOATING_PATCH +#include "bar_wintitle_floating.c" +#endif +#if BAR_WINTITLE_HIDDEN_PATCH +#include "bar_wintitle_hidden.c" +#endif +#endif // BAR_FLEXWINTITLE_PATCH #if BAR_AWESOMEBAR_PATCH #include "bar_awesomebar.c" #endif diff --git a/patch/include.h b/patch/include.h index 15645f0..486c0a1 100644 --- a/patch/include.h +++ b/patch/include.h @@ -53,6 +53,15 @@ #if BAR_FANCYBAR_PATCH #include "bar_fancybar.h" #endif +#if BAR_FLEXWINTITLE_PATCH +#include "bar_flexwintitle.h" +#if BAR_WINTITLE_FLOATING_PATCH +#include "bar_wintitle_floating.h" +#endif +#if BAR_WINTITLE_HIDDEN_PATCH +#include "bar_wintitle_hidden.h" +#endif +#endif // BAR_FLEXWINTITLE_PATCH #if BAR_AWESOMEBAR_PATCH #include "bar_awesomebar.h" #endif diff --git a/patches.def.h b/patches.def.h index 94dd4b5..7adf567 100644 --- a/patches.def.h +++ b/patches.def.h @@ -36,6 +36,12 @@ */ #define BAR_FANCYBAR_PATCH 0 +/* Being an evolution of the bartabgroups patch the flexwintitle patch specifically + * taps into the many layout options that flextile-deluxe offers to produce a window + * title section in the bar that is representative of what is shown on screen. + */ +#define BAR_FLEXWINTITLE_PATCH 0 + /* Show layout symbol in bar */ #define BAR_LTSYMBOL_PATCH 1 @@ -109,6 +115,22 @@ /* Show window title in bar */ #define BAR_WINTITLE_PATCH 1 +/* Shows window titles in the bar, but only for floating clients. + * This depends on code from the flexwintitle patch. + * Note that the configuration in config.def.h for this is merely an example. If combined + * with the corresponding hidden patch then these two will overlap unless the width of the + * modules are controlled. + */ +#define BAR_WINTITLE_FLOATING_PATCH 0 + +/* Shows window titles in the bar, but only for floating clients. + * This depends on code from the flexwintitle patch. + * Note that the configuration in config.def.h for this is merely an example. If combined + * with the corresponding floating patch then these two will overlap unless the width of the + * modules are controlled. + */ +#define BAR_WINTITLE_HIDDEN_PATCH 0 + /* 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 @@ -260,7 +282,7 @@ * explicitly enabled. * https://github.com/bakkeby/patches/blob/master/dwm/dwm-barmodules-wintitleactions-6.2.diff */ -#define BAR_WINTITLEACTIONS_PATCH BAR_AWESOMEBAR_PATCH || BAR_TABGROUPS_PATCH +#define BAR_WINTITLEACTIONS_PATCH BAR_AWESOMEBAR_PATCH || BAR_TABGROUPS_PATCH || BAR_FLEXWINTITLE_PATCH /*** * Other patches