diff --git a/config.h b/config.h index 44ebe56..0472fab 100644 --- a/config.h +++ b/config.h @@ -29,8 +29,8 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ - /* class instance title tags mask isfloating monitor */ - { NULL, NULL, NULL, 0, False, -1 }, + /* class instance title tags mask isfloating iskeyboard monitor */ + { "svkbd", NULL, NULL, 0, False, True, -1 }, }; /* layout(s) */ @@ -40,9 +40,8 @@ static const int resizehints = 0; /* 1 means respect size hints in tiled resi static const Layout layouts[] = { /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ + { "[_]", mobilefocus }, /* first entry is default */ { "><>", NULL }, /* no layout function means floating behavior */ - { "[M]", monocle }, }; /* key definitions */ diff --git a/dwm.c b/dwm.c index 79d9a04..350df27 100644 --- a/dwm.c +++ b/dwm.c @@ -95,7 +95,7 @@ struct Client { int basew, baseh, incw, inch, maxw, maxh, minw, minh; int bw, oldbw; unsigned int tags; - int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen; + int isfixed, isfloating, iskeyboard, isurgent, neverfocus, oldstate, isfullscreen; Client *next; Client *snext; Monitor *mon; @@ -142,6 +142,7 @@ typedef struct { const char *title; unsigned int tags; int isfloating; + int iskeyboard; int monitor; } Rule; @@ -189,6 +190,7 @@ static void killclient(const Arg *arg); static void manage(Window w, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); +static void mobilefocus(Monitor *m); static void monocle(Monitor *m); static void motionnotify(XEvent *e); static void movemouse(const Arg *arg); @@ -311,6 +313,7 @@ applyrules(Client *c) && (!r->class || strstr(class, r->class)) && (!r->instance || strstr(instance, r->instance))) { + c->iskeyboard = r->iskeyboard; c->isfloating = r->isfloating; c->tags |= r->tags; for (m = mons; m && m->num != r->monitor; m = m->next); @@ -1195,6 +1198,20 @@ maprequest(XEvent *e) manage(ev->window, &wa); } +void +mobilefocus(Monitor *m) +{ + unsigned int n = 0; + Client *c; + for (c = m->clients; c; c = c->next) + if (c->iskeyboard) + n++; + if (n > 0) /* override layout symbol */ + snprintf(m->ltsymbol, sizeof m->ltsymbol, "[-]"); + for (c = nexttiled(m->clients); c; c = nexttiled(c->next)) + resize(c, m->wx, (c->iskeyboard) ? m->wy + m->wh * m->mfact + c->bw * 2 : m->wy, m->ww - 2 * c->bw, (n) ? (c->iskeyboard) ? m->wh * (1 - m->mfact) - 2 * c->bw : m->wh * m->mfact - 2 * c->bw : m->wh - 2 * c->bw, 0); +} + void monocle(Monitor *m) {