Update keybinds, add better hide patch

This commit is contained in:
speediegq 2022-10-22 16:52:17 +02:00
parent 422d7767ca
commit 9bfff2176b
5 changed files with 267 additions and 127 deletions

View file

@ -65,4 +65,13 @@
- 65 | Reload .Xresources on the fly - 65 | Reload .Xresources on the fly
- 66 | Switch to the previous tag, skipping empty tags - 66 | Switch to the previous tag, skipping empty tags
- 67 | Switch to the next tag, skipping empty tags - 67 | Switch to the next tag, skipping empty tags
- 68 | Toggle the tag area in the bar
- 69 | Toggle the empty tags in the bar
- 70 | Toggle the powerline tags in the bar
- 71 | Toggle the title area in the bar
- 72 | Toggle the unselected title area in the bar
- 73 | Toggle the layout area in the bar
- 74 | Toggle the status area in the bar
- 75 | Toggle the floating indicator area in the bar
- 76 | Toggle the sticky indicator area in the bar

View file

@ -24,7 +24,6 @@
These keybinds are for navigating speedwm These keybinds are for navigating speedwm
- Super+t | Reorganize tags and move windows
- Super+f | Full-screen the selected window - Super+f | Full-screen the selected window
- Super+b | Show/hide the speedwm bar - Super+b | Show/hide the speedwm bar
- Super+s | Show/hide the systray - Super+s | Show/hide the systray
@ -46,10 +45,10 @@
- Super+Colon | Open a list of desktop entries in dmenu - Super+Colon | Open a list of desktop entries in dmenu
- Super+0 | Reset mfact - Super+0 | Reset mfact
- Super+r | Reset number of masters - Super+r | Reset number of masters
- Super+t | Disable inactive fade
- Super+Shift+Equal | Toggle scratchpads - Super+Shift+Equal | Toggle scratchpads
- Super+Shift+Minus | Hide the scratchpad - Super+Shift+Minus | Hide the scratchpad
- Super+Shift+Space | Unfloat floating windows - Super+Shift+Space | Toggle floating windows
- Super+y | Make the current selected window sticky
- Super+Shift+Arrow | Resizes a window in floating mode - Super+Shift+Arrow | Resizes a window in floating mode
- Super+1 | Move to tag 1 - Super+1 | Move to tag 1
- Super+2 | Move to tag 2 - Super+2 | Move to tag 2
@ -115,6 +114,15 @@
-- Chained keybinds -- -- Chained keybinds --
- Super+t & r | Reorganize tags and move windows
- Super+t & t | Toggle tag area in the bar
- Super+t & y | Toggle empty tag area in the bar
- Super+t & w | Toggle title area in the bar
- Super+t & u | Toggle unselected title area in the bar
- Super+t & p | Toggle powerline tags in the bar
- Super+t & s | Toggle status area in the bar
- Super+t & l | Toggle layout area in the bar
- Super+t & o | Toggle inactive fade
- Super+c & w | Get the weather (Using wttr.in) - Super+c & w | Get the weather (Using wttr.in)
- Super+c & n | Switch to the next track - Super+c & n | Switch to the next track
- Super+c & p | Switch to the previous track - Super+c & p | Switch to the previous track

View file

