summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.cache/clangd/index/client.h.49E8C7CB2BEF9F60.idxbin0 -> 6724 bytes
-rw-r--r--.cache/clangd/index/config.h.61CEA1C853D678E9.idxbin0 -> 10550 bytes
-rw-r--r--.cache/clangd/index/cursor-shape-v1-protocol.h.2205B0F22F671672.idxbin0 -> 3214 bytes
-rw-r--r--.cache/clangd/index/drwl.h.6CD06F49D16B283E.idxbin0 -> 5246 bytes
-rw-r--r--.cache/clangd/index/dwl.c.3244469B51936998.idxbin0 -> 106598 bytes
-rw-r--r--.cache/clangd/index/pointer-constraints-unstable-v1-protocol.h.738BE89B23DB3D27.idxbin0 -> 946 bytes
-rw-r--r--.cache/clangd/index/util.c.E2BB9265DDE42AFB.idxbin0 -> 1504 bytes
-rw-r--r--.cache/clangd/index/util.h.75936C1C60FCB893.idxbin0 -> 484 bytes
-rw-r--r--.cache/clangd/index/wlr-layer-shell-unstable-v1-protocol.h.E16E2C3DD5D60812.idxbin0 -> 3196 bytes
-rw-r--r--.cache/clangd/index/wlr-output-power-management-unstable-v1-protocol.h.67E20208F005B97E.idxbin0 -> 2962 bytes
-rw-r--r--.cache/clangd/index/xdg-shell-protocol.h.AAAF381BCBE8A62B.idxbin0 -> 22750 bytes
-rw-r--r--compile_commands.json84
-rw-r--r--config.def.h4
-rw-r--r--dwl.c91
-rw-r--r--dwl.desktop2
-rw-r--r--patches/applied/pertag.patch170
16 files changed, 343 insertions, 8 deletions
diff --git a/.cache/clangd/index/client.h.49E8C7CB2BEF9F60.idx b/.cache/clangd/index/client.h.49E8C7CB2BEF9F60.idx
new file mode 100644
index 0000000..95ac50e
--- /dev/null
+++ b/.cache/clangd/index/client.h.49E8C7CB2BEF9F60.idx
Binary files differ
diff --git a/.cache/clangd/index/config.h.61CEA1C853D678E9.idx b/.cache/clangd/index/config.h.61CEA1C853D678E9.idx
new file mode 100644
index 0000000..f9362e7
--- /dev/null
+++ b/.cache/clangd/index/config.h.61CEA1C853D678E9.idx
Binary files differ
diff --git a/.cache/clangd/index/cursor-shape-v1-protocol.h.2205B0F22F671672.idx b/.cache/clangd/index/cursor-shape-v1-protocol.h.2205B0F22F671672.idx
new file mode 100644
index 0000000..ad835c8
--- /dev/null
+++ b/.cache/clangd/index/cursor-shape-v1-protocol.h.2205B0F22F671672.idx
Binary files differ
diff --git a/.cache/clangd/index/drwl.h.6CD06F49D16B283E.idx b/.cache/clangd/index/drwl.h.6CD06F49D16B283E.idx
new file mode 100644
index 0000000..1d9eb55
--- /dev/null
+++ b/.cache/clangd/index/drwl.h.6CD06F49D16B283E.idx
Binary files differ
diff --git a/.cache/clangd/index/dwl.c.3244469B51936998.idx b/.cache/clangd/index/dwl.c.3244469B51936998.idx
new file mode 100644
index 0000000..baf78ef
--- /dev/null
+++ b/.cache/clangd/index/dwl.c.3244469B51936998.idx
Binary files differ
diff --git a/.cache/clangd/index/pointer-constraints-unstable-v1-protocol.h.738BE89B23DB3D27.idx b/.cache/clangd/index/pointer-constraints-unstable-v1-protocol.h.738BE89B23DB3D27.idx
new file mode 100644
index 0000000..5ca9d63
--- /dev/null
+++ b/.cache/clangd/index/pointer-constraints-unstable-v1-protocol.h.738BE89B23DB3D27.idx
Binary files differ
diff --git a/.cache/clangd/index/util.c.E2BB9265DDE42AFB.idx b/.cache/clangd/index/util.c.E2BB9265DDE42AFB.idx
new file mode 100644
index 0000000..bb47c75
--- /dev/null
+++ b/.cache/clangd/index/util.c.E2BB9265DDE42AFB.idx
Binary files differ
diff --git a/.cache/clangd/index/util.h.75936C1C60FCB893.idx b/.cache/clangd/index/util.h.75936C1C60FCB893.idx
new file mode 100644
index 0000000..b8fa231
--- /dev/null
+++ b/.cache/clangd/index/util.h.75936C1C60FCB893.idx
Binary files differ
diff --git a/.cache/clangd/index/wlr-layer-shell-unstable-v1-protocol.h.E16E2C3DD5D60812.idx b/.cache/clangd/index/wlr-layer-shell-unstable-v1-protocol.h.E16E2C3DD5D60812.idx
new file mode 100644
index 0000000..3578a08
--- /dev/null
+++ b/.cache/clangd/index/wlr-layer-shell-unstable-v1-protocol.h.E16E2C3DD5D60812.idx
Binary files differ
diff --git a/.cache/clangd/index/wlr-output-power-management-unstable-v1-protocol.h.67E20208F005B97E.idx b/.cache/clangd/index/wlr-output-power-management-unstable-v1-protocol.h.67E20208F005B97E.idx
new file mode 100644
index 0000000..a7e62a9
--- /dev/null
+++ b/.cache/clangd/index/wlr-output-power-management-unstable-v1-protocol.h.67E20208F005B97E.idx
Binary files differ
diff --git a/.cache/clangd/index/xdg-shell-protocol.h.AAAF381BCBE8A62B.idx b/.cache/clangd/index/xdg-shell-protocol.h.AAAF381BCBE8A62B.idx
new file mode 100644
index 0000000..8e58571
--- /dev/null
+++ b/.cache/clangd/index/xdg-shell-protocol.h.AAAF381BCBE8A62B.idx
Binary files differ
diff --git a/compile_commands.json b/compile_commands.json
new file mode 100644
index 0000000..baed3a5
--- /dev/null
+++ b/compile_commands.json
@@ -0,0 +1,84 @@
+[
+ {
+ "arguments": [
+ "/usr/bin/gcc",
+ "-I/usr/include/wlroots-0.18",
+ "-I/usr/include/elogind",
+ "-I/usr/include/libdrm",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-I/usr/include/sysprof-6",
+ "-pthread",
+ "-DUTF8PROC_EXPORTS",
+ "-I/usr/include/pixman-1",
+ "-I.",
+ "-DWLR_USE_UNSTABLE",
+ "-D_POSIX_C_SOURCE=200809L",
+ "-DVERSION=\"v0.7-1-g9f5a295-dirty\"",
+ "-g",
+ "-pedantic",
+ "-Wall",
+ "-Wextra",
+ "-Wdeclaration-after-statement",
+ "-Wno-unused-parameter",
+ "-Wshadow",
+ "-Wunused-macros",
+ "-Werror=implicit",
+ "-Werror=return-type",
+ "-Werror=incompatible-pointer-types",
+ "-Wfloat-conversion",
+ "-O1",
+ "-c",
+ "-o",
+ "dwl.o",
+ "dwl.c"
+ ],
+ "directory": "/home/jozan/.local/packs/dwl",
+ "file": "/home/jozan/.local/packs/dwl/dwl.c",
+ "output": "/home/jozan/.local/packs/dwl/dwl.o"
+ },
+ {
+ "arguments": [
+ "/usr/bin/gcc",
+ "-I/usr/include/wlroots-0.18",
+ "-I/usr/include/elogind",
+ "-I/usr/include/libdrm",
+ "-I/usr/include/harfbuzz",
+ "-I/usr/include/freetype2",
+ "-I/usr/include/libpng16",
+ "-I/usr/include/glib-2.0",
+ "-I/usr/lib/glib-2.0/include",
+ "-I/usr/include/sysprof-6",
+ "-pthread",
+ "-DUTF8PROC_EXPORTS",
+ "-I/usr/include/pixman-1",
+ "-I.",
+ "-DWLR_USE_UNSTABLE",
+ "-D_POSIX_C_SOURCE=200809L",
+ "-DVERSION=\"v0.7-1-g9f5a295-dirty\"",
+ "-g",
+ "-pedantic",
+ "-Wall",
+ "-Wextra",
+ "-Wdeclaration-after-statement",
+ "-Wno-unused-parameter",
+ "-Wshadow",
+ "-Wunused-macros",
+ "-Werror=implicit",
+ "-Werror=return-type",
+ "-Werror=incompatible-pointer-types",
+ "-Wfloat-conversion",
+ "-O1",
+ "-c",
+ "-o",
+ "util.o",
+ "util.c"
+ ],
+ "directory": "/home/jozan/.local/packs/dwl",
+ "file": "/home/jozan/.local/packs/dwl/util.c",
+ "output": "/home/jozan/.local/packs/dwl/util.o"
+ }
+]
diff --git a/config.def.h b/config.def.h
index 46f71f8..8d1ee06 100644
--- a/config.def.h
+++ b/config.def.h
@@ -7,9 +7,9 @@
static const int sloppyfocus = 0; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 3; /* border pixel of windows */
-static const int showbar = 1; /* 0 means no bar */
+static const int showbar = 0; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
-static const char *fonts[] = {"monospace:size=10"};
+static const char *fonts[] = { "BigBlueTermPlus Nerd Font:size=14" };
static const float rootcolor[] = COLOR(0x000000ff);
static const int trayspacing = 4; /* Spacing between icons in system tray */
static const int traymargins = 4; /* System tray inner margins */
diff --git a/dwl.c b/dwl.c
index ece537a..ff5ae97 100644
--- a/dwl.c
+++ b/dwl.c
@@ -80,6 +80,7 @@
#define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1u << LENGTH(tags)) - 1)
+#define TAGCOUNT (LENGTH(tags))
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
#define TEXTW(mon, text) (drwl_font_getwidth(mon->drw, text) + mon->lrpad)
@@ -110,6 +111,7 @@ typedef struct {
const Arg arg;
} Button;
+typedef struct Pertag Pertag;
typedef struct Monitor Monitor;
typedef struct {
/* Must keep these three elements in this order */
@@ -221,9 +223,11 @@ struct Monitor {
struct wlr_box w; /* window area, layout-relative */
struct wl_list layers[4]; /* LayerSurface.link */
const Layout *lt[2];
+ Pertag *pertag;
unsigned int seltags;
unsigned int sellt;
uint32_t tagset[2];
+ int showbar;
float mfact;
int gamma_lut_changed;
int nmaster;
@@ -476,6 +480,15 @@ static xcb_atom_t netatom[NetLast];
/* attempt to encapsulate suck into one file */
#include "client.h"
+struct Pertag {
+ unsigned int curtag, prevtag; /* current and previous tag */
+ int nmasters[TAGCOUNT + 1]; /* number of windows in master area */
+ float mfacts[TAGCOUNT + 1]; /* mfacts per tag */
+ unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */
+ const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */
+ int showbars[TAGCOUNT + 1]; /* display bar for the current tag */
+};
+
/* function implementations */
void
applybounds(Client *c, struct wlr_box *bbox)
@@ -879,6 +892,7 @@ cleanupmon(struct wl_listener *listener, void *data)
wlr_output_layout_remove(output_layout, m->wlr_output);
wlr_scene_output_destroy(m->scene_output);
+ free(m->pertag);
closemon(m);
wlr_scene_node_destroy(&m->fullscreen_bg->node);
wlr_scene_node_destroy(&m->scene_buffer->node);
@@ -1158,6 +1172,7 @@ createmon(struct wl_listener *listener, void *data)
m->m.y = r->y;
m->mfact = r->mfact;
m->nmaster = r->nmaster;
+ m->showbar = showbar;
m->lt[0] = r->lt;
m->lt[1] = &layouts[LENGTH(layouts) > 1 && r->lt != &layouts[1]];
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
@@ -1192,6 +1207,20 @@ createmon(struct wl_listener *listener, void *data)
wl_list_insert(&mons, &m->link);
drawbars();
+ m->pertag = calloc(1, sizeof(Pertag));
+ m->pertag->curtag = m->pertag->prevtag = 1;
+
+ for (i = 0; i <= TAGCOUNT; i++) {
+ m->pertag->nmasters[i] = m->nmaster;
+ m->pertag->mfacts[i] = m->mfact;
+
+ m->pertag->ltidxs[i][0] = m->lt[0];
+ m->pertag->ltidxs[i][1] = m->lt[1];
+ m->pertag->sellts[i] = m->sellt;
+
+ m->pertag->showbars[i] = m->showbar;
+ }
+
/* The xdg-protocol specifies:
*
* If the fullscreened surface is not opaque, the compositor must make
@@ -1513,6 +1542,9 @@ drawbar(Monitor *m)
Client *c;
Buffer *buf;
+ if (!m->showbar)
+ return;
+
if (!m->scene_buffer->node.enabled)
return;
if (!(buf = bufmon(m)))
@@ -1760,7 +1792,7 @@ incnmaster(const Arg *arg)
{
if (!arg || !selmon)
return;
- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
arrange(selmon);
}
@@ -2545,9 +2577,9 @@ setlayout(const Arg *arg)
if (!selmon)
return;
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
- selmon->sellt ^= 1;
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
if (arg && arg->v)
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
arrange(selmon);
drawbar(selmon);
@@ -2564,7 +2596,7 @@ setmfact(const Arg *arg)
f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
if (f < 0.1 || f > 0.9)
return;
- selmon->mfact = f;
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
arrange(selmon);
}
@@ -2943,6 +2975,7 @@ tile(Monitor *m)
void
togglebar(const Arg *arg)
{
+ selmon->showbar = selmon->pertag->showbars[selmon->pertag->curtag] = !selmon->showbar;
wlr_scene_node_set_enabled(&selmon->scene_buffer->node,
!selmon->scene_buffer->node.enabled);
arrangelayers(selmon);
@@ -2983,9 +3016,32 @@ void
toggleview(const Arg *arg)
{
uint32_t newtagset;
+ size_t i;
if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
return;
+ if (newtagset == (uint32_t)~0) {
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ selmon->pertag->curtag = 0;
+ }
+
+ /* test if the user did not select the same tag */
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ for (i = 0; !(newtagset & 1 << i); i++) ;
+ selmon->pertag->curtag = i + 1;
+ }
+
+ /* apply settings for this view */
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
+
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
+ togglebar(NULL);
+
selmon->tagset[selmon->seltags] = newtagset;
focusclient(focustop(selmon), 1);
arrange(selmon);
@@ -3214,11 +3270,36 @@ urgent(struct wl_listener *listener, void *data)
void
view(const Arg *arg)
{
+ size_t i, tmptag;
+
if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
return;
selmon->seltags ^= 1; /* toggle sel tagset */
- if (arg->ui & TAGMASK)
+ if (arg->ui & ~0) {
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+
+ if (arg->ui == TAGMASK)
+ selmon->pertag->curtag = 0;
+ else {
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
+ selmon->pertag->curtag = i + 1;
+ }
+ } else {
+ tmptag = selmon->pertag->prevtag;
+ selmon->pertag->prevtag = selmon->pertag->curtag;
+ selmon->pertag->curtag = tmptag;
+ }
+
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
+
+ if (selmon->showbar != selmon->pertag->showbars[selmon->pertag->curtag])
+ togglebar(NULL);
+
focusclient(focustop(selmon), 1);
arrange(selmon);
drawbars();
diff --git a/dwl.desktop b/dwl.desktop
index e1380f7..5609521 100644
--- a/dwl.desktop
+++ b/dwl.desktop
@@ -1,5 +1,5 @@
[Desktop Entry]
Name=dwl
Comment=dwm for Wayland
-Exec=dwl
+Exec=dwl -s /home/jozan/.config/wayland/init.sh
Type=Application
diff --git a/patches/applied/pertag.patch b/patches/applied/pertag.patch
new file mode 100644
index 0000000..971732a
--- /dev/null
+++ b/patches/applied/pertag.patch
@@ -0,0 +1,170 @@
+From d3b551ffe3ec85e16341962e322150b81af6722f Mon Sep 17 00:00:00 2001
+From: wochap <gean.marroquin@gmail.com>
+Date: Wed, 31 Jul 2024 08:27:26 -0500
+Subject: [PATCH] makes layout, mwfact and nmaster individual for every tag
+
+inspiration: https://github.com/djpohly/dwl/wiki/pertag
+---
+ dwl.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 70 insertions(+), 5 deletions(-)
+
+diff --git a/dwl.c b/dwl.c
+index 145fd01..2f364bc 100644
+--- a/dwl.c
++++ b/dwl.c
+@@ -102,6 +102,7 @@ typedef struct {
+ const Arg arg;
+ } Button;
+
++typedef struct Pertag Pertag;
+ typedef struct Monitor Monitor;
+ typedef struct {
+ /* Must keep these three elements in this order */
+@@ -199,6 +200,7 @@ struct Monitor {
+ struct wlr_box w; /* window area, layout-relative */
+ struct wl_list layers[4]; /* LayerSurface.link */
+ const Layout *lt[2];
++ Pertag *pertag;
+ unsigned int seltags;
+ unsigned int sellt;
+ uint32_t tagset[2];
+@@ -427,6 +429,14 @@ static xcb_atom_t netatom[NetLast];
+ /* attempt to encapsulate suck into one file */
+ #include "client.h"
+
++struct Pertag {
++ unsigned int curtag, prevtag; /* current and previous tag */
++ int nmasters[TAGCOUNT + 1]; /* number of windows in master area */
++ float mfacts[TAGCOUNT + 1]; /* mfacts per tag */
++ unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */
++ const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */
++};
++
+ /* function implementations */
+ void
+ applybounds(Client *c, struct wlr_box *bbox)
+@@ -712,6 +722,7 @@ cleanupmon(struct wl_listener *listener, void *data)
+ wlr_output_layout_remove(output_layout, m->wlr_output);
+ wlr_scene_output_destroy(m->scene_output);
+
++ free(m->pertag);
+ closemon(m);
+ wlr_scene_node_destroy(&m->fullscreen_bg->node);
+ free(m);
+@@ -983,6 +994,18 @@ createmon(struct wl_listener *listener, void *data)
+ wl_list_insert(&mons, &m->link);
+ printstatus();
+
++ m->pertag = calloc(1, sizeof(Pertag));
++ m->pertag->curtag = m->pertag->prevtag = 1;
++
++ for (i = 0; i <= TAGCOUNT; i++) {
++ m->pertag->nmasters[i] = m->nmaster;
++ m->pertag->mfacts[i] = m->mfact;
++
++ m->pertag->ltidxs[i][0] = m->lt[0];
++ m->pertag->ltidxs[i][1] = m->lt[1];
++ m->pertag->sellts[i] = m->sellt;
++ }
++
+ /* The xdg-protocol specifies:
+ *
+ * If the fullscreened surface is not opaque, the compositor must make
+@@ -1472,7 +1495,7 @@ incnmaster(const Arg *arg)
+ {
+ if (!arg || !selmon)
+ return;
+- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
+ arrange(selmon);
+ }
+
+@@ -2305,9 +2328,9 @@ setlayout(const Arg *arg)
+ if (!selmon)
+ return;
+ if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
+- selmon->sellt ^= 1;
++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
+ if (arg && arg->v)
+- selmon->lt[selmon->sellt] = (Layout *)arg->v;
++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
+ strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
+ arrange(selmon);
+ printstatus();
+@@ -2324,7 +2347,7 @@ setmfact(const Arg *arg)
+ f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
+ if (f < 0.1 || f > 0.9)
+ return;
+- selmon->mfact = f;
++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
+ arrange(selmon);
+ }
+
+@@ -2701,9 +2724,29 @@ void
+ toggleview(const Arg *arg)
+ {
+ uint32_t newtagset;
++ size_t i;
+ if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
+ return;
+
++ if (newtagset == (uint32_t)~0) {
++ selmon->pertag->prevtag = selmon->pertag->curtag;
++ selmon->pertag->curtag = 0;
++ }
++
++ /* test if the user did not select the same tag */
++ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
++ selmon->pertag->prevtag = selmon->pertag->curtag;
++ for (i = 0; !(newtagset & 1 << i); i++) ;
++ selmon->pertag->curtag = i + 1;
++ }
++
++ /* apply settings for this view */
++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
++ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
++
+ selmon->tagset[selmon->seltags] = newtagset;
+ focusclient(focustop(selmon), 1);
+ arrange(selmon);
+@@ -2892,11 +2935,33 @@ urgent(struct wl_listener *listener, void *data)
+ void
+ view(const Arg *arg)
+ {
++ size_t i, tmptag;
++
+ if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ return;
+ selmon->seltags ^= 1; /* toggle sel tagset */
+- if (arg->ui & TAGMASK)
++ if (arg->ui & ~0) {
+ selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
++ selmon->pertag->prevtag = selmon->pertag->curtag;
++
++ if (arg->ui == TAGMASK)
++ selmon->pertag->curtag = 0;
++ else {
++ for (i = 0; !(arg->ui & 1 << i); i++) ;
++ selmon->pertag->curtag = i + 1;
++ }
++ } else {
++ tmptag = selmon->pertag->prevtag;
++ selmon->pertag->prevtag = selmon->pertag->curtag;
++ selmon->pertag->curtag = tmptag;
++ }
++
++ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
++ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
++ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
++ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
++ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
++
+ focusclient(focustop(selmon), 1);
+ arrange(selmon);
+ printstatus();
+--
+2.45.2
+