mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-10 13:14:57 +00:00
78 lines
2.2 KiB
Diff
78 lines
2.2 KiB
Diff
From b7618500ee1cf95f2e264cb0380b5332a79ffacb Mon Sep 17 00:00:00 2001
|
|
From: Guido Cella <guido@guidocella.xyz>
|
|
Date: Tue, 16 Jan 2024 18:58:34 +0100
|
|
Subject: [PATCH] allow switching to the configured tag when a window opens
|
|
|
|
Add a rule option to switch to the configured tag when a window opens,
|
|
then switch back when it closes.
|
|
---
|
|
config.def.h | 6 +++---
|
|
dwl.c | 11 +++++++++++
|
|
2 files changed, 14 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index 9009517..055ec93 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -21,11 +21,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
|
static int log_level = WLR_ERROR;
|
|
|
|
static const Rule rules[] = {
|
|
- /* app_id title tags mask isfloating monitor */
|
|
+ /* app_id title tags mask switchtotag isfloating monitor */
|
|
/* examples:
|
|
- { "Gimp", NULL, 0, 1, -1 },
|
|
+ { "Gimp", NULL, 0, 0, 1, -1 },
|
|
+ { "firefox", NULL, 1 << 8, 1, 0, -1 },
|
|
*/
|
|
- { "firefox", NULL, 1 << 8, 0, -1 },
|
|
};
|
|
|
|
/* layout(s) */
|
|
diff --git a/dwl.c b/dwl.c
|
|
index f25ac2f..2874dc9 100644
|
|
--- a/dwl.c
|
|
+++ b/dwl.c
|
|
@@ -134,6 +134,7 @@ typedef struct {
|
|
unsigned int bw;
|
|
uint32_t tags;
|
|
int isfloating, isurgent, isfullscreen;
|
|
+ int switchtotag;
|
|
uint32_t resize; /* configure serial of a pending resize */
|
|
} Client;
|
|
|
|
@@ -217,6 +218,7 @@ typedef struct {
|
|
const char *id;
|
|
const char *title;
|
|
uint32_t tags;
|
|
+ bool switchtotag;
|
|
int isfloating;
|
|
int monitor;
|
|
} Rule;
|
|
@@ -448,6 +450,11 @@ applyrules(Client *c)
|
|
if (r->monitor == i++)
|
|
mon = m;
|
|
}
|
|
+ if (r->switchtotag) {
|
|
+ c->switchtotag = selmon->tagset[selmon->seltags];
|
|
+ mon->seltags ^= 1;
|
|
+ mon->tagset[selmon->seltags] = r->tags & TAGMASK;
|
|
+ }
|
|
}
|
|
}
|
|
wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
|
|
@@ -2577,6 +2584,10 @@ unmapnotify(struct wl_listener *listener, void *data)
|
|
wlr_scene_node_destroy(&c->scene->node);
|
|
printstatus();
|
|
motionnotify(0);
|
|
+ if (c->switchtotag) {
|
|
+ Arg a = { .ui = c->switchtotag };
|
|
+ view(&a);
|
|
+ }
|
|
}
|
|
|
|
void
|
|
--
|
|
2.43.0
|
|
|