Add keyboard scaling patches

This commit is contained in:
Alex D. 2020-12-06 00:20:37 +00:00
parent 92eeab8c4d
commit b2dff3f769
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
2 changed files with 21 additions and 5 deletions

View File

@ -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 */

19
dwm.c
View File

@ -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)
{