@ -119,9 +119,10 @@ static Key keys[] = {
{ MODIFIER1|SHIFT, -1, XK_k, inplacerotate, {.i = -1} }, { MODIFIER1|SHIFT, -1, XK_k, inplacerotate, {.i = -1} },
{ MODIFIER1|SHIFT, -1, XK_h, inplacerotate, {.i = +2} }, { MODIFIER1|SHIFT, -1, XK_h, inplacerotate, {.i = +2} },
{ MODIFIER1|SHIFT, -1, XK_l, inplacerotate, {.i = -2} }, { MODIFIER1|SHIFT, -1, XK_l, inplacerotate, {.i = -2} },
{ MODIFIER1, -1, XK_n, incmastercount, {.i = -1 } }, { MODIFIER1, -1, XK_n, incmastercount, {.i = -1 } },
{ MODIFIER1, -1, XK_i, incmastercount, {.i = +1 } }, { MODIFIER1, -1, XK_i, incmastercount, {.i = +1 } },
{ MODIFIER1, -1, XK_t, toggleopacity, {0} }, { MODIFIER1, -1, XK_t, toggleopacity, {0} },
{ MODIFIER1, -1, XK_y, togglesticky, {0} },
/* Floating mode keybinds */ /* Floating mode keybinds */
{ MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} }, { MODIFIER1, -1, XK_w, moveresizeaspect, {.i = +24} },
@ -153,7 +154,6 @@ static Key keys[] = {
TAGKEYS( -1, XK_7, 6) TAGKEYS( -1, XK_7, 6)
TAGKEYS( -1, XK_8, 7) TAGKEYS( -1, XK_8, 7)
TAGKEYS( -1, XK_9, 8) TAGKEYS( -1, XK_9, 8)
{ MODIFIER1, -1, XK_t, reorganizetags, {0} },
{ MODIFIER1|CONTROL, -1, XK_a, viewtoleft, {0} }, { MODIFIER1|CONTROL, -1, XK_a, viewtoleft, {0} },
{ MODIFIER1|CONTROL, -1, XK_d, viewtoright, {0} }, { MODIFIER1|CONTROL, -1, XK_d, viewtoright, {0} },
{ MODIFIER1|CONTROL|SHIFT, -1, XK_z, viewtoleft_vacant, {0} }, { MODIFIER1|CONTROL|SHIFT, -1, XK_z, viewtoleft_vacant, {0} },
@ -171,7 +171,18 @@ static Key keys[] = {
{ MODIFIER1, XK_c, XK_p, spawn, cmd( PREVMUSIC ) }, { MODIFIER1, XK_c, XK_p, spawn, cmd( PREVMUSIC ) },
{ MODIFIER1, XK_r, XK_s, spawn, cmd( "screenkey" ) }, { MODIFIER1, XK_r, XK_s, spawn, cmd( "screenkey" ) },
{ MODIFIER1, XK_r, XK_d, spawn, cmd( "pkill screenkey" ) }, { MODIFIER1, XK_r, XK_d, spawn, cmd( "pkill screenkey" ) },
{ MODIFIER1, XK_t, XK_s, togglesticky, {0} },
{ MODIFIER1, XK_t, XK_t, togglebartags, {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_p, togglebarpowerline, {0} },
{ MODIFIER1, XK_t, XK_y, togglebaremptytags, {0} },
{ MODIFIER1, XK_t, XK_l, togglebarlt, {0} },
{ MODIFIER1, XK_t, XK_o, toggleopacity, {0} },
{ MODIFIER1, XK_t, XK_r, reorganizetags, {0} },
{ MODIFIER1, XK_w, XK_r, spawn, cmd( "speedwm-swal --randomize" ) }, { MODIFIER1, XK_w, XK_r, spawn, cmd( "speedwm-swal --randomize" ) },
{ MODIFIER1, XK_w, XK_p, spawn, cmd( "speedwm-swal --previous" ) }, { MODIFIER1, XK_w, XK_p, spawn, cmd( "speedwm-swal --previous" ) },
{ MODIFIER1|SHIFT, XK_k, XK_o, killunsel, {0} }, { MODIFIER1|SHIFT, XK_k, XK_o, killunsel, {0} },

143
signal.h
View file

@ -6,102 +6,111 @@
static Signal signals[] = { static Signal signals[] = {
/* signum function argument */ /* signum function argument */
#if LAYOUT_CUSTOM #if LAYOUT_CUSTOM
{ 15, set_s_layout, {.v = &layouts[13]} }, { 15, set_s_layout, {.v = &layouts[13]} },
#endif #endif
{ 16, cyclelayout, {.i = +1 } }, { 16, cyclelayout, {.i = +1 } },
{ 17, cyclelayout, {.i = -1 } }, { 17, cyclelayout, {.i = -1 } },
{ 18, setmfact, {.f = +0.05} }, { 18, setmfact, {.f = +0.05} },
{ 19, setmfact, {.f = -0.05} }, { 19, setmfact, {.f = -0.05} },
{ 20, togglesticky, {0} }, { 20, togglesticky, {0} },
{ 21, togglebar, {0} }, { 21, togglebar, {0} },
{ 22, togglefullscr, {0} }, { 22, togglefullscr, {0} },
{ 23, togglefloating, {0} }, { 23, togglefloating, {0} },
{ 24, zoom, {0} }, { 24, zoom, {0} },
{ 25, reorganizetags, {0} }, { 25, reorganizetags, {0} },
{ 26, quit, {0} }, { 26, quit, {0} },
{ 27, quit, {1} }, { 27, quit, {1} },
{ 28, show, {0} }, { 28, show, {0} },
{ 29, hide, {0} }, { 29, hide, {0} },
{ 30, killclient, {0} }, { 30, killclient, {0} },
{ 31, inplacerotate, {.i = +1 } }, { 31, inplacerotate, {.i = +1 } },
{ 32, inplacerotate, {.i = -1 } }, { 32, inplacerotate, {.i = -1 } },
{ 33, incmastercount, {.i = +1 } }, { 33, incmastercount, {.i = +1 } },
{ 34, incmastercount, {.i = -1 } }, { 34, incmastercount, {.i = -1 } },
{ 35, focusmaster, {0} }, { 35, focusmaster, {0} },
{ 36, focusstackvis, {.i = +1 } }, { 36, focusstackvis, {.i = +1 } },
{ 37, focusstackvis, {.i = -1 } }, { 37, focusstackvis, {.i = -1 } },
{ 38, focusstackhid, {.i = +1 } }, { 38, focusstackhid, {.i = +1 } },
{ 39, focusstackhid, {.i = -1 } }, { 39, focusstackhid, {.i = -1 } },
{ 40, toggleopacity, {0} }, { 40, toggleopacity, {0} },
{ 41, setcfact, {.f = +0.05 } }, { 41, setcfact, {.f = +0.05 } },
{ 42, setcfact, {.f = -0.05 } }, { 42, setcfact, {.f = -0.05 } },
{ 43, viewtoleft, {0} }, { 43, viewtoleft, {0} },
{ 44, viewtoright, {0} }, { 44, viewtoright, {0} },
{ 45, defaultgaps, {0} }, { 45, defaultgaps, {0} },
{ 46, togglegaps, {0} }, { 46, togglegaps, {0} },
{ 47, incrgaps, {.i = +1 } }, { 47, incrgaps, {.i = +1 } },
{ 48, incrgaps, {.i = -1 } }, { 48, incrgaps, {.i = -1 } },
{ 49, incrigaps, {.i = +1 } }, { 49, incrigaps, {.i = +1 } },
{ 50, incrigaps, {.i = -1 } }, { 50, incrigaps, {.i = -1 } },
{ 51, incrogaps, {.i = +1 } }, { 51, incrogaps, {.i = +1 } },
{ 52, incrogaps, {.i = -1 } }, { 52, incrogaps, {.i = -1 } },
{ 53, killunsel, {0} }, { 53, killunsel, {0} },
{ 54, focusmon, {.i = +1 } }, { 54, focusmon, {.i = +1 } },
{ 55, focusmon, {.i = -1 } }, { 55, focusmon, {.i = -1 } },
{ 56, scratchpad_show, {0} }, { 56, scratchpad_show, {0} },
{ 57, scratchpad_hide, {0} }, { 57, scratchpad_hide, {0} },
{ 58, scratchpad_remove, {0} }, { 58, scratchpad_remove, {0} },
{ 59, reset_layout, {0} }, { 59, reset_layout, {0} },
{ 60, resetmastercount, {0} }, { 60, resetmastercount, {0} },
#if USESYSTRAY #if USESYSTRAY
{ 61, togglesystray, {0} }, { 61, togglesystray, {0} },
#endif #endif
{ 62, hideall, {0} }, { 62, hideall, {0} },
{ 63, showall, {0} }, { 63, showall, {0} },
{ 64, reset_mfact, {0} }, { 64, reset_mfact, {0} },
#if USEXRESOURCES #if USEXRESOURCES
{ 65, reloadcolors, {0} }, { 65, reloadcolors, {0} },
#endif #endif
{ 66, viewtoleft_vacant, {0} }, { 66, viewtoleft_vacant, {0} },
{ 67, viewtoright_vacant,{0} }, { 67, viewtoright_vacant, {0} },
{ 68, togglebartags, {0} },
{ 69, togglebaremptytags, {0} },
{ 70, togglebarpowerline, {0} },
{ 71, togglebartitle, {0} },
{ 72, togglebarunseltitle,{0} },
{ 73, togglebarlt, {0} },
{ 74, togglebarstatus, {0} },
{ 75, togglebarfloat, {0} },
{ 76, togglebarsticky, {0} },
#if LAYOUT_TILE #if LAYOUT_TILE
{ 1, setlayout, {.v = &layouts[0]} }, /* Tiling layout */ { 1, setlayout, {.v = &layouts[0]} }, /* Tiling layout */
#endif #endif
{ 2, setlayout, {.v = &layouts[1]} }, /* Floating layout */ { 2, setlayout, {.v = &layouts[1]} }, /* Floating layout */
#if LAYOUT_MONOCLE #if LAYOUT_MONOCLE
{ 3, setlayout, {.v = &layouts[2]} }, /* Monocle layout */ { 3, setlayout, {.v = &layouts[2]} }, /* Monocle layout */
#endif #endif
#if LAYOUT_GRID #if LAYOUT_GRID
{ 4, setlayout, {.v = &layouts[3]} }, /* Grid layout */ { 4, setlayout, {.v = &layouts[3]} }, /* Grid layout */
#endif #endif
#if LAYOUT_DECK #if LAYOUT_DECK
{ 5, setlayout, {.v = &layouts[4]} }, /* Deck layout */ { 5, setlayout, {.v = &layouts[4]} }, /* Deck layout */
#endif #endif
#if LAYOUT_CM #if LAYOUT_CM
{ 6, setlayout, {.v = &layouts[5]} }, /* Centered Master layout */ { 6, setlayout, {.v = &layouts[5]} }, /* Centered Master layout */
#endif #endif
#if LAYOUT_CFM #if LAYOUT_CFM
{ 7, setlayout, {.v = &layouts[6]} }, /* Centered Floating Master layout */ { 7, setlayout, {.v = &layouts[6]} }, /* Centered Floating Master layout */
#endif #endif
#if LAYOUT_SPIRAL #if LAYOUT_SPIRAL
{ 8, setlayout, {.v = &layouts[7]} }, /* Fibonacci Spiral layout */ { 8, setlayout, {.v = &layouts[7]} }, /* Fibonacci Spiral layout */
#endif #endif
#if LAYOUT_DWINDLE #if LAYOUT_DWINDLE
{ 9, setlayout, {.v = &layouts[8]} }, /* Fibonacci Dwindle layout */ { 9, setlayout, {.v = &layouts[8]} }, /* Fibonacci Dwindle layout */
#endif #endif
#if LAYOUT_BSTACK #if LAYOUT_BSTACK
{ 10, setlayout, {.v = &layouts[9]} }, /* Bottom Stack layout */ { 10, setlayout, {.v = &layouts[9]} }, /* Bottom Stack layout */
#endif #endif
#if LAYOUT_BSTACKH #if LAYOUT_BSTACKH
{ 11, setlayout, {.v = &layouts[10]} }, /* Horizontal Bottom Stack layout */ { 11, setlayout, {.v = &layouts[10]} }, /* Horizontal Bottom Stack layout */
#endif #endif
#if LAYOUT_HGRID #if LAYOUT_HGRID
{ 12, setlayout, {.v = &layouts[11]} }, /* Horizontal Grid layout */ { 12, setlayout, {.v = &layouts[11]} }, /* Horizontal Grid layout */
#endif #endif
#if LAYOUT_DGRID #if LAYOUT_DGRID
{ 13, setlayout, {.v = &layouts[12]} }, /* Dynamic Grid layout */ { 13, setlayout, {.v = &layouts[12]} }, /* Dynamic Grid layout */
#endif #endif
#if LAYOUT_CUSTOM #if LAYOUT_CUSTOM
{ 14, setlayout, {.v = &layouts[13]} }, /* Custom layout */ { 14, setlayout, {.v = &layouts[13]} }, /* Custom layout */
#endif #endif
}; };

209
speedwm.c
View file

@ -261,6 +261,20 @@ struct Monitor {
int previewshow; int previewshow;
#endif #endif
int showbar; int showbar;
/* bar items */
int hidelayout;
int hidetitle;
int hideunselectedtitle;
int hidestatus;
int hideicon;
int hidetags;
int hidesystray;
int hideemptytags;
int hidepowerline;
int hidefloating;
int hidesticky;
int barposition; int barposition;
int hidsel; int hidsel;
int isreset; int isreset;
@ -582,6 +596,18 @@ static void empty(Monitor *m);
#endif #endif
static void togglebar(const Arg *arg); static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg); static void togglefloating(const Arg *arg);
/* bar items */
static void togglebartags(const Arg *arg);
static void togglebaremptytags(const Arg *arg);
static void togglebartitle(const Arg *arg);
static void togglebarunseltitle(const Arg *arg);
static void togglebarpowerline(const Arg *arg);
static void togglebarlt(const Arg *arg);
static void togglebarstatus(const Arg *arg);
static void togglebarfloat(const Arg *arg);
static void togglebarsticky(const Arg *arg);
static void toggleopacity(const Arg *arg); static void toggleopacity(const Arg *arg);
static void togglefullscr(const Arg *arg); static void togglefullscr(const Arg *arg);
#if USEWINICON #if USEWINICON
@ -1171,32 +1197,32 @@ buttonpress(XEvent *e)
if (ev->window == selmon->barwin) { if (ev->window == selmon->barwin) {
/* powerline */ /* powerline */
if (!hidepowerline) { if (!selmon->hidepowerline) {
i = 0; x = plw; occ = 0; i = 0; x = plw; occ = 0;
} else { } else {
i = x = occ = 0; i = x = occ = 0;
} }
/* powerline */ /* powerline */
if (!hidepowerline) if (!selmon->hidepowerline)
x = plw; x = plw;
/* Bitmask of occupied tags */ /* Bitmask of occupied tags */
for (c = m->clients; c; c = c->next) for (c = m->clients; c; c = c->next)
occ |= c->tags; occ |= c->tags;
if (layoutposition && !hidelayout) { if (layoutposition && !selmon->hidelayout) {
x += TEXTW(m->ltsymbol); x += TEXTW(m->ltsymbol);
} if (ev->x < x && layoutposition && !selmon->isreset && !hidelayout) { } if (ev->x < x && layoutposition && !selmon->isreset && !selmon->hidelayout) {
click = ClkLtSymbol; /* left layout */ click = ClkLtSymbol; /* left layout */
} else { } else {
do { do {
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && hideemptytags) if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && selmon->hideemptytags)
continue; continue;
if (!hidetags && hideemptytags) if (!selmon->hidetags && selmon->hideemptytags)
x += TEXTW(occ & 1 << i ? usedtags[i] : tags[i]) + plw; x += TEXTW(occ & 1 << i ? usedtags[i] : tags[i]) + plw;
} while (ev->x >= x && ++i < LENGTH(tags)); } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags) && !hidetags) { if (i < LENGTH(tags) && !selmon->hidetags) {
click = ClkTagBar; click = ClkTagBar;
if ( ev->button == Button4 || ev->button == Button5 ) { if ( ev->button == Button4 || ev->button == Button5 ) {
arg.ui = selmon->tagset[selmon->seltags]; arg.ui = selmon->tagset[selmon->seltags];
@ -1219,7 +1245,7 @@ buttonpress(XEvent *e)
} else if (ev->x < x + TEXTW(selmon->ltsymbol) && !layoutposition && !selmon->isreset) /* right layout */ } else if (ev->x < x + TEXTW(selmon->ltsymbol) && !layoutposition && !selmon->isreset) /* right layout */
click = ClkLtSymbol; /* right layout */ click = ClkLtSymbol; /* right layout */
else if (ev->x > selmon->ww - statusw + lrpad - 2 - getsystraywidth() && !hidestatus) { else if (ev->x > selmon->ww - statusw + lrpad - 2 - getsystraywidth() && !selmon->hidestatus) {
x = selmon->ww - statusw + lrpad - 2 * sp - getsystraywidth() - 2; x = selmon->ww - statusw + lrpad - 2 * sp - getsystraywidth() - 2;
click = ClkStatusText; click = ClkStatusText;
char *text = rawstext; char *text = rawstext;
@ -1240,8 +1266,8 @@ buttonpress(XEvent *e)
statuscmdn = ch; statuscmdn = ch;
} }
} }
} else if (!hideunselectedtitle) { } else if (!selmon->hideunselectedtitle) {
if (!layoutposition && !hidelayout) { if (!layoutposition && !selmon->hidelayout) {
x += TEXTW(m->ltsymbol); /* Left layout does not need this */ x += TEXTW(m->ltsymbol); /* Left layout does not need this */
} }
@ -1249,7 +1275,7 @@ buttonpress(XEvent *e)
* This is not required, but you won't be able to see what you're clicking so we might as well disable it */ * This is not required, but you won't be able to see what you're clicking so we might as well disable it */
c = m->clients; c = m->clients;
if (c && !hidetitle) { if (c && !selmon->hidetitle) {
do { do {
if (!c || !ISVISIBLE(c)) if (!c || !ISVISIBLE(c))
continue; continue;
@ -1309,7 +1335,7 @@ cleanup(void)
cleanupmon(mons); cleanupmon(mons);
#if USESYSTRAY #if USESYSTRAY
if (!hidesystray) { if (!selmon->hidesystray) {
XUnmapWindow(dpy, systray->win); XUnmapWindow(dpy, systray->win);
XDestroyWindow(dpy, systray->win); XDestroyWindow(dpy, systray->win);
free(systray); free(systray);
@ -1381,7 +1407,7 @@ clientmessage(XEvent *e)
XWindowAttributes wa; XWindowAttributes wa;
XSetWindowAttributes swa; XSetWindowAttributes swa;
if (!hidesystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) { if (!selmon->hidesystray && cme->window == systray->win && cme->message_type == netatom[NetSystemTrayOP]) {
/* add systray icons */ /* add systray icons */
if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) { if (cme->data.l[1] == SYSTEM_TRAY_REQUEST_DOCK) {
if (!(c = (Client *)calloc(1, sizeof(Client)))) if (!(c = (Client *)calloc(1, sizeof(Client))))
@ -1626,6 +1652,20 @@ createmon(void)
m->mfact = mfact; m->mfact = mfact;
m->mastercount = mastercount; m->mastercount = mastercount;
m->showbar = !hidebar; m->showbar = !hidebar;
/* bar items */
m->hidelayout = hidelayout;
m->hidetitle = hidetitle;
m->hideunselectedtitle = hideunselectedtitle;
m->hidestatus = hidestatus;
m->hideicon = hideicon;
m->hidetags = hidetags;
m->hidesystray = hidesystray;
m->hideemptytags = hideemptytags;
m->hidepowerline = hidepowerline;
m->hidefloating = hidefloating;
m->hidesticky = hidesticky;
m->barposition = barposition; m->barposition = barposition;
m->bh = bh; m->bh = bh;
m->gapsizeih = gapsizeih; m->gapsizeih = gapsizeih;
@ -1970,7 +2010,7 @@ drawstatusbar(Monitor *m, int bh, char* stext) {
w += 2; /* 1px padding on both sides */ w += 2; /* 1px padding on both sides */
ret = x = m->ww - w - 2 * sp - ((!hidesystray && m == systraytomon(m)) ? getsystraywidth() : 0); ret = x = m->ww - w - 2 * sp - ((!selmon->hidesystray && m == systraytomon(m)) ? getsystraywidth() : 0);
drw_setscheme(drw, scheme[LENGTH(colors)]); drw_setscheme(drw, scheme[LENGTH(colors)]);
drw->scheme[ColFg] = scheme[SchemeStatus][ColFg]; drw->scheme[ColFg] = scheme[SchemeStatus][ColFg];
@ -2203,7 +2243,7 @@ drawbaritems(Monitor *m)
int wt; int wt;
Clr *prevscheme, *nxtscheme; /* powerline schemes */ Clr *prevscheme, *nxtscheme; /* powerline schemes */
if (!hidepowerline) if (!selmon->hidepowerline)
plw = drw->fonts->h / 2 + 1; plw = drw->fonts->h / 2 + 1;
/* indicators */ /* indicators */
@ -2223,14 +2263,14 @@ drawbaritems(Monitor *m)
return; return;
#if USESYSTRAY #if USESYSTRAY
if(!hidesystray && m == systraytomon(m) && !systrayposition) if(!selmon->hidesystray && m == systraytomon(m) && !systrayposition)
stw = getsystraywidth(); stw = getsystraywidth();
#endif #endif
/* draw status first so it can be overdrawn by tags later */ /* draw status first so it can be overdrawn by tags later */
if (m == selmon || 1) { /* status is only drawn on selected monitor */ if (m == selmon || 1) { /* status is only drawn on selected monitor */
char *text, *s, ch; char *text, *s, ch;
if (!hidestatus) { if (!selmon->hidestatus) {
tw = statusw = m->ww - drawstatusbar(m, bh, stext) - getsystraywidth(); tw = statusw = m->ww - drawstatusbar(m, bh, stext) - getsystraywidth();
} }
#if USESYSTRAY #if USESYSTRAY
@ -2256,12 +2296,12 @@ resizebarwin(m);
if (ISVISIBLE(c)) if (ISVISIBLE(c))
n++; n++;
occ |= c->tags; occ |= c->tags;
if (c->isurgent && !hidetags) if (c->isurgent && !selmon->hidetags)
urg |= c->tags; urg |= c->tags;
} }
/* draw the layout bar on the left if layoutposition = 1 and we're not hiding the layout */ /* draw the layout bar on the left if layoutposition = 1 and we're not hiding the layout */
if (layoutposition && !hidelayout) { if (layoutposition && !selmon->hidelayout) {
w = TEXTW(m->ltsymbol); w = TEXTW(m->ltsymbol);
/* color with the bar color if !colorlayout */ /* color with the bar color if !colorlayout */
@ -2273,16 +2313,16 @@ resizebarwin(m);
} }
/* draw tags */ /* draw tags */
if (!hidetags) { if (!selmon->hidetags) {
for (i = 0; i < LENGTH(tags); i++) { for (i = 0; i < LENGTH(tags); i++) {
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && hideemptytags) if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i) && selmon->hideemptytags)
continue; continue;
if (!hidetags) { if (!selmon->hidetags) {
tagtext = occ & 1 << i ? usedtags[i] : tags[i]; tagtext = occ & 1 << i ? usedtags[i] : tags[i];
w = TEXTW(tagtext); w = TEXTW(tagtext);
/* draw powerlined tags */ /* draw powerlined tags */
if (!hidepowerline) { if (!selmon->hidepowerline) {
prevscheme = scheme[SchemeBar]; /* previous scheme = scheme */ prevscheme = scheme[SchemeBar]; /* previous scheme = scheme */
if (urg & 1 << i && allowurgent) if (urg & 1 << i && allowurgent)
drw_settrans(drw, prevscheme, (nxtscheme = scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsUrg])); /* set transition colorscheme */ drw_settrans(drw, prevscheme, (nxtscheme = scheme[m->tagset[m->seltags] & 1 << i ? SchemeTagsSel : SchemeTagsUrg])); /* set transition colorscheme */
@ -2312,7 +2352,7 @@ resizebarwin(m);
} }
/* draw end of powerline tags */ /* draw end of powerline tags */
if (!hidepowerline) { if (!selmon->hidepowerline) {
prevscheme = nxtscheme; /* previous scheme = next colorscheme */ prevscheme = nxtscheme; /* previous scheme = next colorscheme */
nxtscheme = scheme[SchemeBar]; /* next colorscheme = bar color */ nxtscheme = scheme[SchemeBar]; /* next colorscheme = bar color */
drw_settrans(drw, prevscheme, nxtscheme); /* set transition colorscheme */ drw_settrans(drw, prevscheme, nxtscheme); /* set transition colorscheme */
@ -2337,7 +2377,7 @@ resizebarwin(m);
#endif #endif
/* draw the layout bar on the right if layoutposition is not 0 */ /* draw the layout bar on the right if layoutposition is not 0 */
if (!layoutposition && !hidelayout) { if (!layoutposition && !selmon->hidelayout) {
w = TEXTW(m->ltsymbol); w = TEXTW(m->ltsymbol);
drw_setscheme(drw, scheme[SchemeLayout]); drw_setscheme(drw, scheme[SchemeLayout]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0); x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
@ -2348,14 +2388,14 @@ resizebarwin(m);
#else #else
if ((w = m->ww - tw - x) > bh) { if ((w = m->ww - tw - x) > bh) {
#endif #endif
if (n > 0 && !hidetitle) { if (n > 0 && !selmon->hidetitle) {
int remainder; int remainder;
int tabw; int tabw;
int docontinue; int docontinue;
/* we're doing this to make sure the title does not get truncated when there's only supposed to be one title anyway */ /* we're doing this to make sure the title does not get truncated when there's only supposed to be one title anyway */
if (!hideunselectedtitle) { if (!selmon->hideunselectedtitle) {
remainder = w % n; /* remainder of the title area */ remainder = w % n; /* remainder of the title area */
tabw = (1.0 / (double)n) * w + 1; /* width of each tab (client in the title area) */ tabw = (1.0 / (double)n) * w + 1; /* width of each tab (client in the title area) */
} else { } else {
@ -2371,29 +2411,29 @@ resizebarwin(m);
continue; continue;
/* hide unselected title */ /* hide unselected title */
if (m->sel != c && hideunselectedtitle) { if (m->sel != c && selmon->hideunselectedtitle) {
docontinue = 1; /* we're going to continue */ docontinue = 1; /* we're going to continue */
continue; continue;
} }
/* selected clients */ /* selected clients */
if (m->sel == c && colorselectedtitle) { if (m->sel == c && colorselectedtitle) {
if (!hideunselectedtitle) if (!selmon->hideunselectedtitle)
scm = SchemeTitleSel; scm = SchemeTitleSel;
/* hidden clients */ /* hidden clients */
} else if (HIDDEN(c) && colorhiddentitle) { } else if (HIDDEN(c) && colorhiddentitle) {
if (!hideunselectedtitle) if (!selmon->hideunselectedtitle)
scm = SchemeTitleHidden; scm = SchemeTitleHidden;
/* unselected clients */ /* unselected clients */
} else { } else {
if (!hideunselectedtitle) if (!selmon->hideunselectedtitle)
scm = SchemeTitleNorm; scm = SchemeTitleNorm;
} }
/* apply colors */ /* apply colors */
if (!hideunselectedtitle) { if (!selmon->hideunselectedtitle) {
if (colorselectedtitle) { if (colorselectedtitle) {
drw_setscheme(drw, scheme[scm]); drw_setscheme(drw, scheme[scm]);
} else { } else {
@ -2408,7 +2448,7 @@ resizebarwin(m);
} }
/* we don't need this if we're only printing focused */ /* we don't need this if we're only printing focused */
if (!hideunselectedtitle) { if (!selmon->hideunselectedtitle) {
if (remainder >= 0) { if (remainder >= 0) {
if (remainder == 0) { if (remainder == 0) {
tabw--; tabw--;
@ -2426,7 +2466,7 @@ resizebarwin(m);
/* draw title and icon */ /* draw title and icon */
#if USEWINICON #if USEWINICON
if (hideicon) { if (selmon->hideicon) {
#endif #endif
drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0); drw_text(drw, x, 0, tabw, bh, lrpad / 2, c->name, 0);
#if USEWINICON #if USEWINICON
@ -2438,12 +2478,12 @@ resizebarwin(m);
#endif #endif
/* draw sticky window indicator */ /* draw sticky window indicator */
if (c->issticky && !hidesticky) { if (c->issticky && !selmon->hidesticky) {
drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & c->mon->tagset[c->mon->seltags]); drw_polygon(drw, x + boxs, c->isfloating ? boxs * 2 + boxw : boxs, stickyiconbb.x, stickyiconbb.y, boxw, boxw * stickyiconbb.y / stickyiconbb.x, stickyicon, LENGTH(stickyicon), Nonconvex, c->tags & c->mon->tagset[c->mon->seltags]);
} }
/* draw floating window indicator */ /* draw floating window indicator */
if (c->isfloating && !hidefloating) { if (c->isfloating && !selmon->hidefloating) {
drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0); drw_rect(drw, x + boxs, boxs, boxw, boxw, c->isfixed, 0);
} }
@ -2815,7 +2855,7 @@ getsystraywidth()
#if USESYSTRAY #if USESYSTRAY
unsigned int w = 0; unsigned int w = 0;
Client *i; Client *i;
if(!hidesystray) if(!selmon->hidesystray)
for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ; for(i = systray->icons; i; w += i->w + systrayspacing, i = i->next) ;
return w ? w + systrayspacing : 1; return w ? w + systrayspacing : 1;
#else #else
@ -2827,9 +2867,9 @@ getsystraywidth()
void void
togglesystray() togglesystray()
{ {
if (!hidesystray) if (!selmon->hidesystray)
XUnmapWindow(dpy, systray->win); XUnmapWindow(dpy, systray->win);
hidesystray = !hidesystray; selmon->hidesystray = !selmon->hidesystray;
updatesystray(); updatesystray();
updatestatus(); updatestatus();
} }
@ -3536,11 +3576,11 @@ motionnotify(XEvent *e)
for (c = selmon->clients; c; c = c->next) for (c = selmon->clients; c; c = c->next)
occ |= c->tags == 255 ? 0 : c->tags; occ |= c->tags == 255 ? 0 : c->tags;
do { do {
if (!(occ & 1 << i || selmon->seltags & 1 << i) && hideemptytags) if (!(occ & 1 << i || selmon->seltags & 1 << i) && selmon->hideemptytags)
continue; continue;
x += TEXTW(tags[i]) + lts + plw; x += TEXTW(tags[i]) + lts + plw;
} while (ev->x >= x && ++i < LENGTH(tags)); } while (ev->x >= x && ++i < LENGTH(tags));
if (mousepreview && !hidetags) { if (mousepreview && !selmon->hidetags) {
if (i < LENGTH(tags)) { if (i < LENGTH(tags)) {
if (selmon->previewshow != (i + 1) if (selmon->previewshow != (i + 1)
&& !(selmon->seltags & 1 << i)) { && !(selmon->seltags & 1 << i)) {
@ -3561,7 +3601,7 @@ motionnotify(XEvent *e)
selmon->previewshow = 0; selmon->previewshow = 0;
XUnmapWindow(dpy, selmon->tagwin); XUnmapWindow(dpy, selmon->tagwin);
} }
} /* mousepreview && !hidetags */ } /* mousepreview && !selmon->hidetags */
#endif #endif
if (ev->window != root) if (ev->window != root)
return; return;
@ -4369,7 +4409,7 @@ propertynotify(XEvent *e)
if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) { if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
updatetitle(c); updatetitle(c);
updaterules(c); updaterules(c);
if (c == c->mon->sel && !hidetitle) if (c == c->mon->sel && !selmon->hidetitle)
drawbaritems(c->mon); drawbaritems(c->mon);
} }
#if USEWINICON #if USEWINICON
@ -4504,7 +4544,7 @@ removesystrayicon(Client *i)
{ {
Client **ii; Client **ii;
if (hidesystray || !i) if (selmon->hidesystray || !i)
return; return;
for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next); for (ii = &systray->icons; *ii && *ii != i; ii = &(*ii)->next);
if (ii) if (ii)
@ -4515,7 +4555,7 @@ removesystrayicon(Client *i)
void void
resizebarwin(Monitor *m) { resizebarwin(Monitor *m) {
unsigned int w = m->ww; unsigned int w = m->ww;
if (!hidesystray && m == systraytomon(m) && !systrayposition) if (!selmon->hidesystray && m == systraytomon(m) && !systrayposition)
w -= getsystraywidth(); w -= getsystraywidth();
XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh); XMoveResizeWindow(dpy, m->barwin, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh);
} }
@ -5479,7 +5519,7 @@ togglebar(const Arg *arg)
updatebarpos(selmon); updatebarpos(selmon);
#if USESYSTRAY #if USESYSTRAY
resizebarwin(selmon); resizebarwin(selmon);
if (!hidesystray) { if (!selmon->hidesystray) {
XWindowChanges wc; XWindowChanges wc;
if (!selmon->showbar) if (!selmon->showbar)
wc.y = -bh; wc.y = -bh;
@ -5499,6 +5539,69 @@ togglebar(const Arg *arg)
arrange(selmon); arrange(selmon);
} }
void
togglebartags(const Arg *arg)
{
selmon->hidetags = !selmon->hidetags;
arrange(selmon);
}
void
togglebaremptytags(const Arg *arg)
{
selmon->hideemptytags = !selmon->hideemptytags;
arrange(selmon);
}
void
togglebarunseltitle(const Arg *arg)
{
selmon->hideunselectedtitle = !selmon->hideunselectedtitle;
arrange(selmon);
}
void
togglebarpowerline(const Arg *arg)
{
selmon->hidepowerline = !selmon->hidepowerline;
arrange(selmon);
}
void
togglebartitle(const Arg *arg)
{
selmon->hidetitle = !selmon->hidetitle;
arrange(selmon);
}
void
togglebarlt(const Arg *arg)
{
selmon->hidelayout = !selmon->hidelayout;
arrange(selmon);
}
void
togglebarstatus(const Arg *arg)
{
selmon->hidestatus = !selmon->hidestatus;
arrange(selmon);
}
void
togglebarfloat(const Arg *arg)
{
selmon->hidefloating = !selmon->hidefloating;
arrange(selmon);
}
void
togglebarsticky(const Arg *arg)
{
selmon->hidesticky = !selmon->hidesticky;
arrange(selmon);
}
void void
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
@ -5714,7 +5817,7 @@ updatebars(void)
continue; continue;
#if USESYSTRAY #if USESYSTRAY
w = m->ww; w = m->ww;
if (!hidesystray && m == systraytomon(m)) if (!selmon->hidesystray && m == systraytomon(m))
w -= getsystraywidth(); w -= getsystraywidth();
#endif #endif
m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth, m->barwin = XCreateWindow(dpy, root, m->wx + sp, m->by + vp, m->ww - 2 * sp, bh, 0, depth,
@ -5723,7 +5826,7 @@ updatebars(void)
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor); XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
#if USESYSTRAY #if USESYSTRAY
if (!hidesystray && m == systraytomon(m)) if (!selmon->hidesystray && m == systraytomon(m))
XMapRaised(dpy, systray->win); XMapRaised(dpy, systray->win);
#endif #endif
@ -5970,11 +6073,11 @@ void
updatestatus(void) updatestatus(void)
{ {
Monitor* m; Monitor* m;
if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)) && !hidestatus) { if (!gettextprop(root, XA_WM_NAME, rawstext, sizeof(rawstext)) && !selmon->hidestatus) {
strcpy(stext, defaultstatus); strcpy(stext, defaultstatus);
statusw = TEXTW(stext) - lrpad + 2; statusw = TEXTW(stext) - lrpad + 2;
} else { } else {
if (!hidestatus) { if (!selmon->hidestatus) {
copyvalidchars(stext, rawstext); copyvalidchars(stext, rawstext);
char *text, *s, ch; char *text, *s, ch;
statusw = 0; statusw = 0;
@ -6376,7 +6479,7 @@ updatesystrayiconstate(Client *i, XPropertyEvent *ev)
long flags; long flags;
int code = 0; int code = 0;
if (hidesystray || !i || ev->atom != xatom[XembedInfo] || if (selmon->hidesystray || !i || ev->atom != xatom[XembedInfo] ||
!(flags = getatomprop(i, xatom[XembedInfo]))) !(flags = getatomprop(i, xatom[XembedInfo])))
return; return;
@ -6410,7 +6513,7 @@ updatesystray(void)
unsigned int sw = TEXTW(stext) - lrpad + systrayspacing; unsigned int sw = TEXTW(stext) - lrpad + systrayspacing;
unsigned int w = 1; unsigned int w = 1;
if (hidesystray) if (selmon->hidesystray)
return; return;
if (systrayposition) if (systrayposition)
x -= sw + lrpad / 2; x -= sw + lrpad / 2;
@ -6470,7 +6573,7 @@ Client *
wintosystrayicon(Window w) { wintosystrayicon(Window w) {
Client *i = NULL; Client *i = NULL;
if (hidesystray || !w) if (selmon->hidesystray || !w)
return i; return i;
for (i = systray->icons; i && i->win != w; i = i->next) ; for (i = systray->icons; i && i->win != w; i = i->next) ;
return i; return i;