Update dwm.c
This commit is contained in:
parent
e7b210bc36
commit
2bbdc82fc8
44
dwm.c
44
dwm.c
|
@ -92,7 +92,7 @@ struct Client {
|
||||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
|
||||||
int bw, oldbw;
|
int bw, oldbw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
int isfixed, iscentered, isfloating, isalwaysontop, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
Client *next;
|
Client *next;
|
||||||
Client *snext;
|
Client *snext;
|
||||||
Monitor *mon;
|
Monitor *mon;
|
||||||
|
@ -214,6 +214,7 @@ static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
static void togglebar(const Arg *arg);
|
static void togglebar(const Arg *arg);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
|
static void togglealwaysontop(const Arg *arg);
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
static void unfocus(Client *c, int setfocus);
|
static void unfocus(Client *c, int setfocus);
|
||||||
|
@ -862,8 +863,11 @@ drawbar(Monitor *m)
|
||||||
if (m->sel) {
|
if (m->sel) {
|
||||||
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
|
||||||
drw_text(drw, x, 0, w - 2 * hpb, bh, lrpad / 2, m->sel->name, 0);
|
drw_text(drw, x, 0, w - 2 * hpb, bh, lrpad / 2, m->sel->name, 0);
|
||||||
if (m->sel->isfloating)
|
if (m->sel->isfloating) {
|
||||||
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
|
||||||
|
if (m->sel->isalwaysontop)
|
||||||
|
drw_rect(drw, x + boxs, bh - boxw, boxw, boxw, 0, 0);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
drw_rect(drw, x, 0, w - 2 * hpb, bh, 1, 1);
|
drw_rect(drw, x, 0, w - 2 * hpb, bh, 1, 1);
|
||||||
|
@ -1480,6 +1484,17 @@ restack(Monitor *m)
|
||||||
return;
|
return;
|
||||||
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
|
if (m->sel->isfloating || !m->lt[m->sellt]->arrange)
|
||||||
XRaiseWindow(dpy, m->sel->win);
|
XRaiseWindow(dpy, m->sel->win);
|
||||||
|
|
||||||
|
/* raise the aot window */
|
||||||
|
for(Monitor *m_search = mons; m_search; m_search = m_search->next){
|
||||||
|
for(c = m_search->clients; c; c = c->next){
|
||||||
|
if(c->isalwaysontop){
|
||||||
|
XRaiseWindow(dpy, c->win);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m->lt[m->sellt]->arrange) {
|
if (m->lt[m->sellt]->arrange) {
|
||||||
wc.stack_mode = Below;
|
wc.stack_mode = Below;
|
||||||
wc.sibling = m->barwin;
|
wc.sibling = m->barwin;
|
||||||
|
@ -1852,6 +1867,31 @@ togglefloating(const Arg *arg)
|
||||||
if (selmon->sel->isfloating)
|
if (selmon->sel->isfloating)
|
||||||
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
|
||||||
selmon->sel->w, selmon->sel->h, 0);
|
selmon->sel->w, selmon->sel->h, 0);
|
||||||
|
else
|
||||||
|
selmon->sel->isalwaysontop = 0; /* disabled, turn this off too */
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
togglealwaysontop(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (!selmon->sel)
|
||||||
|
return;
|
||||||
|
if (selmon->sel->isfullscreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(selmon->sel->isalwaysontop){
|
||||||
|
selmon->sel->isalwaysontop = 0;
|
||||||
|
}else{
|
||||||
|
/* disable others */
|
||||||
|
for(Monitor *m = mons; m; m = m->next)
|
||||||
|
for(Client *c = m->clients; c; c = c->next)
|
||||||
|
c->isalwaysontop = 0;
|
||||||
|
|
||||||
|
/* turn on, make it float too */
|
||||||
|
selmon->sel->isfloating = 1;
|
||||||
|
selmon->sel->isalwaysontop = 1;
|
||||||
|
}
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue