summaryrefslogtreecommitdiff
path: root/dwm/patch/focusmaster.c
diff options
context:
space:
mode:
Diffstat (limited to 'dwm/patch/focusmaster.c')
-rwxr-xr-xdwm/patch/focusmaster.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/dwm/patch/focusmaster.c b/dwm/patch/focusmaster.c
new file mode 100755
index 0000000..ae0771c
--- /dev/null
+++ b/dwm/patch/focusmaster.c
@@ -0,0 +1,42 @@
+void
+focusmaster(const Arg *arg)
+{
+ Client *master;
+ Monitor *m = selmon;
+ #if FOCUSMASTER_RETURN_PATCH
+ int i;
+ #endif // FOCUSMASTER_RETURN_PATCH
+
+ if (m->nmaster < 1)
+ return;
+ #if !FAKEFULLSCREEN_PATCH
+ #if FAKEFULLSCREEN_CLIENT_PATCH
+ if (!m->sel || (m->sel->isfullscreen && m->sel->fakefullscreen != 1 && lockfullscreen))
+ return;
+ #else
+ if (!m->sel || (m->sel->isfullscreen && lockfullscreen))
+ return;
+ #endif // FAKEFULLSCREEN_CLIENT_PATCH
+ #endif // FAKEFULLSCREEN_PATCH
+
+ master = nexttiled(m->clients);
+
+ if (!master)
+ return;
+
+ #if FOCUSMASTER_RETURN_PATCH
+ for (i = 0; !(m->tagset[m->seltags] & 1 << i); i++);
+ i++;
+
+ if (m->sel == master) {
+ if (m->tagmarked[i] && ISVISIBLE(m->tagmarked[i]))
+ focus(m->tagmarked[i]);
+ } else {
+ m->tagmarked[i] = m->sel;
+ focus(master);
+ }
+ #else
+ focus(master);
+ #endif // FOCUSMASTER_RETURN_PATCH
+ restack(m);
+}