diff options
author | Joe <rbo@gmx.us> | 2025-03-01 23:04:30 +0100 |
---|---|---|
committer | Joe <rbo@gmx.us> | 2025-03-01 23:04:30 +0100 |
commit | 9d077d8470887a39acc20056563e102fcf62d16d (patch) | |
tree | f8a7dd42da1c37b0882b38fa2f9650acc3336043 | |
parent | gaps and shit (diff) | |
download | dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.gz dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.bz2 dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.xz dwl-9d077d8470887a39acc20056563e102fcf62d16d.tar.zst dwl-9d077d8470887a39acc20056563e102fcf62d16d.zip |
shifted
-rw-r--r-- | config.def.h | 28 | ||||
-rw-r--r-- | dwl.c | 31 |
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} }, @@ -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) |