mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-06-22 15:12:47 +00:00
Compare commits
1 Commits
v0.8
..
7af0b45334
| Author | SHA1 | Date | |
|---|---|---|---|
| 7af0b45334 |
@@ -1,13 +1,5 @@
|
|||||||
# dwl - dwm for Wayland
|
# dwl - dwm for Wayland
|
||||||
|
|
||||||
2025-08-16:
|
|
||||||
dwl IS CURRENTLY UN-MAINTAINED.
|
|
||||||
AT THE PRESENT TIME, I (@fauxmight) DO NOT HAVE
|
|
||||||
THE TIME OR CAPACITY TO KEEP UP WITH [wlroots] CHANGES.
|
|
||||||
IF YOU ARE INTERESTED IN TAKING ON LEAD DEVELOPER RESPONSIBILITIES,
|
|
||||||
SEE ISSUE [#1166](https://codeberg.org/dwl/dwl/issues/1166).
|
|
||||||
---
|
|
||||||
|
|
||||||
Join us on our IRC channel: [#dwl on Libera Chat]
|
Join us on our IRC channel: [#dwl on Libera Chat]
|
||||||
Or on the community-maintained [Discord server].
|
Or on the community-maintained [Discord server].
|
||||||
|
|
||||||
|
|||||||
@@ -291,11 +291,18 @@ client_is_unmanaged(Client *c)
|
|||||||
static inline void
|
static inline void
|
||||||
client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
|
client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
|
||||||
{
|
{
|
||||||
if (kb)
|
uint32_t filtered[WLR_KEYBOARD_KEYS_CAP];
|
||||||
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes,
|
size_t size = 0;
|
||||||
kb->num_keycodes, &kb->modifiers);
|
if (!kb) {
|
||||||
else
|
|
||||||
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (size_t i = 0; i < kb->num_keycodes; i++) {
|
||||||
|
uint32_t key = kb->keycodes[i];
|
||||||
|
if (!consumed[key])
|
||||||
|
filtered[size++] = key;
|
||||||
|
}
|
||||||
|
wlr_seat_keyboard_notify_enter(seat, s, filtered, size, &kb->modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|||||||
+46
-42
@@ -20,11 +20,12 @@ static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You ca
|
|||||||
/* logging */
|
/* logging */
|
||||||
static int log_level = WLR_ERROR;
|
static int log_level = WLR_ERROR;
|
||||||
|
|
||||||
|
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||||
static const Rule rules[] = {
|
static const Rule rules[] = {
|
||||||
/* app_id title tags mask isfloating monitor */
|
/* app_id title tags mask isfloating monitor */
|
||||||
|
/* examples: */
|
||||||
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||||
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||||
/* default/example rule: can be changed but cannot be eliminated; at least one rule must exist */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
@@ -37,14 +38,17 @@ static const Layout layouts[] = {
|
|||||||
|
|
||||||
/* monitors */
|
/* monitors */
|
||||||
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
|
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
|
||||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients
|
||||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
|
||||||
|
*/
|
||||||
|
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
|
||||||
static const MonitorRule monrules[] = {
|
static const MonitorRule monrules[] = {
|
||||||
/* name mfact nmaster scale layout rotate/reflect x y
|
/* name mfact nmaster scale layout rotate/reflect x y */
|
||||||
* example of a HiDPI laptop monitor:
|
/* example of a HiDPI laptop monitor:
|
||||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
|
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
|
*/
|
||||||
|
/* defaults */
|
||||||
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
@@ -119,41 +123,41 @@ static const char *termcmd[] = { "foot", NULL };
|
|||||||
static const char *menucmd[] = { "wmenu-run", NULL };
|
static const char *menucmd[] = { "wmenu-run", NULL };
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* Note that Shift changes certain key codes: 2 -> at, etc. */
|
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||||
{ 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, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||||
{ 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, XKB_KEY_Return, zoom, {0} },
|
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_c, killclient, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ 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_0, view, {.ui = ~0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||||
{ 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_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
|
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
|
||||||
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
|
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
|
||||||
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
|
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
|
||||||
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
|
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
|
||||||
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
||||||
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
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 */
|
||||||
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
||||||
|
|||||||
@@ -291,7 +291,7 @@ static void gpureset(struct wl_listener *listener, void *data);
|
|||||||
static void handlesig(int signo);
|
static void handlesig(int signo);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void inputdevice(struct wl_listener *listener, void *data);
|
static void inputdevice(struct wl_listener *listener, void *data);
|
||||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
static const Key * keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||||
static void keypress(struct wl_listener *listener, void *data);
|
static void keypress(struct wl_listener *listener, void *data);
|
||||||
static void keypressmod(struct wl_listener *listener, void *data);
|
static void keypressmod(struct wl_listener *listener, void *data);
|
||||||
static int keyrepeat(void *data);
|
static int keyrepeat(void *data);
|
||||||
@@ -405,6 +405,7 @@ static struct wlr_output_layout *output_layout;
|
|||||||
static struct wlr_box sgeom;
|
static struct wlr_box sgeom;
|
||||||
static struct wl_list mons;
|
static struct wl_list mons;
|
||||||
static Monitor *selmon;
|
static Monitor *selmon;
|
||||||
|
static bool consumed[KEY_MAX + 1];
|
||||||
|
|
||||||
/* global event handlers */
|
/* global event handlers */
|
||||||
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
||||||
@@ -1605,7 +1606,7 @@ inputdevice(struct wl_listener *listener, void *data)
|
|||||||
wlr_seat_set_capabilities(seat, caps);
|
wlr_seat_set_capabilities(seat, caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
const Key *
|
||||||
keybinding(uint32_t mods, xkb_keysym_t sym)
|
keybinding(uint32_t mods, xkb_keysym_t sym)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -1616,13 +1617,10 @@ keybinding(uint32_t mods, xkb_keysym_t sym)
|
|||||||
const Key *k;
|
const Key *k;
|
||||||
for (k = keys; k < END(keys); k++) {
|
for (k = keys; k < END(keys); k++) {
|
||||||
if (CLEANMASK(mods) == CLEANMASK(k->mod)
|
if (CLEANMASK(mods) == CLEANMASK(k->mod)
|
||||||
&& xkb_keysym_to_lower(sym) == xkb_keysym_to_lower(k->keysym)
|
&& sym == k->keysym && k->func)
|
||||||
&& k->func) {
|
return k;
|
||||||
k->func(&k->arg);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1648,8 +1646,14 @@ keypress(struct wl_listener *listener, void *data)
|
|||||||
/* On _press_ if there is no active screen locker,
|
/* On _press_ if there is no active screen locker,
|
||||||
* attempt to process a compositor keybinding. */
|
* attempt to process a compositor keybinding. */
|
||||||
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
for (i = 0; i < nsyms; i++)
|
for (i = 0; i < nsyms; i++) {
|
||||||
handled = keybinding(mods, syms[i]) || handled;
|
const Key *key = keybinding(mods, syms[i]);
|
||||||
|
if (key) {
|
||||||
|
consumed[event->keycode] = true;
|
||||||
|
key->func(&key->arg);
|
||||||
|
handled = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {
|
if (handled && group->wlr_group->keyboard.repeat_info.delay > 0) {
|
||||||
@@ -1666,6 +1670,11 @@ keypress(struct wl_listener *listener, void *data)
|
|||||||
if (handled)
|
if (handled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (consumed[event->keycode]) {
|
||||||
|
if (event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
||||||
|
consumed[event->keycode] = false;
|
||||||
|
return; // don't pass to the client the release event of a handled key-press
|
||||||
|
}
|
||||||
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
|
wlr_seat_set_keyboard(seat, &group->wlr_group->keyboard);
|
||||||
/* Pass unhandled keycodes along to the client. */
|
/* Pass unhandled keycodes along to the client. */
|
||||||
wlr_seat_keyboard_notify_key(seat, event->time_msec,
|
wlr_seat_keyboard_notify_key(seat, event->time_msec,
|
||||||
@@ -1696,8 +1705,11 @@ keyrepeat(void *data)
|
|||||||
wl_event_source_timer_update(group->key_repeat_source,
|
wl_event_source_timer_update(group->key_repeat_source,
|
||||||
1000 / group->wlr_group->keyboard.repeat_info.rate);
|
1000 / group->wlr_group->keyboard.repeat_info.rate);
|
||||||
|
|
||||||
for (i = 0; i < group->nsyms; i++)
|
for (i = 0; i < group->nsyms; i++) {
|
||||||
keybinding(group->mods, group->keysyms[i]);
|
const Key *key = keybinding(group->mods, group->keysyms[i]);
|
||||||
|
if (key)
|
||||||
|
key->func(&key->arg);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user