[dwm] Reinstate long bar
This commit is contained in:
parent
81858d5f05
commit
e108ece70b
@ -30,7 +30,7 @@ static const unsigned int alphas[][3] = {
|
||||
/* fg bg border */
|
||||
[SchemeNorm] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeSel] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeHigh] = { OPAQUE, baralpha, borderalpha },
|
||||
[SchemeHigh] = { OPAQUE, 0x55, borderalpha },
|
||||
};
|
||||
|
||||
/* tagging */
|
||||
@ -51,7 +51,7 @@ static const Rule rules[] = {
|
||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static const int nmaster = 1; /* number of clients in master area */
|
||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const int lockfullscreen = 0; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
|
@ -518,7 +518,7 @@ buttonpress(XEvent *e)
|
||||
focus(NULL);
|
||||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
i = x = 0;
|
||||
i = 0, x = m->ww/2 - LENGTH(tags)*bh/2;
|
||||
do
|
||||
x += bh;
|
||||
while (ev->x >= x && ++i < LENGTH(tags));
|
||||
@ -610,7 +610,7 @@ clientmessage(XEvent *e)
|
||||
if (cme->data.l[1] == netatom[NetWMFullscreen]
|
||||
|| cme->data.l[2] == netatom[NetWMFullscreen])
|
||||
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|
||||
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
|
||||
|| cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */));
|
||||
} else if (cme->message_type == netatom[NetActiveWindow]) {
|
||||
if (c != selmon->sel && !c->isurgent)
|
||||
seturgent(c, 1);
|
||||
@ -640,7 +640,6 @@ void
|
||||
configurenotify(XEvent *e)
|
||||
{
|
||||
Monitor *m;
|
||||
Client *c;
|
||||
XConfigureEvent *ev = &e->xconfigure;
|
||||
int dirty;
|
||||
|
||||
@ -653,9 +652,6 @@ configurenotify(XEvent *e)
|
||||
drw_resize(drw, sw, bh);
|
||||
updatebars();
|
||||
for (m = mons; m; m = m->next) {
|
||||
for (c = m->clients; c; c = c->next)
|
||||
if (c->isfullscreen)
|
||||
resizeclient(c, m->mx, m->my, m->mw, m->mh);
|
||||
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
|
||||
}
|
||||
focus(NULL);
|
||||
@ -787,37 +783,44 @@ dirtomon(int dir)
|
||||
void
|
||||
drawbar(Monitor *m)
|
||||
{
|
||||
int x, w = 0;
|
||||
int x, w, tw = 0;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
w = blw = TEXTW(m->ltsymbol);
|
||||
|
||||
/* clear bar from last draw */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, 0, 0, m->ww, bh, lrpad / 2, 1);
|
||||
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
x = 0;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
w = bh;
|
||||
|
||||
int unselScheme = m == selmon ? SchemeHigh : SchemeNorm;
|
||||
if (!mons->next)
|
||||
unselScheme = SchemeNorm;
|
||||
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : unselScheme]);
|
||||
drw_text(drw, x, 0, bh, bh, 0, "", urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x+boxw,boxw, w-boxw*2, w-boxw*2,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
|
||||
if (altbarvis) {
|
||||
drw_setscheme(drw, scheme[SchemeHigh]);
|
||||
drw_text(drw, 0, 0, LENGTH(tags)*bh, bh, 0, stext, 0);
|
||||
tw = TEXTW(stext) - lrpad;
|
||||
drw_text(drw, m->ww/2 - tw/2, 0, tw, bh, 0, stext, 0);
|
||||
} else {
|
||||
x = m->ww/2 - LENGTH(tags)*bh/2;
|
||||
for (i = 0; i < LENGTH(tags); i++) {
|
||||
w = bh;
|
||||
|
||||
int unselScheme = m == selmon ? SchemeHigh : SchemeNorm;
|
||||
if (!mons->next)
|
||||
unselScheme = SchemeNorm;
|
||||
|
||||
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : unselScheme]);
|
||||
drw_text(drw, x, 0, bh, bh, 0, "", urg & 1 << i);
|
||||
if (occ & 1 << i)
|
||||
drw_rect(drw, x+boxw,boxw, w-boxw*2, w-boxw*2,
|
||||
m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||
urg & 1 << i);
|
||||
x += w;
|
||||
}
|
||||
}
|
||||
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
@ -1262,8 +1265,6 @@ movemouse(const Arg *arg)
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
return;
|
||||
if (c->isfullscreen) /* no support moving fullscreen windows by mouse */
|
||||
return;
|
||||
restack(selmon);
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
@ -1417,8 +1418,6 @@ resizemouse(const Arg *arg)
|
||||
|
||||
if (!(c = selmon->sel))
|
||||
return;
|
||||
if (c->isfullscreen) /* no support resizing fullscreen windows by mouse */
|
||||
return;
|
||||
restack(selmon);
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
@ -1597,24 +1596,10 @@ setfullscreen(Client *c, int fullscreen)
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
|
||||
c->isfullscreen = 1;
|
||||
c->oldstate = c->isfloating;
|
||||
c->oldbw = c->bw;
|
||||
c->bw = 0;
|
||||
c->isfloating = 1;
|
||||
resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
|
||||
XRaiseWindow(dpy, c->win);
|
||||
} else if (!fullscreen && c->isfullscreen){
|
||||
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
|
||||
PropModeReplace, (unsigned char*)0, 0);
|
||||
c->isfullscreen = 0;
|
||||
c->isfloating = c->oldstate;
|
||||
c->bw = c->oldbw;
|
||||
c->x = c->oldx;
|
||||
c->y = c->oldy;
|
||||
c->w = c->oldw;
|
||||
c->h = c->oldh;
|
||||
resizeclient(c, c->x, c->y, c->w, c->h);
|
||||
arrange(c->mon);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1746,7 +1731,7 @@ showhide(Client *c)
|
||||
if (ISVISIBLE(c)) {
|
||||
/* show clients top down */
|
||||
XMoveWindow(dpy, c->win, c->x, c->y);
|
||||
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
|
||||
if (!c->mon->lt[c->mon->sellt]->arrange || c->isfloating)
|
||||
resize(c, c->x, c->y, c->w, c->h, 0);
|
||||
showhide(c->snext);
|
||||
} else {
|
||||
@ -1829,7 +1814,7 @@ togglebar(const Arg *arg)
|
||||
{
|
||||
selmon->showbar = !selmon->showbar;
|
||||
updatebarpos(selmon);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx+selmon->ww/2-bh*LENGTH(tags)/2, selmon->by, bh*LENGTH(tags), bh);
|
||||
XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@ -1838,8 +1823,6 @@ togglefloating(const Arg *arg)
|
||||
{
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (selmon->sel->isfullscreen) /* no support for fullscreen windows */
|
||||
return;
|
||||
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
|
||||
if (selmon->sel->isfloating)
|
||||
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
||||
@ -1959,7 +1942,7 @@ updatebars(void)
|
||||
for (m = mons; m; m = m->next) {
|
||||
if (m->barwin)
|
||||
continue;
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx+m->ww/2-bh*LENGTH(tags)/2, m->by, bh*LENGTH(tags), bh, 0, depth,
|
||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, depth,
|
||||
InputOutput, visual,
|
||||
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &wa);
|
||||
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
|
||||
@ -1973,12 +1956,12 @@ updatebarpos(Monitor *m)
|
||||
{
|
||||
m->wy = m->my;
|
||||
m->wh = m->mh;
|
||||
m->wh -= bh;
|
||||
if (m->showbar) {
|
||||
m->wh -= bh;
|
||||
m->by = m->topbar ? m->wy : m->wy + m->wh;
|
||||
m->wy = m->topbar ? m->wy + bh : m->wy;
|
||||
} else
|
||||
m->by = -bh;
|
||||
m->wh += bh;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user