mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-06-21 14:42:44 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7af0b45334 | |||
| 6cd26568d5 | |||
| ed2e1efda8 |
@@ -4,9 +4,9 @@ Join us on our IRC channel: [#dwl on Libera Chat]
|
|||||||
Or on the community-maintained [Discord server].
|
Or on the community-maintained [Discord server].
|
||||||
|
|
||||||
dwl is a compact, hackable compositor for [Wayland] based on [wlroots]. It is
|
dwl is a compact, hackable compositor for [Wayland] based on [wlroots]. It is
|
||||||
intended to fill the same space in the Wayland world that dwm does in X11,
|
intended to fill the same space in the Wayland world that [dwm] does in X11,
|
||||||
primarily in terms of functionality, and secondarily in terms of
|
primarily in terms of functionality, and secondarily in terms of
|
||||||
philosophy. Like dwm, dwl is:
|
philosophy. Like [dwm], dwl is:
|
||||||
|
|
||||||
- Easy to understand, hack on, and extend with patches
|
- Easy to understand, hack on, and extend with patches
|
||||||
- One C source file (or a very small number) configurable via `config.h`
|
- One C source file (or a very small number) configurable via `config.h`
|
||||||
@@ -55,11 +55,11 @@ To enable XWayland, you should uncomment its flags in `config.mk`.
|
|||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
All configuration is done by editing `config.h` and recompiling, in the same
|
All configuration is done by editing `config.h` and recompiling, in the same
|
||||||
manner as dwm. There is no way to separately restart the window manager in
|
manner as [dwm]. There is no way to separately restart the window manager in
|
||||||
Wayland without restarting the entire display server, so any changes will take
|
Wayland without restarting the entire display server, so any changes will take
|
||||||
effect the next time dwl is executed.
|
effect the next time dwl is executed.
|
||||||
|
|
||||||
As in the dwm community, we encourage users to share patches they have
|
As in the [dwm] community, we encourage users to share patches they have
|
||||||
created. Check out the [dwl-patches] repository!
|
created. Check out the [dwl-patches] repository!
|
||||||
|
|
||||||
## Running dwl
|
## Running dwl
|
||||||
@@ -118,17 +118,26 @@ script with the line
|
|||||||
|
|
||||||
To get a list of status bars that work with dwl consult our [wiki].
|
To get a list of status bars that work with dwl consult our [wiki].
|
||||||
|
|
||||||
|
### (Known) Java nonreparenting WM issue
|
||||||
|
Certain IDEs don't display correctly unless an environmental variable for Java AWT
|
||||||
|
indicates that the WM is nonreparenting.
|
||||||
|
|
||||||
|
For some Java AWT-based IDEs, such as Xilinx Vivado and Microchip MPLAB X, the
|
||||||
|
following environment variable needs to be set before running the IDE or dwl:
|
||||||
|
|
||||||
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||||
|
|
||||||
## Replacements for X applications
|
## Replacements for X applications
|
||||||
|
|
||||||
You can find a [list of useful resources on our wiki].
|
You can find a [list of useful resources on our wiki].
|
||||||
|
|
||||||
## Background
|
## Background
|
||||||
|
|
||||||
dwl is not meant to provide every feature under the sun. Instead, like dwm, it
|
dwl is not meant to provide every feature under the sun. Instead, like [dwm], it
|
||||||
sticks to features which are necessary, simple, and straightforward to implement
|
sticks to features which are necessary, simple, and straightforward to implement
|
||||||
given the base on which it is built. Implemented default features are:
|
given the base on which it is built. Implemented default features are:
|
||||||
|
|
||||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings,
|
- Any features provided by [dwm]/Xlib: simple window borders, tags, keybindings,
|
||||||
client rules, mouse move/resize. Providing a built-in status bar is an
|
client rules, mouse move/resize. Providing a built-in status bar is an
|
||||||
exception to this goal, to avoid dependencies on font rendering and/or drawing
|
exception to this goal, to avoid dependencies on font rendering and/or drawing
|
||||||
libraries when an external bar could work well.
|
libraries when an external bar could work well.
|
||||||
@@ -145,10 +154,10 @@ given the base on which it is built. Implemented default features are:
|
|||||||
- Layer shell popups (used by Waybar)
|
- Layer shell popups (used by Waybar)
|
||||||
- Damage tracking provided by scenegraph API
|
- Damage tracking provided by scenegraph API
|
||||||
|
|
||||||
Given the Wayland architecture, dwl has to implement features from dwm **and**
|
Given the Wayland architecture, dwl has to implement features from [dwm] **and**
|
||||||
the xorg-server. Because of this, it is impossible to maintain the original
|
the xorg-server. Because of this, it is impossible to maintain the original
|
||||||
project goal of 2000 SLOC and have a reasonably complete compositor with
|
project goal of 2000 SLOC and have a reasonably complete compositor with
|
||||||
features comparable to dwm. However, this does not mean that the code will grow
|
features comparable to [dwm]. However, this does not mean that the code will grow
|
||||||
indiscriminately. We will try to keep the code as small as possible.
|
indiscriminately. We will try to keep the code as small as possible.
|
||||||
|
|
||||||
Features under consideration (possibly as patches) are:
|
Features under consideration (possibly as patches) are:
|
||||||
@@ -172,7 +181,7 @@ developers. This was made possible in many cases by looking at how sway
|
|||||||
accomplished something, then trying to do the same in as suckless a way as
|
accomplished something, then trying to do the same in as suckless a way as
|
||||||
possible.
|
possible.
|
||||||
|
|
||||||
Many thanks to suckless.org and the dwm developers and community for the
|
Many thanks to suckless.org and the [dwm] developers and community for the
|
||||||
inspiration, and to the various contributors to the project, including:
|
inspiration, and to the various contributors to the project, including:
|
||||||
|
|
||||||
- **Devin J. Pohly for creating and nurturing the fledgling project**
|
- **Devin J. Pohly for creating and nurturing the fledgling project**
|
||||||
@@ -183,6 +192,7 @@ inspiration, and to the various contributors to the project, including:
|
|||||||
|
|
||||||
|
|
||||||
[wlroots]: https://gitlab.freedesktop.org/wlroots
|
[wlroots]: https://gitlab.freedesktop.org/wlroots
|
||||||
|
[dwm]: https://dwm.suckless.org/
|
||||||
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
|
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
|
||||||
[#dwl on Libera Chat]: https://web.libera.chat/?channels=#dwl
|
[#dwl on Libera Chat]: https://web.libera.chat/?channels=#dwl
|
||||||
[0.7-rc1]: https://codeberg.org/dwl/dwl/releases/tag/v0.7-rc1
|
[0.7-rc1]: https://codeberg.org/dwl/dwl/releases/tag/v0.7-rc1
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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};
|
||||||
@@ -661,9 +662,6 @@ buttonpress(struct wl_listener *listener, void *data)
|
|||||||
selmon = xytomon(cursor->x, cursor->y);
|
selmon = xytomon(cursor->x, cursor->y);
|
||||||
setmon(grabc, selmon, 0);
|
setmon(grabc, selmon, 0);
|
||||||
grabc = NULL;
|
grabc = NULL;
|
||||||
/* Force update to cursor shape */
|
|
||||||
xytonode(cursor->x, cursor->y, NULL, &c, NULL, NULL, NULL);
|
|
||||||
focusclient(c, 1);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cursor_mode = CurNormal;
|
cursor_mode = CurNormal;
|
||||||
@@ -1608,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)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -1619,12 +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)
|
||||||
&& sym == k->keysym && k->func) {
|
&& sym == k->keysym && k->func)
|
||||||
k->func(&k->arg);
|
return k;
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1650,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) {
|
||||||
@@ -1668,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,
|
||||||
@@ -1698,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