Workspace styled movement

Mod+Left/Right/Up/Down für Fokus zwischen Workspaces und Clients
This commit is contained in:
irrlicht
2026-04-11 14:53:58 +02:00
parent d5be459977
commit 68070aea9c
2 changed files with 36 additions and 13 deletions
+6 -13
View File
@@ -140,21 +140,14 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_space, setlayout, {0} }, { MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} }, { MODKEY, XKB_KEY_e, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} }, { MODKEY, XKB_KEY_Left, shiftview, {.i = -1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} }, { MODKEY, XKB_KEY_Right, shiftview, {.i = +1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Left, shiftclient, {.i = -1} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Right, shiftclient, {.i = +1} },
{ MODKEY, XKB_KEY_Up, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_Down, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} }, { MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} }, { MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.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_Q, quit, {0} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */ /* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
+30
View File
@@ -329,6 +329,8 @@ static void setmon(Client *c, Monitor *m, uint32_t newtags);
static void setpsel(struct wl_listener *listener, void *data); static void setpsel(struct wl_listener *listener, void *data);
static void setsel(struct wl_listener *listener, void *data); static void setsel(struct wl_listener *listener, void *data);
static void setup(void); static void setup(void);
static void shiftclient(const Arg *arg);
static void shiftview(const Arg *arg);
static void spawn(const Arg *arg); static void spawn(const Arg *arg);
static void startdrag(struct wl_listener *listener, void *data); static void startdrag(struct wl_listener *listener, void *data);
static void tag(const Arg *arg); static void tag(const Arg *arg);
@@ -2709,6 +2711,34 @@ tagmon(const Arg *arg)
setmon(sel, dirtomon(arg->i), 0); setmon(sel, dirtomon(arg->i), 0);
} }
void
shiftview(const Arg *arg)
{
Arg a;
unsigned int tagmask = selmon->tagset[selmon->seltags];
if (arg->i > 0)
a.ui = (tagmask == (1u << (TAGCOUNT - 1))) ? 1 : tagmask << 1;
else
a.ui = (tagmask == 1) ? (1u << (TAGCOUNT - 1)) : tagmask >> 1;
view(&a);
}
void
shiftclient(const Arg *arg)
{
Client *sel = focustop(selmon);
Arg a;
unsigned int tagmask = selmon->tagset[selmon->seltags];
if (!sel)
return;
if (arg->i > 0)
a.ui = (tagmask == (1u << (TAGCOUNT - 1))) ? 1 : tagmask << 1;
else
a.ui = (tagmask == 1) ? (1u << (TAGCOUNT - 1)) : tagmask >> 1;
sel->tags = a.ui;
view(&a);
}
void void
tile(Monitor *m) tile(Monitor *m)
{ {