diff --git a/bar/title-basic.c b/bar/title-basic.c index c3b90e0..bbc6d19 100644 --- a/bar/title-basic.c +++ b/bar/title-basic.c @@ -32,8 +32,11 @@ draw_title_basic(Bar *bar, BarDrawArg *a) padding = (w - TEXTW(c->name) + lrpad) / 2; #if USEWINICON - drw_text(drw, x, 0, w, bh, padding + (c->icon ? c->icw + iconspacing : 0), c->name, 0, False); - if (c->icon) + if (!selmon->hideicon) + drw_text(drw, x, 0, w, bh, padding + (c->icon ? c->icw + iconspacing : 0), c->name, 0, False); + else + drw_text(drw, x, 0, w, bh, padding, c->name, 0, False); + if (c->icon && !selmon->hideicon) drw_pic(drw, x + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); #else drw_text(drw, x, 0, w, bh, padding, c->name, 0, False); diff --git a/bar/title.c b/bar/title.c index af338a0..e6f5493 100644 --- a/bar/title.c +++ b/bar/title.c @@ -25,31 +25,48 @@ draw_title(Bar *bar, BarDrawArg *a) n++; if (n > 0) { - remainder = w % n; - tabw = w / n; + if (!selmon->hideunselectedtitle) { + remainder = w % n; + tabw = w / n; + } else { + remainder = w; + tabw = w; + } + for (i = 0, c = bar->mon->clients; c; c = c->next, i++) { if (!ISVISIBLE(c)) continue; + if (bar->mon->sel == c && colorselectedtitle) scm = SchemeTitleSel; else if (!colorselectedtitle) scm = SchemeTitleNorm; - else if (HIDDEN(c)) + else if (HIDDEN(c) && !selmon->hideunselectedtitle) scm = SchemeTitleHidden; - else + else if (!selmon->hideunselectedtitle) scm = SchemeTitleNorm; + /* hide unselected title */ + if (bar->mon->sel != c && selmon->hideunselectedtitle) { + continue; + } + padding = lrpad / 2; if (TEXTW(c->name) < tabw && titleposition) padding = (tabw - TEXTW(c->name) + lrpad) / 2; drw_setscheme(drw, scheme[scm]); #if USEWINICON - drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, padding + (c->name ? c->icw + iconspacing : 0), c->name, 0, False); - if (c->icon) + if (!selmon->hideicon) { + drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, padding + (c->name ? c->icw + iconspacing : 0), c->name, 0, False); + } else { + drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, padding, c->name, 0, False); + } + + if (c->icon && !selmon->hideicon) drw_pic(drw, x + padding, (bh - c->ich) / 2, c->icw, c->ich, c->icon); #else - drw_text(drw, x, 0, tabw + padding (i < remainder ? 1 : 0), bh, padding, c->name, 0, False); + drw_text(drw, x, 0, tabw + (i < remainder ? 1 : 0), bh, padding, c->name, 0, False); #endif x += tabw + (i < remainder ? 1 : 0); diff --git a/docs/example.signal b/docs/example.signal index 55ce954..d3ccc51 100644 --- a/docs/example.signal +++ b/docs/example.signal @@ -116,4 +116,5 @@ - 116 - Toggle mark on a client. - 117 - Swap focus with the marked client. - 118 - Swap the focused client with the marked client. +- 119 - Center the focused window diff --git a/keybinds.h b/keybinds.h index b8535a7..45f4451 100644 --- a/keybinds.h +++ b/keybinds.h @@ -195,11 +195,13 @@ static Key keys[] = { { MODIFIER1, XK_p, XK_r, resetbarpadding, {0} }, /* Chained toggle keybinds */ - { MODIFIER1, XK_t, XK_t, togglebartags, {0} }, + { MODIFIER1, XK_t, XK_t, togglebartags, {0} }, { MODIFIER1, XK_t, XK_y, togglebaremptytags, {0} }, { MODIFIER1, XK_t, XK_w, togglebartitle, {0} }, + { MODIFIER1, XK_t, XK_u, togglebarunseltitle, {0} }, { MODIFIER1, XK_t, XK_s, togglebarstatus, {0} }, { MODIFIER1, XK_t, XK_l, togglebarlt, {0} }, + { MODIFIER1, XK_t, XK_i, togglebaricon, {0} }, { MODIFIER1, XK_t, XK_o, toggleopacity, {0} }, { MODIFIER1, XK_t, XK_b, togglebarpos, {0} }, //{ MODIFIER1, XK_t, XK_r, resetbar, {0} }, diff --git a/options.h b/options.h index 1560c71..e820eea 100644 --- a/options.h +++ b/options.h @@ -117,6 +117,7 @@ static int underlinevoffset = 0; /* How far above the bottom o static int hidebar = 0; /* Hide the bar (1) or show (0) */ static int hidelayout = 0; /* Hide layout indicator (1) or show (0) */ static int hidetitle = 0; /* Hide the title part of the bar (1) or show (0) */ +static int hideunselectedtitle = 1; /* Hide unselected title (1) or show (0) */ static int hidestatus = 0; /* Hide status bar (1) or show (0) */ static int hideicon = 0; /* Hide icon (1) or show (0) */ static int hidetags = 0; /* Hide status bar (1) or show (0) */ diff --git a/signal.h b/signal.h index 498ea93..9463395 100644 --- a/signal.h +++ b/signal.h @@ -65,6 +65,9 @@ static Signal signals[] = { { 58, scratchpad_remove, {0} }, { 59, reset_layout, {0} }, { 60, resetmastercount, {0} }, +#if USESYSTRAY + { 61, togglesystray, {0} }, +#endif { 62, hideall, {0} }, { 63, showall, {0} }, { 64, reset_mfact, {0} }, @@ -73,8 +76,24 @@ static Signal signals[] = { #endif { 66, viewtoleft_vacant, {0} }, { 67, viewtoright_vacant, {0} }, - { 68, togglebartags, {0} }, - + { 68, togglebartags, {0} }, + { 69, togglebaremptytags, {0} }, + //{ 70, toggletagpowerline, {0} }, + //{ 71, toggletitlepowerline, {0} }, + //{ 72, togglepowerline, {0} }, + //{ 73, toggletagplshape, {0} }, + //{ 74, toggletitleplshape, {0} }, + //{ 75, toggleplshape, {0} }, + //{ 76, resetpowerline, {0} }, + { 77, togglebartitle, {0} }, + { 78, togglebarunseltitle, {0} }, + { 79, togglebarlt, {0} }, + { 80, togglebarstatus, {0} }, + { 81, togglebarfloat, {0} }, + { 82, togglebarsticky, {0} }, + { 83, togglebaricon, {0} }, + { 84, togglebarpos, {0} }, + //{ 86, resetbar, {0} }, { 87, setbarheight, {.i = +1 } }, { 88, setbarheight, {.i = -1 } }, { 89, resetbarheight, {0} }, @@ -107,4 +126,5 @@ static Signal signals[] = { { 116, togglemark, {0} }, { 117, swapfocus, {0} }, { 118, swapclient, {0} }, + { 119, centerwindow, {0} }, }; diff --git a/speedwm.c b/speedwm.c index 04ff178..3b80082 100644 --- a/speedwm.c +++ b/speedwm.c @@ -342,6 +342,7 @@ struct Monitor { int hidefloating; int hidesticky; int hideclientindicator; + int hideunselectedtitle; /* powerline shape */ int tagplshape; @@ -653,6 +654,10 @@ static void togglebartags(const Arg *arg); static void togglesystray(const Arg *arg); #endif static void togglebaremptytags(const Arg *arg); +static void togglebarunseltitle(const Arg *arg); +static void togglebarlt(const Arg *arg); +static void togglebarsticky(const Arg *arg); +static void togglebaricon(const Arg *arg); static void togglebartitle(const Arg *arg); static void togglebarlt(const Arg *arg); static void togglebarstatus(const Arg *arg); @@ -1744,6 +1749,7 @@ createmon(void) m->hidefloating = hidefloating; m->hidesticky = hidesticky; m->hideclientindicator = hideclientindicator; + m->hideunselectedtitle = hideunselectedtitle; /* shape of powerlines */ m->tagplshape = tagplshape; @@ -5525,6 +5531,13 @@ togglebaremptytags(const Arg *arg) arrange(selmon); } +void +togglebarunseltitle(const Arg *arg) +{ + selmon->hideunselectedtitle = !selmon->hideunselectedtitle; + arrange(selmon); +} + void togglebartitle(const Arg *arg) { @@ -5532,6 +5545,20 @@ togglebartitle(const Arg *arg) arrange(selmon); } +void +togglebarsticky(const Arg *arg) +{ + selmon->hidesticky = !selmon->hidesticky; + arrange(selmon); +} + +void +togglebaricon(const Arg *arg) +{ + selmon->hideicon = !selmon->hideicon; + arrange(selmon); +} + void togglebarlt(const Arg *arg) {