Add toggle for focusonnetactive

This commit is contained in:
speedie 2022-11-12 14:02:56 +01:00
parent a0bd560e14
commit 60646c2a2f
4 changed files with 8 additions and 0 deletions

View file

@ -44,6 +44,7 @@
!! Client options
!@
- speedwm.client.allowurgent: 1 ! Allow windows to have the 'urgent' status (0/1)
- speedwm.client.autofocus: 0 ! Allow windows to focus themselves on demand. This may be annoying depending on what software you use and is disabled by default for this reason (0/1)
- speedwm.client.autoresize: 0 ! Allow windows to resize themselves on demand (0/1)
- speedwm.client.decorhints: 1 ! Respect decoration hints for windows (0/1)
- speedwm.client.fade.inactive: 1 ! Fade inactive windows (windows that are not focused) (0/1)

View file

@ -128,6 +128,7 @@ static int centerfloating = 1; /* Center floating windows by
static int startontag = 1; /* Start on a tag or not? */
static int floatscratchpad = 0; /* Float the scratchpad window on hide (1/0) */
static int focusspawn = 0; /* Automatically focus the next spawned window. If warp is enabled, this is useless and will be disabled. (1/0) */
static int autofocus = 0; /* Allow clients to automatically be focused when they request it. This comes with the side effect of potentially being annoying */
static int autoresize = 0; /* Allow resizing clients automatically when they request it. */
/* Font options

View file

@ -1541,6 +1541,10 @@ clientmessage(XEvent *e)
setfullscreen(c, (cme->data.l[0] == 1 /* _NET_WM_STATE_ADD */
|| (cme->data.l[0] == 2 /* _NET_WM_STATE_TOGGLE */ && !c->isfullscreen)));
} else if (cme->message_type == netatom[NetActiveWindow]) {
if (!autofocus) {
if (c != selmon->sel && !c->isurgent)
seturgent(c, 1);
} else {
for (i = 0; i < LENGTH(tags) && !((1 << i) & c->tags); i++);
if (i < LENGTH(tags)) {
const Arg a = {.ui = 1 << i};
@ -1549,6 +1553,7 @@ clientmessage(XEvent *e)
focus(c);
restack(selmon);
}
}
}
}

View file

@ -124,6 +124,7 @@ ResourcePref resources[] = {
{ "focus.spawned", INTEGER, &focusspawn },
{ "client.floatscratchpad", INTEGER, &floatscratchpad },
{ "bar.altbar", INTEGER, &altbar },
{ "client.autofocus", INTEGER, &autofocus },
{ "client.autoresize", INTEGER, &autoresize },
{ "mfact", FLOAT, &mfact },
{ "mfact.lowest", FLOAT, &lowestmfact },