diff --git a/dwm/dwm-netactiverules-6.2.diff b/dwm/dwm-netactiverules-6.2.diff index 1d75328..25a8457 100644 --- a/dwm/dwm-netactiverules-6.2.diff +++ b/dwm/dwm-netactiverules-6.2.diff @@ -1,4 +1,4 @@ -From 78dfc6c20cb3ac1508fa124be2d30d6c3f327c50 Mon Sep 17 00:00:00 2001 +From 815203d0060a577e9973a9a7a0a0da83e7213008 Mon Sep 17 00:00:00 2001 From: bakkeby Date: Tue, 9 Jun 2020 11:09:23 +0200 Subject: [PATCH] This is an example patch extending the focusonnetactive patch @@ -17,15 +17,15 @@ scratch. This patch was created in relation to this reddit post: https://www.reddit.com/r/suckless/comments/gyrszt/dwm_and_steam_issue_with_steam_always_taking/ --- - config.def.h | 15 ++++++-- - dwm.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 108 insertions(+), 5 deletions(-) + config.def.h | 16 ++++++-- + dwm.c | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++- + 2 files changed, 115 insertions(+), 5 deletions(-) diff --git a/config.def.h b/config.def.h -index 1c0b587..7617e49 100644 +index 1c0b587..b24ea0f 100644 --- a/config.def.h +++ b/config.def.h -@@ -5,6 +5,15 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ +@@ -5,6 +5,16 @@ static const unsigned int borderpx = 1; /* border pixel of windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ @@ -36,12 +36,13 @@ index 1c0b587..7617e49 100644 + * 3 - set the urgency bit (as per dwm default) + * 4 - client is shown on current tag in addition to its existing tags + * 5 - client is moved to current tag ++ * 6 - client receives focus only if current tag is shown + */ +static const int defnetactiverule = 1; static const char *fonts[] = { "monospace:size=10" }; static const char dmenufont[] = "monospace:size=10"; static const char col_gray1[] = "#222222"; -@@ -26,9 +35,9 @@ static const Rule rules[] = { +@@ -26,9 +36,9 @@ static const Rule rules[] = { * WM_CLASS(STRING) = instance, class * WM_NAME(STRING) = title */ @@ -55,7 +56,7 @@ index 1c0b587..7617e49 100644 /* layout(s) */ diff --git a/dwm.c b/dwm.c -index 4465af1..661f310 100644 +index 4465af1..60327c1 100644 --- a/dwm.c +++ b/dwm.c @@ -66,6 +66,18 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck, @@ -73,7 +74,7 @@ index 4465af1..661f310 100644 +// file, e.g. defnetactiverule = Focus; +// I left the configuration with plain numbers just for +// consistency. -+enum { DoNothing, Focus, FocusPlus, Urgent, ShowClient, MoveClient }; /* net active rule options */ ++enum { DoNothing, Focus, FocusPlus, Urgent, ShowClient, MoveClient, FocusIfShown }; /* net active rule options */ typedef union { int i; @@ -134,7 +135,7 @@ index 4465af1..661f310 100644 if (!c) return; -@@ -523,8 +557,68 @@ clientmessage(XEvent *e) +@@ -523,8 +557,74 @@ 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]) { @@ -194,6 +195,12 @@ index 4465af1..661f310 100644 + focus(c); + arrange(c->mon); + break; ++ case FocusIfShown: ++ // If client is already shown on the currently viewed ++ // tag then focus it, otherwise do nothing. ++ if ((c->mon->tagset[c->mon->seltags] & c->tags)) ++ focus(c); ++ break; + case Urgent: + // This is simply the original code. + if (c != selmon->sel && !c->isurgent)