applied rotatetags patch

This commit is contained in:
λmolinae 2025-01-31 00:38:11 -06:00
parent 93642f22d0
commit 4b8630fee4
4 changed files with 53 additions and 1 deletions

View file

@ -22,6 +22,7 @@ philosophy. Like dwm, dwl is:
- [en-keycodes](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/en-keycodes) - [en-keycodes](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/en-keycodes)
- [genericgaps](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/genericgaps/) - [genericgaps](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/genericgaps/)
- [hide_vacant_tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags) - [hide_vacant_tags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/hide_vacant_tags)
- [rotatetags](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/rotatetags/rotatetags.patch)
- [setupenv](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv) - [setupenv](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv)
- [sticky](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/sticky) - [sticky](https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/sticky)
- [xkb-rules-switcher](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/xkb-rules-switcher/xkb-rules-switcher.patch) - [xkb-rules-switcher](https://codeberg.org/wochap/dwl/src/branch/v0.6-b/xkb-rules-switcher/xkb-rules-switcher.patch)

View file

@ -29,6 +29,13 @@ static uint32_t colors[][3] = {
[SchemeUrg] = { 0, 0, 0x770000ff }, [SchemeUrg] = { 0, 0, 0x770000ff },
}; };
enum {
VIEW_L = -1,
VIEW_R = 1,
SHIFT_L = -2,
SHIFT_R = 2,
} RotateTags;
/* tagging - TAGCOUNT must be no greater than 31 */ /* tagging - TAGCOUNT must be no greater than 31 */
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
@ -163,7 +170,11 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} }, { MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, { 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.05f} }, { MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, { MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } }, { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },

View file

@ -19,6 +19,13 @@ static const char *fonts[] = {"inconsolata:size=11"};
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */ /* This conforms to 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 */ 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 */ /* tagging - TAGCOUNT must be no greater than 31 */
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8" }; static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8" };
@ -182,6 +189,10 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, incnmaster, {.i = -1} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, incnmaster, {.i = -1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, incnmaster, {.i = +1} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_D, 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|WLR_MODIFIER_CTRL, XKB_KEY_a, setmfact, {.f = -0.05f} }, { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_a, setmfact, {.f = -0.05f} },
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_d, setmfact, {.f = +0.05f} }, { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_d, setmfact, {.f = +0.05f} },
{ MODKEY, XKB_KEY_w, switchxkbrule, {0} }, { MODKEY, XKB_KEY_w, switchxkbrule, {0} },

29
dwl.c
View file

@ -414,6 +414,7 @@ static Monitor *xytomon(double x, double y);
static void xytonode(double x, double y, struct wlr_surface **psurface, static void xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny); Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg); static void zoom(const Arg *arg);
static void rotatetags(const Arg *arg);
/* variables */ /* variables */
static pid_t child_pid = -1; static pid_t child_pid = -1;
@ -3594,6 +3595,34 @@ zoom(const Arg *arg)
arrange(selmon); 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 >> (LENGTH(tags) - 1));
else
nextseltags = (curseltags >> 1) | (curseltags << (LENGTH(tags) - 1));
newarg.i = nextseltags;
if (shift)
tag(&newarg);
else
view(&newarg);
}
#ifdef XWAYLAND #ifdef XWAYLAND
void void
activatex11(struct wl_listener *listener, void *data) activatex11(struct wl_listener *listener, void *data)