From aa2c5b40cffadba6dbecdcfe60f0241a8f17b03e Mon Sep 17 00:00:00 2001 From: korei999 Date: Mon, 22 Jan 2024 17:45:00 +0200 Subject: [PATCH] add rotatetags --- rotatetags/rotatetags.patch | 123 ++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 rotatetags/rotatetags.patch diff --git a/rotatetags/rotatetags.patch b/rotatetags/rotatetags.patch new file mode 100644 index 0000000..182b259 --- /dev/null +++ b/rotatetags/rotatetags.patch @@ -0,0 +1,123 @@ +From d98d2b6c3d3b6ef4a862aa9faa77333eac9a724b Mon Sep 17 00:00:00 2001 +From: korei999 +Date: Sat, 25 Nov 2023 14:10:20 +0200 +Subject: [PATCH 1/2] add rotatetags patch + +--- + config.def.h | 17 ++++++++++++++--- + dwl.c | 29 +++++++++++++++++++++++++++++ + 2 files changed, 43 insertions(+), 3 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 9009517..f01f628 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -14,6 +14,13 @@ static const float urgentcolor[] = COLOR(0xff0000ff); + /* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */ + static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */ + ++enum { ++ VIEW_L = -1, ++ VIEW_R = 1, ++ SHIFT_L = -2, ++ SHIFT_R = 2, ++} RotateTags; ++ + /* tagging - TAGCOUNT must be no greater than 31 */ + #define TAGCOUNT (9) + +@@ -125,9 +132,13 @@ static const Key keys[] = { + { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, + { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, + { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, +- { MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, +- { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, +- { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, ++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_i, incnmaster, {.i = -1} }, ++ { MODKEY, XKB_KEY_a, rotatetags, {.i = VIEW_L} }, ++ { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} }, ++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_a, rotatetags, {.i = SHIFT_L} }, ++ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_d, rotatetags, {.i = SHIFT_R} }, ++ { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, ++ { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, + { 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 bf02a6d..f78b8fb 100644 +--- a/dwl.c ++++ b/dwl.c +@@ -332,6 +332,7 @@ static Monitor *xytomon(double x, double y); + static void xytonode(double x, double y, struct wlr_surface **psurface, + Client **pc, LayerSurface **pl, double *nx, double *ny); + static void zoom(const Arg *arg); ++static void rotatetags(const Arg *arg); + + /* variables */ + static const char broken[] = "broken"; +@@ -2798,6 +2799,34 @@ zoom(const Arg *arg) + arrange(selmon); + } + ++static void ++rotatetags(const Arg *arg) ++{ ++ Arg newarg; ++ int i = arg->i; ++ int nextseltags = 0, curseltags = selmon->tagset[selmon->seltags]; ++ bool shift = false; ++ ++ switch(abs(i)) { ++ default: break; ++ case SHIFT_R: ++ shift = true; ++ break; ++ }; ++ ++ if (i > 0) ++ nextseltags = (curseltags << 1) | (curseltags >> (TAGCOUNT - 1)); ++ else ++ nextseltags = (curseltags >> 1) | (curseltags << (TAGCOUNT - 1)); ++ ++ newarg.i = nextseltags; ++ ++ if (shift) { ++ tag(&newarg); ++ } else ++ view(&newarg); ++} ++ + #ifdef XWAYLAND + void + activatex11(struct wl_listener *listener, void *data) +-- +2.43.0 + + +From 0a4148eaddfb313887c343fb5f5847df55642f2c Mon Sep 17 00:00:00 2001 +From: korei999 +Date: Mon, 22 Jan 2024 16:59:14 +0200 +Subject: [PATCH 2/2] use floats + +--- + config.def.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/config.def.h b/config.def.h +index f01f628..a80207a 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -137,8 +137,8 @@ static const Key keys[] = { + { MODKEY, XKB_KEY_d, rotatetags, {.i = VIEW_R} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_a, rotatetags, {.i = SHIFT_L} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_d, rotatetags, {.i = SHIFT_R} }, +- { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} }, +- { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} }, ++ { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, ++ { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, + { MODKEY, XKB_KEY_Return, zoom, {0} }, + { MODKEY, XKB_KEY_Tab, view, {0} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, +-- +2.43.0 +