mirror of
https://codeberg.org/dwl/dwl-patches.git
synced 2025-09-09 20:54:50 +00:00

Eliminated wiki. Individual patches have a README.md explanation in their own subdirectory. Simplified submission of new patches and maintenance of existing patches. Instructions page (README.md autodisplayed) is now at https://codeberg.org/dwl/dwl-patches/
92 lines
3.0 KiB
Diff
92 lines
3.0 KiB
Diff
From 9831bdfcadaf779640bf7c5662fc40fdc278a8ba Mon Sep 17 00:00:00 2001
|
|
From: Ben Collerson <benc@benc.cc>
|
|
Date: Sat, 30 Dec 2023 13:39:31 +1000
|
|
Subject: [PATCH] viewnextocctag
|
|
|
|
---
|
|
config.def.h | 2 ++
|
|
dwl.c | 33 +++++++++++++++++++++++++++++++++
|
|
2 files changed, 35 insertions(+)
|
|
|
|
diff --git a/config.def.h b/config.def.h
|
|
index a8ed61d9..a668d0b0 100644
|
|
--- a/config.def.h
|
|
+++ b/config.def.h
|
|
@@ -128,6 +128,8 @@ static const Key keys[] = {
|
|
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
|
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
|
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_H, viewnextocctag, {.i = -1} },
|
|
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_L, viewnextocctag, {.i = +1} },
|
|
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
|
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
|
diff --git a/dwl.c b/dwl.c
|
|
index 4d19357f..a42c4871 100644
|
|
--- a/dwl.c
|
|
+++ b/dwl.c
|
|
@@ -286,6 +286,7 @@ static void motionabsolute(struct wl_listener *listener, void *data);
|
|
static void motionnotify(uint32_t time);
|
|
static void motionrelative(struct wl_listener *listener, void *data);
|
|
static void moveresize(const Arg *arg);
|
|
+unsigned int nextocctag(int);
|
|
static void outputmgrapply(struct wl_listener *listener, void *data);
|
|
static void outputmgrapplyortest(struct wlr_output_configuration_v1 *config, int test);
|
|
static void outputmgrtest(struct wl_listener *listener, void *data);
|
|
@@ -326,6 +327,7 @@ static void updatemons(struct wl_listener *listener, void *data);
|
|
static void updatetitle(struct wl_listener *listener, void *data);
|
|
static void urgent(struct wl_listener *listener, void *data);
|
|
static void view(const Arg *arg);
|
|
+static void viewnextocctag(const Arg *argint);
|
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
|
static Monitor *xytomon(double x, double y);
|
|
static void xytonode(double x, double y, struct wlr_surface **psurface,
|
|
@@ -1697,6 +1699,26 @@ moveresize(const Arg *arg)
|
|
}
|
|
}
|
|
|
|
+unsigned int
|
|
+nextocctag(int direction)
|
|
+{
|
|
+ unsigned int seltag = selmon->tagset[selmon->seltags];
|
|
+ unsigned int occ = 0, i;
|
|
+ Client *c;
|
|
+
|
|
+ wl_list_for_each(c, &clients, link)
|
|
+ occ |= c->tags;
|
|
+
|
|
+ for (i=0; i<TAGCOUNT; i++) {
|
|
+ seltag = (direction > 0) ?
|
|
+ (seltag == (1u << (TAGCOUNT - 1)) ? 1u : seltag << 1) :
|
|
+ (seltag == 1 ? (1u << (TAGCOUNT - 1)) : seltag >> 1);
|
|
+ if (seltag & occ)
|
|
+ break;
|
|
+ }
|
|
+
|
|
+ return seltag & TAGMASK;
|
|
+}
|
|
void
|
|
outputmgrapply(struct wl_listener *listener, void *data)
|
|
{
|
|
@@ -2714,6 +2736,17 @@ view(const Arg *arg)
|
|
printstatus();
|
|
}
|
|
|
|
+void
|
|
+viewnextocctag(const Arg *arg)
|
|
+{
|
|
+ unsigned int tmp;
|
|
+
|
|
+ if ((tmp = nextocctag(arg->i)) == selmon->tagset[selmon->seltags])
|
|
+ return;
|
|
+
|
|
+ view(&(const Arg){.ui = tmp});
|
|
+}
|
|
+
|
|
void
|
|
virtualkeyboard(struct wl_listener *listener, void *data)
|
|
{
|
|
--
|
|
2.43.0
|
|
|