add semi hide bars
This commit is contained in:
parent
0a4047f2aa
commit
3f65bea116
|
@ -8,6 +8,7 @@ static const unsigned int borderpx = 4;
|
||||||
static const unsigned int gappx = 10;
|
static const unsigned int gappx = 10;
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 1; /* 0 means no bar */
|
||||||
|
static const int showextrabar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char statussep = ';';
|
static const char statussep = ';';
|
||||||
static const int horizpadbar = 5;
|
static const int horizpadbar = 5;
|
||||||
|
@ -103,7 +104,8 @@ static Key keys[] = {
|
||||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
||||||
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ SUPERKEY, XK_b, togglebar, {0} },
|
{ SUPERKEY, XK_b, togglebar, {.i = 1} },
|
||||||
|
{ SUPERKEY|ShiftMask, XK_b, togglebar, {.i = 2} },
|
||||||
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
||||||
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
||||||
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
|
6
config.h
6
config.h
|
@ -7,7 +7,8 @@
|
||||||
static const unsigned int borderpx = 4;
|
static const unsigned int borderpx = 4;
|
||||||
static const unsigned int gappx = 10;
|
static const unsigned int gappx = 10;
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static const int showbar = 0; /* 0 means no bar */
|
||||||
|
static const int showextrabar = 1; /* 0 means no bar */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static const int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char statussep = ';';
|
static const char statussep = ';';
|
||||||
static const int horizpadbar = 5;
|
static const int horizpadbar = 5;
|
||||||
|
@ -103,7 +104,8 @@ static Key keys[] = {
|
||||||
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
{ 0, XF86XK_AudioMute, spawn, {.v = volmute } },
|
||||||
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
{ SUPERKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
{ SUPERKEY, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ SUPERKEY, XK_b, togglebar, {0} },
|
{ SUPERKEY, XK_b, togglebar, {.i = 1} },
|
||||||
|
{ SUPERKEY|ShiftMask, XK_b, togglebar, {.i = 2} },
|
||||||
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
{ ALTKEY, XK_Tab, focusstack, {.i = +1 } },
|
||||||
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
/* { SUPERKEY, XK_k, focusstack, {.i = -1 } }, */
|
||||||
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
{ SUPERKEY, XK_i, incnmaster, {.i = +1 } },
|
||||||
|
|
32
dwm.c
32
dwm.c
|
@ -125,6 +125,7 @@ struct Monitor {
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
int showbar;
|
int showbar;
|
||||||
|
int showextrabar;
|
||||||
int topbar;
|
int topbar;
|
||||||
Client *clients;
|
Client *clients;
|
||||||
Client *sel;
|
Client *sel;
|
||||||
|
@ -676,6 +677,7 @@ createmon(void)
|
||||||
m->mfact = mfact;
|
m->mfact = mfact;
|
||||||
m->nmaster = nmaster;
|
m->nmaster = nmaster;
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
|
m->showextrabar = showextrabar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
m->gappx = gappx;
|
m->gappx = gappx;
|
||||||
m->lt[0] = &layouts[0];
|
m->lt[0] = &layouts[0];
|
||||||
|
@ -857,13 +859,12 @@ drawbar(Monitor *m)
|
||||||
unsigned int i, occ = 0, urg = 0;
|
unsigned int i, occ = 0, urg = 0;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
if (!m->showbar)
|
if (m->showbar) {
|
||||||
return;
|
|
||||||
|
|
||||||
/* 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) { /* status is only drawn on selected monitor */
|
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||||
tw = m->ww - drawstatusbar(m, bh, 0, stext);
|
tw = m->ww - drawstatusbar(m, bh, 0, stext);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (c = m->clients; c; c = c->next) {
|
for (c = m->clients; c; c = c->next) {
|
||||||
occ |= c->tags;
|
occ |= c->tags;
|
||||||
|
@ -902,14 +903,18 @@ drawbar(Monitor *m)
|
||||||
drw_rect(drw, x, 0, w - 2 * hpb, bh, 1, 1);
|
drw_rect(drw, x, 0, w - 2 * hpb, bh, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m->showbar)
|
||||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
|
|
||||||
|
if (m->showextrabar) {
|
||||||
if (m == selmon) { /* extra status is only drawn on selected monitor */
|
if (m == selmon) { /* extra status is only drawn on selected monitor */
|
||||||
sw = drawstatusbar(m, bh, 1, estext);
|
sw = drawstatusbar(m, bh, 1, estext);
|
||||||
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
drw_map(drw, m->extrabarwin, 0, 0, m->ww, bh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drawbars(void)
|
drawbars(void)
|
||||||
{
|
{
|
||||||
|
@ -1670,10 +1675,11 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
void
|
void
|
||||||
setgaps(const Arg *arg)
|
setgaps(const Arg *arg)
|
||||||
{
|
{
|
||||||
if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
if ((arg->i == 0) || (selmon->gappx + arg->i < 0)) {
|
||||||
selmon->gappx = 0;
|
selmon->gappx = 0;
|
||||||
else
|
} else {
|
||||||
selmon->gappx += arg->i;
|
selmon->gappx += arg->i;
|
||||||
|
}
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1881,10 +1887,17 @@ tile(Monitor *m)
|
||||||
void
|
void
|
||||||
togglebar(const Arg *arg)
|
togglebar(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
if (arg->i == 1 || arg->i == 0) {
|
||||||
selmon->showbar = !selmon->showbar;
|
selmon->showbar = !selmon->showbar;
|
||||||
updatebarpos(selmon);
|
updatebarpos(selmon);
|
||||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + hpb, selmon->by + vpb, selmon->ww - 2 * hpb, bh);
|
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx + hpb, selmon->by + vpb, selmon->ww - 2 * hpb, bh);
|
||||||
|
}
|
||||||
|
if (arg->i == 2 || arg->i == 0) {
|
||||||
|
selmon->showextrabar = !selmon->showextrabar;
|
||||||
|
updatebarpos(selmon);
|
||||||
XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + hpb, selmon->eby - vpb, selmon->ww - 2 * hpb, bh);
|
XMoveResizeWindow(dpy, selmon->extrabarwin, selmon->wx + hpb, selmon->eby - vpb, selmon->ww - 2 * hpb, bh);
|
||||||
|
}
|
||||||
|
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2049,14 +2062,19 @@ updatebarpos(Monitor *m)
|
||||||
{
|
{
|
||||||
m->wy = m->my;
|
m->wy = m->my;
|
||||||
m->wh = m->mh;
|
m->wh = m->mh;
|
||||||
m->wh -= bh * m->showbar * 2;
|
m->wh -= bh * m->showbar + bh * m->showextrabar;
|
||||||
m->wy = m->showbar ? m->wy + bh + vpb : m->wy;
|
m->wy = m->showbar ? m->wy + bh + vpb : m->wy;
|
||||||
|
|
||||||
if (m->showbar) {
|
if (m->showbar && m->showextrabar) {
|
||||||
m->by = m->topbar ? m->wy - gappx - bh : m->wy + m->wh + gappx;
|
m->by = m->topbar ? m->wy - gappx - bh : m->wy + m->wh + gappx;
|
||||||
m->eby = m->topbar ? m->wy + m->wh + gappx - vpb * 2 : m->wy - gappx - bh - vpb * 2;
|
m->eby = m->topbar ? m->wy + m->wh + gappx - vpb * 2 : m->wy - gappx - bh - vpb * 2;
|
||||||
m->wy = topbar ? m->wy : m->wy - vpb * 2;
|
m->wy = topbar ? m->wy : m->wy - vpb * 2;
|
||||||
m->wh = topbar ? m->wh - vpb * 2 : m->wh + vpb * 2;
|
m->wh = topbar ? m->wh - vpb * 2 : m->wh + vpb * 2;
|
||||||
|
} else if (m->showbar || m->showextrabar) {
|
||||||
|
m->by = m->topbar ? m->wy - gappx - bh : m->wy + m->wh + gappx;
|
||||||
|
m->eby = m->topbar ? m->wy + m->wh + gappx - vpb : m->wy - gappx - bh - vpb;
|
||||||
|
m->wy = topbar ? m->wy : m->wy - vpb;
|
||||||
|
m->wh = topbar ? m->wh - vpb: m->wh + vpb;
|
||||||
} else {
|
} else {
|
||||||
m->by = -bh - vpb;
|
m->by = -bh - vpb;
|
||||||
m->eby = -bh + vpb;
|
m->eby = -bh + vpb;
|
||||||
|
|
Loading…
Reference in New Issue