Compare commits
179 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
b86fcf6504 | ||
|
c00697e643 | ||
|
af741e586b | ||
|
02ac9378c4 | ||
|
437aea8662 | ||
|
6901743b0c | ||
|
720f56161e | ||
|
4d3adea683 | ||
|
79b7e755b0 | ||
|
b424602ebc | ||
|
ae31391115 | ||
|
2d6f932ecf | ||
|
aab397c30b | ||
|
cb4265ac8c | ||
|
a95338ca43 | ||
|
ae614ee512 | ||
|
feb972acd0 | ||
|
bf8cc526de | ||
|
7a2e0eef74 | ||
|
3bace9ce6b | ||
|
4ef8999624 | ||
|
7d724dc7f3 | ||
|
326eee1444 | ||
|
d8f430accf | ||
|
6aed9dc1ac | ||
|
358562e2df | ||
|
9aec6049ec | ||
|
330792b1fc | ||
|
86fe15f76c | ||
|
ee1a72211d | ||
|
2bc01debdc | ||
|
c50f187c1f | ||
|
0dea553428 | ||
|
44932053ba | ||
|
dd463b25c7 | ||
|
19c14b058c | ||
|
e645ea8301 | ||
|
e4bf83e26d | ||
|
d50bb97f56 | ||
|
475c134144 | ||
|
467123dc99 | ||
|
254f799fde | ||
|
0815626d4c | ||
|
1b22ef1616 | ||
|
f1c92b05fb | ||
|
1dfd867d9c | ||
|
294fb324d8 | ||
|
79f85bde99 | ||
|
2768af5a9b | ||
|
863eedd05e | ||
|
b92c0ff57f | ||
|
1087bc5db9 | ||
|
88f241d1cf | ||
|
43228bd493 | ||
|
ebff6e38a0 | ||
|
2cd0b3173d | ||
|
0c4740b277 | ||
|
08020d61b7 | ||
|
4d26d30220 | ||
|
0e5d7124de | ||
|
c49a42ee58 | ||
|
4465dcb6da | ||
|
b97d9e1ce1 | ||
|
2b2f72d7c2 | ||
|
05a473335e | ||
|
5d9c9a9a68 | ||
|
f673305e86 | ||
|
8cace19218 | ||
|
3e6d584de1 | ||
|
ebed67596d | ||
|
f83f1049db | ||
|
d1ff1e6f75 | ||
|
b0098d9d09 | ||
|
2d2c21664c | ||
|
52a33a2f1e | ||
|
9090106334 | ||
|
a15cb1e20e | ||
|
b860932cda | ||
|
22a6f6661a | ||
|
bda7b31174 | ||
|
ac896a7df4 | ||
|
f587b2fd2c | ||
|
317175da08 | ||
|
f4ae4c1a0b | ||
|
f85d8e79d0 | ||
|
09413da6e3 | ||
|
27514b9593 | ||
|
27f66c8715 | ||
|
52dbc97ed6 | ||
|
852fe819c4 | ||
|
2315462f96 | ||
|
c71a3ac594 | ||
|
03e167dbb7 | ||
|
894f2a3152 | ||
|
05ac420342 | ||
|
ebfefa84ba | ||
|
2d9740c2fc | ||
|
2c9423d1b7 | ||
|
df332de9d2 | ||
|
96ce40cfe9 | ||
|
99fbebcae3 | ||
|
d3efb0b29b | ||
|
1e1482adcb | ||
|
7de6920bd7 | ||
|
c8bf457c0f | ||
|
0146a9954b | ||
|
be6f573b4e | ||
|
1b38801eef | ||
|
929d3d9569 | ||
|
40e45a336a | ||
|
0c1e621b82 | ||
|
417e958a15 | ||
|
2e9c4d8ea9 | ||
|
79dcc0d327 | ||
|
55bbbc3dcb | ||
|
d4e08c0762 | ||
|
772c0fe1bd | ||
|
3273f749ea | ||
|
1183a319a0 | ||
|
3f70bbb5c4 | ||
|
8aa50dfdf1 | ||
|
d175a58d73 | ||
|
52e6bf4735 | ||
|
3b05eadeaf | ||
|
f9f3f3432b | ||
|
d4ce92a7b5 | ||
|
34521ea43b | ||
|
c6f96d5391 | ||
|
bd2f7fbb40 | ||
|
823cefd292 | ||
|
60c40c0989 | ||
|
5dfd7cf180 | ||
|
06ca860092 | ||
|
56d93898ea | ||
|
9ab5e01d5b | ||
|
ce9f264919 | ||
|
d8cf65c74f | ||
|
93a58abf29 | ||
|
1b139a860d | ||
|
41bb7a7679 | ||
|
2f39fb84ac | ||
|
d57db4cac9 | ||
|
3f86336bad | ||
|
3727f4a7b3 | ||
|
4170a90fbc | ||
|
6a0dec69ec | ||
|
b372d4b55e | ||
|
77e75cf554 | ||
|
9071ce6c84 | ||
|
84b26ef1ba | ||
|
3a72cd924c | ||
|
2a9404ac2a | ||
|
3c83e0cfb8 | ||
|
e73ea679f4 | ||
|
db647f2df6 | ||
|
cd3d0a102f | ||
|
38ba6d2277 | ||
|
c2b53c2d8d | ||
|
ecc60878b3 | ||
|
43b6e804cf | ||
|
fba820d5f6 | ||
|
1fa72b0772 | ||
|
7cee5060bc | ||
|
2144546192 | ||
|
15f5d31f98 | ||
|
5b51bb82e2 | ||
|
f5e7caac00 | ||
|
593b7eec3c | ||
|
b063dd89c3 | ||
|
fd498e1910 | ||
|
02eed717ca | ||
|
2d71c9b9ff | ||
|
87b16e6095 | ||
|
c1eb2b49cd | ||
|
e8192b4fc9 | ||
|
4798450944 | ||
|
a1e24075d8 | ||
|
27598bd04a | ||
|
3868217466 |
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -2,9 +2,21 @@
|
||||
name: Bug report
|
||||
about: Something in dwl isn't working correctly
|
||||
title: ''
|
||||
labels: 'Type: bug'
|
||||
labels: 'A: bug'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
## Info
|
||||
dwl's commit:
|
||||
wlroots version:
|
||||
## Description
|
||||
<!--
|
||||
Only report bugs that can be reproduced on the main line
|
||||
Report patch issues to their respective authors
|
||||
If the patch author doesn't respond within a reasonable time, email me:
|
||||
|
||||
Leonardo Hernández Hernández <leohdz172@protonmail.com>
|
||||
|
||||
but note that I'm NOT making any promises
|
||||
-->
|
||||
|
2
.github/ISSUE_TEMPLATE/enhancement-idea.md
vendored
2
.github/ISSUE_TEMPLATE/enhancement-idea.md
vendored
@@ -2,7 +2,7 @@
|
||||
name: Enhancement idea
|
||||
about: Suggest a feature or improvement
|
||||
title: ''
|
||||
labels: 'Type: enhancement'
|
||||
labels: 'A: enhancement'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
2
LICENSE
2
LICENSE
@@ -2,7 +2,7 @@ dwl - dwm for Wayland
|
||||
|
||||
Copyright © 2020 dwl team
|
||||
|
||||
See also the files LICENSE.tinywl and LICENSE.dwm.
|
||||
See also the files LICENSE.tinywl, LICENSE.dwm and LICENSE.sway.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
19
LICENSE.sway
Normal file
19
LICENSE.sway
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2016-2017 Drew DeVault
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
27
Makefile
27
Makefile
@@ -1,6 +1,6 @@
|
||||
include config.mk
|
||||
|
||||
CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99
|
||||
CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99 -pedantic
|
||||
|
||||
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
|
||||
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
|
||||
@@ -11,6 +11,18 @@ LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
|
||||
|
||||
all: dwl
|
||||
|
||||
clean:
|
||||
rm -f dwl *.o *-protocol.h *-protocol.c
|
||||
|
||||
install: dwl
|
||||
install -Dm755 dwl $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
install -Dm644 dwl.1 $(DESTDIR)$(MANDIR)/man1/dwl.1
|
||||
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1
|
||||
|
||||
.PHONY: all clean install uninstall
|
||||
|
||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
||||
# protocols, which are specified in XML. wlroots requires you to rig these up
|
||||
# to your build system yourself and provide them in the include path.
|
||||
@@ -47,15 +59,6 @@ idle-protocol.o: idle-protocol.h
|
||||
config.h: | config.def.h
|
||||
cp config.def.h $@
|
||||
|
||||
dwl.o: config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h idle-protocol.h
|
||||
dwl.o: config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h idle-protocol.h util.h
|
||||
|
||||
dwl: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o idle-protocol.o
|
||||
|
||||
clean:
|
||||
rm -f dwl *.o *-protocol.h *-protocol.c
|
||||
|
||||
install: dwl
|
||||
install -D dwl $(PREFIX)/bin/dwl
|
||||
|
||||
.DEFAULT_GOAL=dwl
|
||||
.PHONY: clean
|
||||
dwl: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o idle-protocol.o util.o
|
||||
|
45
README.md
45
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
Join us on our [Discord server](https://discord.gg/jJxZnrGPWN)!
|
||||
|
||||
dwl is a compact, hackable compositor for Wayland based on [wlroots](https://github.com/swaywm/wlroots). It is intended to fill the same space in the Wayland world that dwm does in X11, primarily in terms of philosophy, and secondarily in terms of functionality. Like dwm, dwl is:
|
||||
dwl is a compact, hackable compositor for Wayland based on [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots/). It is intended to fill the same space in the Wayland world that dwm does in X11, primarily in terms of philosophy, and secondarily in terms of functionality. Like dwm, dwl is:
|
||||
|
||||
- Easy to understand, hack on, and extend with patches
|
||||
- One C source file (or a very small number) configurable via `config.h`
|
||||
@@ -11,33 +11,33 @@ dwl is a compact, hackable compositor for Wayland based on [wlroots](https://git
|
||||
|
||||
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 given the base on which it is built. Implemented default features are:
|
||||
|
||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings, client rules, mouse move/resize. The built-in status bar is an exception to avoid taking a dependency on FreeType or Pango and increasing the SLOC
|
||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings, 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 libraries when an external bar could work well.
|
||||
- Configurable multi-monitor layout support, including position and rotation
|
||||
- Configurable HiDPI/multi-DPI support
|
||||
- Idle-inhibit protocol which lets applications such as mpv disable idle monitoring
|
||||
- Provide information to external status bars via stdout/stdin
|
||||
- Urgency hints via xdg-activate protocol
|
||||
- Support screen lockers via input-inhibitor protocol
|
||||
- Various Wayland protocols
|
||||
- XWayland support as provided by wlroots
|
||||
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
|
||||
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
|
||||
- Layer shell popups (used by Waybar)
|
||||
- Damage tracking provided by scenegraph API
|
||||
|
||||
Features under consideration (possibly as patches) are:
|
||||
|
||||
- Protocols made trivial by wlroots
|
||||
- Communication from the compositor to status bars. A straightforward possibility would be to use stdout or a provided file descriptor.
|
||||
- Implement the input-inhibitor protocol to support screen lockers
|
||||
- Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring
|
||||
- Layer shell popups (used by Waybar)
|
||||
- Basic yes/no damage tracking to avoid needless redraws
|
||||
- More in-depth damage region tracking ([which may improve power usage](https://mozillagfx.wordpress.com/2019/10/22/dramatically-reduced-power-usage-in-firefox-70-on-macos-with-core-animation/))
|
||||
- Implement the text-input and input-method protocols to support IME once ibus implements input-method v2 (see https://github.com/ibus/ibus/pull/2256 and https://github.com/djpohly/dwl/pull/12)
|
||||
- Implement urgent/attention/focus-request once it's part of the xdg-shell protocol (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9)
|
||||
|
||||
Feature *non-goals* include:
|
||||
Feature *non-goals* for the main codebase include:
|
||||
|
||||
- Client-side decoration (any more than is necessary to tell the clients not to)
|
||||
- Client-initiated window management, such as move, resize, and close, which can be done through the compositor
|
||||
- Animations and visual effects
|
||||
|
||||
## Building dwl
|
||||
|
||||
dwl has only two dependencies: wlroots 0.12 and wayland-protocols. Simply install these and run `make`. If you wish to build against a Git version of wlroots, check out the [wlroots-next branch](https://github.com/djpohly/dwl/tree/wlroots-next).
|
||||
dwl has only two dependencies: wlroots and wayland-protocols. Simply install these (and their `-devel` versions if your distro has separate development packages) and run `make`. If you wish to build against a Git version of wlroots, check out the [wlroots-next branch](https://github.com/djpohly/dwl/tree/wlroots-next).
|
||||
|
||||
To enable XWayland, you should also install xorg-xwayland and uncomment its flag in `config.mk`.
|
||||
|
||||
@@ -49,14 +49,27 @@ As in the dwm community, we encourage users to share patches they have created.
|
||||
|
||||
## Running dwl
|
||||
|
||||
dwl can be run as-is, with no arguments. In an existing Wayland or X11 session, this will open a window to act as a virtual display. When run from a TTY, the Wayland server will take over the entire virtual terminal. Clients started by dwl will have `WAYLAND_DISPLAY` set in their environment, and other clients can be started from outside the session by setting this variable accordingly.
|
||||
dwl can be run on any of the backends supported by wlroots. This means you can run it as a separate window inside either an X11 or Wayland session, as well as directly from a VT console. Depending on your distro's setup, you may need to add your user to the `video` and `input` groups before you can run dwl on a VT.
|
||||
|
||||
You can also specify a startup program using the `-s` option. The argument to this option will be run at startup as a shell command (using `sh -c`) and can serve a similar function to `.xinitrc`: starting a service manager or other startup applications. Unlike `.xinitrc`, the display server will not shut down when this process terminates. Instead, as dwl is shutting down, it will send this process a SIGTERM and wait for it to terminate (if it hasn't already). This makes it ideal not only for initialization but also for execing into a user-level service manager like s6 or `systemd --user`.
|
||||
When dwl is run with no arguments, it will launch the server and begin handling any shortcuts configured in `config.h`. There is no status bar or other decoration initially; these are instead clients that can be run within the Wayland session.
|
||||
|
||||
Note: Wayland requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager such as `elogind` or `systemd-logind`. If your system doesn't do this automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
If you would like to run a script or command automatically at startup, you can specify the command using the `-s` option. This command will be executed as a shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`, but differs in that the display server will not shut down when this process terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait for it to terminate (if it hasn't already). This makes it ideal for execing into a user service manager like [s6](https://skarnet.org/software/s6/), [anopa](https://jjacky.com/anopa/), [runit](http://smarden.org/runit/faq.html#userservices), or [`systemd --user`](https://wiki.archlinux.org/title/Systemd/User).
|
||||
|
||||
Note: The `-s` command is run as a *child process* of dwl, which means that it does not have the ability to affect the environment of dwl or of any processes that it spawns. If you need to set environment variables that affect the entire dwl session, these must be set prior to running dwl. For example, Wayland requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager such as `elogind` or `systemd-logind`. If your system doesn't do this automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
|
||||
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-$(id -u)
|
||||
mkdir -p $XDG_RUNTIME_DIR
|
||||
dwl
|
||||
|
||||
### Status information
|
||||
|
||||
Information about selected layouts, current window title, and selected/occupied/urgent tags is written to the stdin of the `-s` command (see the `printstatus()` function for details). This information can be used to populate an external status bar with a script that parses the information. Failing to read this information will cause dwl to block, so if you do want to run a startup command that does not consume the status information, you can close standard input with the `<&-` shell redirection, for example:
|
||||
|
||||
dwl -s 'foot --server <&-'
|
||||
|
||||
If your startup command is a shell script, you can achieve the same inside the script with the line
|
||||
|
||||
exec <&-
|
||||
|
||||
## Replacements for X applications
|
||||
|
||||
@@ -64,7 +77,7 @@ You can find a [list of Wayland applications on the sway wiki](https://github.co
|
||||
|
||||
## IRC channel
|
||||
|
||||
dwl's IRC channel is #dwl on irc.freenode.net.
|
||||
dwl's IRC channel is #dwl on irc.libera.chat.
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
|
116
client.h
116
client.h
@@ -5,7 +5,7 @@
|
||||
* that they will simply compile out if the chosen #defines leave them unused.
|
||||
*/
|
||||
|
||||
/* Leave this function first; it's used in the others */
|
||||
/* Leave these functions first; they're used in the others */
|
||||
static inline int
|
||||
client_is_x11(Client *c)
|
||||
{
|
||||
@@ -16,6 +16,16 @@ client_is_x11(Client *c)
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline struct wlr_surface *
|
||||
client_surface(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->surface;
|
||||
#endif
|
||||
return c->surface.xdg->surface;
|
||||
}
|
||||
|
||||
/* The others */
|
||||
static inline void
|
||||
client_activate_surface(struct wlr_surface *s, int activated)
|
||||
@@ -35,14 +45,12 @@ client_activate_surface(struct wlr_surface *s, int activated)
|
||||
static inline void
|
||||
client_for_each_surface(Client *c, wlr_surface_iterator_func_t fn, void *data)
|
||||
{
|
||||
wlr_surface_for_each_surface(client_surface(c), fn, data);
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
wlr_surface_for_each_surface(c->surface.xwayland->surface,
|
||||
fn, data);
|
||||
if (client_is_x11(c))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
wlr_xdg_surface_for_each_surface(c->surface.xdg, fn, data);
|
||||
wlr_xdg_surface_for_each_popup_surface(c->surface.xdg, fn, data);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
@@ -82,17 +90,50 @@ client_get_title(Client *c)
|
||||
|
||||
static inline int
|
||||
client_is_float_type(Client *c)
|
||||
{
|
||||
struct wlr_xdg_toplevel *toplevel;
|
||||
struct wlr_xdg_toplevel_state state;
|
||||
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||
struct wlr_xwayland_surface_size_hints *size_hints;
|
||||
if (surface->modal)
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < surface->window_type_len; i++)
|
||||
if (surface->window_type[i] == netatom[NetWMWindowTypeDialog] ||
|
||||
surface->window_type[i] == netatom[NetWMWindowTypeSplash] ||
|
||||
surface->window_type[i] == netatom[NetWMWindowTypeToolbar] ||
|
||||
surface->window_type[i] == netatom[NetWMWindowTypeUtility])
|
||||
return 1;
|
||||
|
||||
size_hints = surface->size_hints;
|
||||
if (size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
|
||||
&& (size_hints->max_width == size_hints->min_width ||
|
||||
size_hints->max_height == size_hints->min_height))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
toplevel = c->surface.xdg->toplevel;
|
||||
state = toplevel->current;
|
||||
return (state.min_width != 0 && state.min_height != 0
|
||||
&& (state.min_width == state.max_width
|
||||
|| state.min_height == state.max_height))
|
||||
|| toplevel->parent;
|
||||
}
|
||||
|
||||
static inline int
|
||||
client_wants_fullscreen(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
for (size_t i = 0; i < c->surface.xwayland->window_type_len; i++)
|
||||
if (c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeDialog] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeSplash] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeToolbar] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeUtility])
|
||||
return 1;
|
||||
return c->surface.xwayland->fullscreen;
|
||||
#endif
|
||||
return 0;
|
||||
return c->surface.xdg->toplevel->requested.fullscreen;
|
||||
}
|
||||
|
||||
static inline int
|
||||
@@ -141,14 +182,14 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
|
||||
return wlr_xdg_toplevel_set_size(c->surface.xdg, width, height);
|
||||
}
|
||||
|
||||
static inline struct wlr_surface *
|
||||
client_surface(Client *c)
|
||||
static inline void
|
||||
client_set_tiled(Client *c, uint32_t edges)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->surface;
|
||||
return;
|
||||
#endif
|
||||
return c->surface.xdg->surface;
|
||||
wlr_xdg_toplevel_set_tiled(c->surface.xdg, edges);
|
||||
}
|
||||
|
||||
static inline struct wlr_surface *
|
||||
@@ -161,3 +202,44 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
|
||||
#endif
|
||||
return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy);
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_min_size(Client *c, int *width, int *height)
|
||||
{
|
||||
struct wlr_xdg_toplevel *toplevel;
|
||||
struct wlr_xdg_toplevel_state *state;
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
struct wlr_xwayland_surface_size_hints *size_hints;
|
||||
size_hints = c->surface.xwayland->size_hints;
|
||||
*width = size_hints->min_width;
|
||||
*height = size_hints->min_height;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
toplevel = c->surface.xdg->toplevel;
|
||||
state = &toplevel->current;
|
||||
*width = state->min_width;
|
||||
*height = state->min_height;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_from_popup(struct wlr_xdg_popup *popup)
|
||||
{
|
||||
struct wlr_xdg_surface *surface = popup->base;
|
||||
|
||||
while (1) {
|
||||
switch (surface->role) {
|
||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||
if (!wlr_surface_is_xdg_surface(surface->popup->parent))
|
||||
return NULL;
|
||||
|
||||
surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
|
||||
break;
|
||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||
return surface->data;
|
||||
case WLR_XDG_SURFACE_ROLE_NONE:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
config.def.h
27
config.def.h
@@ -1,6 +1,7 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
||||
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
||||
@@ -12,8 +13,8 @@ static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
/* examples:
|
||||
{ "Gimp", NULL, 0, 1, -1 },
|
||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
||||
*/
|
||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
@@ -24,16 +25,14 @@ static const Layout layouts[] = {
|
||||
{ "[M]", monocle },
|
||||
};
|
||||
|
||||
/* monitors
|
||||
* The order in which monitors are defined determines their position.
|
||||
* Non-configured monitors are always added to the left. */
|
||||
/* monitors */
|
||||
static const MonitorRule monrules[] = {
|
||||
/* name mfact nmaster scale layout rotate/reflect x y */
|
||||
/* name mfact nmaster scale layout rotate/reflect */
|
||||
/* example of a HiDPI laptop monitor:
|
||||
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
*/
|
||||
/* defaults */
|
||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
};
|
||||
|
||||
/* keyboard */
|
||||
@@ -42,6 +41,7 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
/* example:
|
||||
.options = "ctrl:nocaps",
|
||||
*/
|
||||
.options = "",
|
||||
};
|
||||
|
||||
static const int repeat_rate = 25;
|
||||
@@ -49,8 +49,9 @@ static const int repeat_delay = 600;
|
||||
|
||||
/* Trackpad */
|
||||
static const int tap_to_click = 1;
|
||||
static const int natural_scrolling = 1;
|
||||
static const int natural_scrolling = 0;
|
||||
|
||||
/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
@@ -62,11 +63,13 @@ static const int natural_scrolling = 1;
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static const char *termcmd[] = { "alacritty", NULL };
|
||||
static const char *termcmd[] = { "alacritty", NULL };
|
||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
@@ -82,7 +85,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {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|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
@@ -94,11 +97,13 @@ static const Key keys[] = {
|
||||
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_caret, 5),
|
||||
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} },
|
||||
|
||||
/* 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} },
|
||||
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
||||
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
||||
|
@@ -1,8 +1,9 @@
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
|
||||
# Default compile flags (overridable by environment)
|
||||
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement
|
||||
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wno-unused-result -Wdeclaration-after-statement
|
||||
|
||||
# Uncomment to build XWayland support
|
||||
#CFLAGS += -DXWAYLAND
|
||||
|
144
dwl.1
Normal file
144
dwl.1
Normal file
@@ -0,0 +1,144 @@
|
||||
.Dd January 8, 2021
|
||||
.Dt DWL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm dwl
|
||||
.Nd dwm for Wayland
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl s Ar command
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a Wayland compositor based on wlroots.
|
||||
It is intended to fill the same space in the Wayland world that
|
||||
.Nm dwm
|
||||
does for X11.
|
||||
.Pp
|
||||
When given the
|
||||
.Fl s
|
||||
option,
|
||||
.Nm
|
||||
starts a shell process running
|
||||
.Ar command
|
||||
when starting.
|
||||
When stopping, it sends
|
||||
.Dv SIGTERM
|
||||
to the child process and waits for it to exit.
|
||||
.Pp
|
||||
Users are encouraged to customize
|
||||
.Nm
|
||||
by editing the sources, in particular
|
||||
.Pa config.h .
|
||||
The default key bindings are as follows:
|
||||
.Bl -tag -width 20n -offset indent -compact
|
||||
.It Mod-[1-9]
|
||||
Show only all windows with a tag.
|
||||
.It Mod-Ctrl-[1-9]
|
||||
Show all windows with a tag.
|
||||
.It Mod-Shift-[1-9]
|
||||
Move window to a single tag.
|
||||
.It Mod-Ctrl-Shift-[1-9]
|
||||
Toggle tag for window.
|
||||
.It Mod-p
|
||||
Spawn
|
||||
.Nm bemenu-run .
|
||||
.It Mod-Shift-Return
|
||||
Spawn
|
||||
.Nm alacritty .
|
||||
.It Mod-[jk]
|
||||
Move focus down/up the stack.
|
||||
.It Mod-[id]
|
||||
Increase/decrease number of windows in master area.
|
||||
.It Mod-[hl]
|
||||
Decrease/increase master area.
|
||||
.It Mod-Return
|
||||
Move window on top of stack or switch top of stack with second window.
|
||||
.It Mod-Tab
|
||||
Show only all windows with previous tag.
|
||||
.It Mod-Shift-c
|
||||
Close window.
|
||||
.It Mod-t
|
||||
Switch to tabbed layout.
|
||||
.It Mod-f
|
||||
Switch to floating layout.
|
||||
.It Mod-m
|
||||
Switch to monocle layout.
|
||||
.It Mod-Space
|
||||
Switch to previous layout.
|
||||
.It Mod-Shift-Space
|
||||
Toggle floating state of window.
|
||||
.It Mod-e
|
||||
Toggle fullscreen state of window.
|
||||
.It Mod-0
|
||||
Show all windows.
|
||||
.It Mod-Shift-0
|
||||
Set all tags for window.
|
||||
.It Mod-,
|
||||
Move focus to previous monitor.
|
||||
.It Mod-.
|
||||
Move focus to next monitor.
|
||||
.It Mod-Shift-,
|
||||
Move window to previous monitor.
|
||||
.It Mod-Shift-.
|
||||
Move window to next monitor.
|
||||
.It Mod-Shift-q
|
||||
Quit
|
||||
.Nm .
|
||||
.El
|
||||
These might differ depending on your keyboard layout.
|
||||
.Sh ENVIRONMENT
|
||||
These environment variables are used by
|
||||
.Nm :
|
||||
.Bl -tag -width XDG_RUNTIME_DIR
|
||||
.It Ev XDG_RUNTIME_DIR
|
||||
A directory where temporary user files, such as the Wayland socket,
|
||||
are stored.
|
||||
.It Ev XDG_CONFIG_DIR
|
||||
A directory containung configuration of various programs and
|
||||
libraries, including libxkbcommon.
|
||||
.It Ev DISPLAY , WAYLAND_DISPLAY , WAYLAND_SOCKET
|
||||
Tell how to connect to an underlying X11 or Wayland server.
|
||||
.It Ev WLR_*
|
||||
Various variables specific to wlroots.
|
||||
.It Ev XKB_* , XLOCALEDIR , XCOMPOSEFILE
|
||||
Various variables specific to libxkbcommon.
|
||||
.It Ev XCURSOR_PATH
|
||||
List of directories to search for XCursor themes in.
|
||||
.It Ev HOME
|
||||
A directory where there are always dear files there for you.
|
||||
Waiting for you to clean them up.
|
||||
.El
|
||||
.Pp
|
||||
These are set by
|
||||
.Nm :
|
||||
.Bl -tag -width WAYLAND_DISPLAY
|
||||
.It Ev WAYLAND_DISPLAY
|
||||
Tell how to connect to
|
||||
.Nm .
|
||||
.It Ev DISPLAY
|
||||
If using
|
||||
.Nm Xwayland ,
|
||||
tell how to connect to the
|
||||
.Nm Xwayland
|
||||
server.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Start
|
||||
.Nm
|
||||
with s6 in the background:
|
||||
.Dl dwl -s 's6-svscan <&-'
|
||||
.Sh SEE ALSO
|
||||
.Xr alacritty 1 ,
|
||||
.Xr bemenu 1 ,
|
||||
.Xr dwm 1 ,
|
||||
.Xr xkeyboard-config 7
|
||||
.Sh CAVEATS
|
||||
The child process's standard input is connected with a pipe to
|
||||
.Nm .
|
||||
If the child process neither reads from the pipe nor closes its
|
||||
standard input,
|
||||
.Nm
|
||||
will freeze after a while due to it blocking when writing to the full
|
||||
pipe buffer.
|
||||
.Sh BUGS
|
||||
All of them.
|
35
util.c
Normal file
35
util.c
Normal file
@@ -0,0 +1,35 @@
|
||||
/* See LICENSE.dwm file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (!(p = calloc(nmemb, size)))
|
||||
die("calloc:");
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
} else {
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
Reference in New Issue
Block a user