summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2025-03-01 23:04:30 +0100
committerJoe <rbo@gmx.us>2025-03-01 23:04:30 +0100
commit9d077d8470887a39acc20056563e102fcf62d16d (patch)
treef8a7dd42da1c37b0882b38fa2f9650acc3336043
parentgaps and shit (diff)
downloaddwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.gz
dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.bz2
dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.xz
dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.zst
dwl-9d077d8470887a39acc20056563e102fcf62d16d.zip
shifted
-rw-r--r--config.def.h28
-rw-r--r--dwl.c31
2 files changed, 47 insertions, 12 deletions
diff --git a/config.def.h b/config.def.h
index 2c7ad73..10339b6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -185,9 +185,13 @@ static const Key keys[] = {
{ MODKEY|CTRL, XKB_KEY_x, incnmaster, {.i = -1} },
{ MODKEY|CTRL, XKB_KEY_minus, setmfact, {.f = -0.025f} },
{ MODKEY|CTRL, XKB_KEY_equal, setmfact, {.f = +0.025f} },
- { MODKEY, XKB_KEY_minus, incigaps, {.i = -1 } },
- { MODKEY, XKB_KEY_equal, incigaps, {.i = +1 } },
+ { MODKEY, XKB_KEY_minus, incigaps, {.i = -1 } },
+ { MODKEY, XKB_KEY_equal, incigaps, {.i = +1 } },
{ MODKEY|SHIFT, XKB_KEY_plus, togglegaps, {0} },
+ { MODKEY|CTRL, XKB_KEY_h, shiftview, { .i = -1 } },
+ { MODKEY|CTRL, XKB_KEY_l, shiftview, { .i = +1 } },
+ { MODKEY|META, XKB_KEY_h, shiftboth, { .i = -1 } },
+ { MODKEY|META, XKB_KEY_l, shiftboth, { .i = +1 } },
{ MODKEY|SHIFT, XKB_KEY_Return, zoom, {0} },
{ META, XKB_KEY_Escape, view, {0} },
{ MODKEY, XKB_KEY_q, killclient, {0} },
@@ -211,16 +215,16 @@ static const Key keys[] = {
{ MODKEY|SHIFT, XKB_KEY_L, focusmon, {.i = WLR_DIRECTION_RIGHT} },
{ MODKEY|SHIFT, XKB_KEY_leftmiddlecurlybrace, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|SHIFT, XKB_KEY_rightmiddlecurlybrace, focusmon, {.i = WLR_DIRECTION_RIGHT} },
- TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
- TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
- TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
- TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
- TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
- TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
- TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
- TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
- TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
- { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, quit, {0} },
+ TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
+ TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
+ TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
+ TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
+ TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
+ TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
+ TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
+ TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
+ TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
+ { MODKEY|SHIFT, XKB_KEY_E, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
diff --git a/dwl.c b/dwl.c
index f8af818..1750080 100644
--- a/dwl.c
+++ b/dwl.c
@@ -383,6 +383,8 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data);
static void setup(void);
+static void shiftboth(const Arg *arg);
+static void shiftview(const Arg *arg);
static void spawn(const Arg *arg);
static void startdrag(struct wl_listener *listener, void *data);
static int statusin(int fd, unsigned int mask, void *data);
@@ -3069,6 +3071,35 @@ setup(void)
}
#endif
}
+void
+shiftboth(const Arg *arg)
+{
+ Arg shifted;
+ shifted.ui = selmon->tagset[selmon->seltags];
+
+ if (arg->i > 0) /* left circular shift */
+ shifted.ui = ((shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i)));
+ else /* right circular shift */
+ shifted.ui = ((shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i)));
+ tag(&shifted);
+ view(&shifted);
+}
+
+void
+shiftview(const Arg *arg)
+{
+ Arg shifted;
+ shifted.ui = selmon->tagset[selmon->seltags];
+
+ if (arg->i > 0) { /* left circular shift */
+ shifted.ui = (shifted.ui << arg->i) | (shifted.ui >> (LENGTH(tags) - arg->i));
+ // shifted.ui &= ~SPTAGMASK;
+ } else { /* right circular shift */
+ shifted.ui = (shifted.ui >> (- arg->i) | shifted.ui << (LENGTH(tags) + arg->i));
+ // shifted.ui &= ~SPTAGMASK;
+ }
+ view(&shifted);
+}
void
spawn(const Arg *arg)