Adding options to move client to currently viewed tags

pull/19/head
bakkeby 4 years ago
parent a134c586c2
commit f9a32b415a

@ -1,4 +1,4 @@
From 5c7ccadfcb0928263dc8be447b078c58af928578 Mon Sep 17 00:00:00 2001
From 129fc340bd124675a7f4f22593b4ee25abb480c4 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
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 | 13 +++++++--
dwm.c | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 88 insertions(+), 5 deletions(-)
config.def.h | 15 ++++++--
dwm.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 109 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..62106cf 100644
index 1c0b587..7617e49 100644
--- a/config.def.h
+++ b/config.def.h
@@ -5,6 +5,13 @@ static const unsigned int borderpx = 1; /* border pixel of windows */
@@ -5,6 +5,15 @@ 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 */
@ -34,12 +34,14 @@ index 1c0b587..62106cf 100644
+ * 1 - focus the client (as per the focusonnetactive patch)
+ * 2 - focus the client tag in addition to the current tags
+ * 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
+ */
+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 +33,9 @@ static const Rule rules[] = {
@@ -26,9 +35,9 @@ static const Rule rules[] = {
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
@ -53,7 +55,7 @@ index 1c0b587..62106cf 100644
/* layout(s) */
diff --git a/dwm.c b/dwm.c
index 4465af1..db25d72 100644
index 4465af1..d18ab52 100644
--- a/dwm.c
+++ b/dwm.c
@@ -66,6 +66,18 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
@ -71,7 +73,7 @@ index 4465af1..db25d72 100644
+// file, e.g. defnetactiverule = Focus;
+// I left the configuration with plain numbers just for
+// consistency.
+enum { DoNothing, Focus, FocusPlus, Urgent }; /* net active rule options */
+enum { DoNothing, Focus, FocusPlus, Urgent, ShowClient, MoveClient }; /* net active rule options */
typedef union {
int i;
@ -132,7 +134,7 @@ index 4465af1..db25d72 100644
if (!c)
return;
@@ -523,8 +557,50 @@ clientmessage(XEvent *e)
@@ -523,8 +557,69 @@ 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]) {
@ -174,6 +176,25 @@ index 4465af1..db25d72 100644
+ restack(selmon);
+ }
+ break;
+ case ShowClient:
+ // If client is not already on any of the currently
+ // viewed tags, then let the client be shown on the
+ // currently viewed tag(s) in addition to the client's
+ // existing tags.
+ if (!(c->mon->seltags & c->tags))
+ c->tags |= c->mon->seltags;
+ focus(c);
+ arrange(c->mon);
+ break;
+ case MoveClient:
+ // If client is not already on any of the currently
+ // viewed tags, then move the client to the currently
+ // viewed tag(s).
+ if (!(c->mon->seltags & c->tags))
+ c->tags = c->mon->seltags;
+ focus(c);
+ arrange(c->mon);
+ break;
+ case Urgent:
+ // This is simply the original code.
+ if (c != selmon->sel && !c->isurgent)
@ -186,5 +207,5 @@ index 4465af1..db25d72 100644
}
--
2.27.0
2.19.1

Loading…
Cancel
Save