[dwm] Add status back to bar

Can be accessed by holding Mod+F.
This commit is contained in:
dogeystamp 2021-07-10 21:51:14 -04:00
parent b00482b1a0
commit a6f17219b0
2 changed files with 38 additions and 1 deletions

View File

@ -95,6 +95,7 @@ static const char *stopcmd[] = { "mpc", "stop", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ Mod4Mask, XK_p, togglepass, {0} },
{ MODKEY, XK_f, togglealtbar, {0} },
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY|ShiftMask, XK_s, spawn, {.v = suspendcmd } },
@ -120,7 +121,7 @@ static const Key keys[] = {
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_q, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },

View File

@ -222,6 +222,7 @@ static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglealtbar(const Arg *arg);
static void togglefloating(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@ -303,6 +304,10 @@ static Colormap cmap;
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
/* function implementations */
static int combo = 0;
static int altbarvis = 0;
void
applyrules(Client *c)
{
@ -806,6 +811,11 @@ drawbar(Monitor *m)
x += w;
}
if (altbarvis) {
drw_setscheme(drw, scheme[SchemeNorm]);
drw_text(drw, 0, 0, LENGTH(tags), bh, 0, stext, 0);
}
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
}
@ -818,6 +828,32 @@ drawbars(void)
drawbar(m);
}
void
togglealtbar(const Arg *arg)
{
altbarvis = 1;
drawbars();
}
void
keyrelease(XEvent *e) {
combo = 0;
if (XEventsQueued(dpy, QueuedAfterReading)) {
XEvent ne;
XPeekEvent(dpy, &ne);
if (ne.type == KeyPress && ne.xkey.time == e->xkey.time &&
ne.xkey.keycode == e->xkey.keycode) {
XNextEvent(dpy, &ne);
return;
}
}
altbarvis = 0;
drawbars();
}
void
enternotify(XEvent *e)
{