Compare commits

...

No commits in common. "a8f1f55b080429dd683a8573486fd8255e2f3067" and "b21a09cb064688702abcbb735860fe53daac2ae2" have entirely different histories.

25 changed files with 1733 additions and 4406 deletions

View File

@ -0,0 +1,62 @@
name: Bug Report
about: Something in dwl isn't working correctly
title:
labels:
- 'Kind/Bug'
body:
- type: markdown
attributes:
value: |
- Only report bugs that can be reproduced on the main (or wlroots-next) branch without patches.
- Proprietary graphics drivers, including nvidia, are not supported. Please use the open source equivalents, such as nouveau, if you would like to use dwl.
- Report patch issues to their respective authors.
- type: input
id: dwl_version
attributes:
label: 'dwl version:'
placeholder: '`dwl -v`'
validations:
required: true
- type: input
id: wlroots_version
attributes:
label: 'wlroots version:'
validations:
required: true
- type: input
id: distro
attributes:
label: What distro (and version) are you using?
validations:
required: false
- type: textarea
attributes:
label: Description
value: |
The steps you took to reproduce the problem.
validations:
required: false
- type: textarea
id: debug_log
attributes:
label: Debug Log
value: |
Run `dwl -d 2> ~/dwl.log` from a TTY and attach the **full** (do not truncate it) file here, or upload it to a pastebin.
Please try to keep the reproduction as brief as possible and exit dwl.
validations:
required: false
- type: textarea
id: backtrace
attributes:
label: Stack Trace
value: |
- Only required if dwl crashes.
- If the lines mentioning dwl or wlroots have `??`. Please compile both dwl and wlroots from source (enabling debug symbols) and try to reproduce.
validations:
required: false

View File

@ -0,0 +1,9 @@
name: Enhancement idea
about: Suggest a feature or improvement
title:
labels:
- 'Kind/Feature'
body:
- type: textarea
attributes:
label: Description

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
dwl
*.o
*-protocol.c
*-protocol.h
.ccls-cache
config.h

110
CHANGELOG.md Normal file
View File

@ -0,0 +1,110 @@
# Changelog
* [Unreleased](#unreleased)
* [0.5](#0.5)
## Unreleased
### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
### Contributors
## 0.5
### Added
* Allow configure x and y position of outputs ([#301][301])
* Implement repeatable keybindings ([#368][368])
* Print app id in printstatus() output ([#381][381])
* Display client count in monocle symbol ([#387][387])
* Export XCURSOR_SIZE to fix apps using an older version of Qt ([#425][425])
* Support for wp-fractional-scale-v1 (through wlr_scene: [wlroots!3511][wlroots!3511])
* dwl now sends `wl_surface.preferred_buffer_scale` (through wlr_scene: [wlroots!4269][wlroots!4269])
* Add support for xdg-shell v6 ([#465][465])
* Add support for wp-cursor-shape-v1 ([#444][444])
* Add desktop file ([#484][484])
* Add macro to easily configure colors ([#466][466])
* Color of urgent clients are now red ([#494][494])
* New flag `-d` and option `log_level` to change the wlroots debug level
* Add CHANGELOG.md ([#501][501])
[301]: https://github.com/djpohly/dwl/pull/301
[368]: https://github.com/djpohly/dwl/pull/368
[381]: https://github.com/djpohly/dwl/pull/381
[387]: https://github.com/djpohly/dwl/issues/387
[425]: https://github.com/djpohly/dwl/pull/425
[wlroots!4269]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4269
[wlroots!3511]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3511
[465]: https://github.com/djpohly/dwl/pull/465
[444]: https://github.com/djpohly/dwl/pull/444
[484]: https://github.com/djpohly/dwl/pull/484
[466]: https://github.com/djpohly/dwl/issues/466
[494]: https://github.com/djpohly/dwl/pull/494
[501]: https://github.com/djpohly/dwl/pull/501
### Changed
* Replace `tags` with `TAGCOUNT` in config.def.h ([#403][403])
* Pop ups are now destroyed when focusing another client ([#408][408])
* dwl does not longer respect size hints, instead clip windows if they are
larger than they should be ([#455][455])
* The version of wlr-layer-shell-unstable-v1 was lowered to 3 (from 4)
* Use the same border color as dwm ([#494][494])
[403]: https://github.com/djpohly/dwl/pull/403
[408]: https://github.com/djpohly/dwl/pull/409
[455]: https://github.com/djpohly/dwl/pull/455
[494]: https://github.com/djpohly/dwl/pull/494
### Removed
* Remove unused `rootcolor` option ([#401][401])
* Remove support for wlr-input-inhibitor-unstable-v1 ([#430][430])
* Remove support for KDE idle protocol ([#431][431])
[401]: https://github.com/djpohly/dwl/pull/401
[430]: https://github.com/djpohly/dwl/pull/430
[431]: https://github.com/djpohly/dwl/pull/431
### Fixed
* Fix crash when creating a layer surface with all outputs disabled
([#421][421])
* Fix other clients being shown as focused if the focused client have pop ups
open ([#408][408])
* Resize fullscreen clients when updating monitor mode
* dwl no longer crash at exit like sometimes did
* Fullscreen background appearing above clients ([#487][487])
* Fix a segfault when user provides invalid xkb_rules ([#518][518])
[421]: https://github.com/djpohly/dwl/pull/421
[408]: https://github.com/djpohly/dwl/issues/408
[487]: https://github.com/djpohly/dwl/issues/487
[518]: https://github.com/djpohly/dwl/pull/518
### Contributors
* A Frederick Christensen
* Angelo Antony
* Ben Collerson
* Devin J. Pohly
* Forrest Bushstone
* gan-of-culture
* godalming123
* Job79
* link2xt
* Micah Gorrell
* Nikita Ivanov
* Palanix
* pino-desktop
* Weiseguy
* Yves Zoundi

View File

@ -5,8 +5,8 @@ include config.mk
# flags for compiling
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND)
DWLDEVCFLAGS = -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types -Wfloat-conversion
# CFLAGS / LDFLAGS
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
@ -14,11 +14,10 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
all: dwl
dwl: dwl.o util.o dwl-ipc-unstable-v1-protocol.o
$(CC) dwl.o util.o dwl-ipc-unstable-v1-protocol.o -g $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
dwl.o: dwl.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h dwl-ipc-unstable-v1-protocol.o
dwl: dwl.o util.o
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
util.o: util.c util.h
dwl-ipc-unstable-v1-protocol.o: dwl-ipc-unstable-v1-protocol.h
# 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
@ -32,12 +31,9 @@ xdg-shell-protocol.h:
wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-layer-shell-unstable-v1.xml $@
dwl-ipc-unstable-v1-protocol.h:
cursor-shape-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/dwl-ipc-unstable-v1.xml $@
dwl-ipc-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/dwl-ipc-unstable-v1.xml $@
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
config.h:
cp config.def.h $@
@ -46,8 +42,8 @@ clean:
dist: clean
mkdir -p dwl-$(VERSION)
cp -R LICENSE* Makefile README.md client.h config.def.h\
config.mk protocols dwl.1 dwl.c util.c util.h\
cp -R LICENSE* Makefile CHANGELOG.md README.md client.h config.def.h\
config.mk protocols dwl.1 dwl.c util.c util.h dwl.desktop\
dwl-$(VERSION)
tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
rm -rf dwl-$(VERSION)
@ -59,8 +55,11 @@ install: dwl
mkdir -p $(DESTDIR)$(MANDIR)/man1
cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1
chmod 644 $(DESTDIR)$(MANDIR)/man1/dwl.1
mkdir -p $(DESTDIR)$(DATADIR)/wayland-sessions
cp -f dwl.desktop $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
chmod 644 $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1 $(DESTDIR)$(DATADIR)/wayland-sessions/dwl.desktop
.SUFFIXES: .c .o
.c.o:

View File

@ -1,15 +1,15 @@
# dwl - dwm for Wayland
Join us on our [Discord server] or at [#dwl] on irc.libera.chat.
Join us on our IRC channel: [#dwl on Libera Chat]
Or on our [Discord server].
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,
primarily in terms of philosophy, and secondarily in terms of functionality.
primarily in terms of functionality, and secondarily in terms of philosophy.
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`
- Limited to 2200 SLOC to promote hackability
- Tied to as few external dependencies as possible
dwl is not meant to provide every feature under the sun. Instead, like dwm, it
@ -26,19 +26,25 @@ given the base on which it is built. Implemented default features are:
monitoring
- Provide information to external status bars via stdout/stdin
- Urgency hints via xdg-activate protocol
- Support screen lockers via input-inhibitor protocol
- Support screen lockers via ext-session-lock-v1 protocol
- Various Wayland protocols
- 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
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
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
indiscriminately. We will try to keep the code as small as possible.
Features under consideration (possibly as patches) are:
- Protocols made trivial by wlroots
- 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/235)
https://codeberg.org/dwl/dwl/pulls/235)
Feature *non-goals* for the main codebase include:
@ -49,14 +55,28 @@ Feature *non-goals* for the main codebase include:
## Building dwl
dwl has only two dependencies: `wlroots` and `wayland-protocols`.
dwl has the following dependencies:
```
libinput
wayland
wlroots (compiled with the libinput backend)
xkbcommon
wayland-protocols (compile-time only)
pkg-config (compile-time only)
```
If you enable X11 support:
```
libxcb
libxcb-wm
wlroots (compiled with X11 support)
Xwayland (runtime only)
```
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].
To enable XWayland, you should also install xorg-xwayland and uncomment its flag
in `config.mk`.
To enable XWayland, you should uncomment its flags in `config.mk`.
## Configuration
@ -66,7 +86,7 @@ Wayland without restarting the entire display server, so any changes will take
effect the next time dwl is executed.
As in the dwm community, we encourage users to share patches they have created.
Check out the [patches page on our wiki]!
Check out the dwl [patches repository] and [patches wiki]!
## Running dwl
@ -82,6 +102,7 @@ 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.
Do note that the background color is black.
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
@ -89,7 +110,7 @@ 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], [anopa], [runit], or [`systemd --user`].
a user service manager like [s6], [anopa], [runit], [dinit], or [`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
@ -105,7 +126,7 @@ automatically, you will need to configure it prior to launching `dwl`, e.g.:
### Status information
Information about selected layouts, current window title, and
Information about selected layouts, current window title, app-id, 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.
@ -136,6 +157,7 @@ possible.
Many thanks to suckless.org and the dwm developers and community for the
inspiration, and to the various contributors to the project, including:
- **Devin J. Pohly for creating and nurturing the fledgling project**
- Alexander Courtis for the XWayland implementation
- Guido Cella for the layer-shell protocol implementation, patch maintenance,
and for helping to keep the project running
@ -143,15 +165,17 @@ inspiration, and to the various contributors to the project, including:
[Discord server]: https://discord.gg/jJxZnrGPWN
[#dwl]: https://web.libera.chat/?channels=#dwl
[#dwl on Libera Chat]: https://web.libera.chat/?channels=#dwl
[Wayland]: https://wayland.freedesktop.org/
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots/
[wlroots-next branch]: https://github.com/djpohly/dwl/tree/wlroots-next
[patches page on our wiki]: https://github.com/djpohly/dwl/wiki/Patches
[wlroots-next branch]: https://codeberg.org/dwl/dwl/src/branch/wlroots-next
[patches repository]: https://codeberg.org/dwl/dwl-patches
[patches wiki]: https://codeberg.org/dwl/dwl-patches/wiki
[s6]: https://skarnet.org/software/s6/
[anopa]: https://jjacky.com/anopa/
[runit]: http://smarden.org/runit/faq.html#userservices
[dinit]: https://davmac.org/projects/dinit/
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
[wiki]: https://github.com/djpohly/dwl/wiki#compatible-status-bars
[wiki]: https://codeberg.org/dwl/dwl/wiki/Home#compatible-status-bars
[list of useful resources on our wiki]:
https://github.com/djpohly/dwl/wiki#migrating-from-x
https://codeberg.org/dwl/dwl/wiki/Home#migrating-from-x

218
client.h
View File

@ -10,35 +10,9 @@ static inline int
client_is_x11(Client *c)
{
#ifdef XWAYLAND
return c->type == X11Managed || c->type == X11Unmanaged;
#else
return c->type == X11;
#endif
return 0;
#endif
}
static inline void
client_get_size_hints(Client *c, struct wlr_box *max, struct wlr_box *min)
{
struct wlr_xdg_toplevel *toplevel;
struct wlr_xdg_toplevel_state *state;
#ifdef XWAYLAND
if (client_is_x11(c)) {
xcb_size_hints_t *size_hints = c->surface.xwayland->size_hints;
if (size_hints) {
max->width = size_hints->max_width;
max->height = size_hints->max_height;
min->width = size_hints->min_width;
min->height = size_hints->min_height;
}
return;
}
#endif
toplevel = c->surface.xdg->toplevel;
state = &toplevel->current;
max->width = state->max_width;
max->height = state->max_height;
min->width = state->min_width;
min->height = state->min_height;
}
static inline struct wlr_surface *
@ -54,7 +28,7 @@ client_surface(Client *c)
static inline int
toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
{
struct wlr_xdg_surface *xdg_surface;
struct wlr_xdg_surface *xdg_surface, *tmp_xdg_surface;
struct wlr_surface *root_surface;
struct wlr_layer_surface_v1 *layer_surface;
Client *c = NULL;
@ -65,44 +39,44 @@ toplevel_from_wlr_surface(struct wlr_surface *s, Client **pc, LayerSurface **pl)
#endif
if (!s)
return type;
return -1;
root_surface = wlr_surface_get_root_surface(s);
#ifdef XWAYLAND
if (wlr_surface_is_xwayland_surface(root_surface)
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(root_surface))) {
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(root_surface))) {
c = xsurface->data;
type = c->type;
goto end;
}
#endif
if (wlr_surface_is_layer_surface(root_surface)
&& (layer_surface = wlr_layer_surface_v1_from_wlr_surface(root_surface))) {
if ((layer_surface = wlr_layer_surface_v1_try_from_wlr_surface(root_surface))) {
l = layer_surface->data;
type = LayerShell;
goto end;
}
if (wlr_surface_is_xdg_surface(root_surface)
&& (xdg_surface = wlr_xdg_surface_from_wlr_surface(root_surface))) {
while (1) {
switch (xdg_surface->role) {
case WLR_XDG_SURFACE_ROLE_POPUP:
if (!xdg_surface->popup->parent)
return -1;
else if (!wlr_surface_is_xdg_surface(xdg_surface->popup->parent))
return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc, pl);
xdg_surface = wlr_xdg_surface_from_wlr_surface(xdg_surface->popup->parent);
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
c = xdg_surface->data;
type = c->type;
goto end;
case WLR_XDG_SURFACE_ROLE_NONE:
xdg_surface = wlr_xdg_surface_try_from_wlr_surface(root_surface);
while (xdg_surface) {
tmp_xdg_surface = NULL;
switch (xdg_surface->role) {
case WLR_XDG_SURFACE_ROLE_POPUP:
if (!xdg_surface->popup || !xdg_surface->popup->parent)
return -1;
}
tmp_xdg_surface = wlr_xdg_surface_try_from_wlr_surface(xdg_surface->popup->parent);
if (!tmp_xdg_surface)
return toplevel_from_wlr_surface(xdg_surface->popup->parent, pc, pl);
xdg_surface = tmp_xdg_surface;
break;
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
c = xdg_surface->data;
type = c->type;
goto end;
case WLR_XDG_SURFACE_ROLE_NONE:
return -1;
}
}
@ -118,19 +92,16 @@ end:
static inline void
client_activate_surface(struct wlr_surface *s, int activated)
{
struct wlr_xdg_surface *surface;
struct wlr_xdg_toplevel *toplevel;
#ifdef XWAYLAND
struct wlr_xwayland_surface *xsurface;
if (wlr_surface_is_xwayland_surface(s)
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
if ((xsurface = wlr_xwayland_surface_try_from_wlr_surface(s))) {
wlr_xwayland_surface_activate(xsurface, activated);
return;
}
#endif
if (wlr_surface_is_xdg_surface(s)
&& (surface = wlr_xdg_surface_from_wlr_surface(s))
&& surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
if ((toplevel = wlr_xdg_toplevel_try_from_wlr_surface(s)))
wlr_xdg_toplevel_set_activated(toplevel, activated);
}
static inline uint32_t
@ -140,23 +111,16 @@ client_set_bounds(Client *c, int32_t width, int32_t height)
if (client_is_x11(c))
return 0;
#endif
if (c->surface.xdg->client->shell->version >=
XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION && width >= 0 && height >= 0)
if (wl_resource_get_version(c->surface.xdg->toplevel->resource) >=
XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION && width >= 0 && height >= 0
&& (c->bounds.width != width || c->bounds.height != height)) {
c->bounds.width = width;
c->bounds.height = height;
return wlr_xdg_toplevel_set_bounds(c->surface.xdg->toplevel, width, height);
}
return 0;
}
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))
return;
#endif
wlr_xdg_surface_for_each_popup_surface(c->surface.xdg, fn, data);
}
static inline const char *
client_get_appid(Client *c)
{
@ -167,6 +131,27 @@ client_get_appid(Client *c)
return c->surface.xdg->toplevel->app_id;
}
static inline void
client_get_clip(Client *c, struct wlr_box *clip)
{
struct wlr_box xdg_geom = {0};
*clip = (struct wlr_box){
.x = 0,
.y = 0,
.width = c->geom.width - c->bw,
.height = c->geom.height - c->bw,
};
#ifdef XWAYLAND
if (client_is_x11(c))
return;
#endif
wlr_xdg_surface_get_geometry(c->surface.xdg, &xdg_geom);
clip->x = xdg_geom.x;
clip->y = xdg_geom.y;
}
static inline void
client_get_geometry(Client *c, struct wlr_box *geom)
{
@ -187,15 +172,29 @@ client_get_parent(Client *c)
{
Client *p = NULL;
#ifdef XWAYLAND
if (client_is_x11(c) && c->surface.xwayland->parent)
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL);
if (client_is_x11(c)) {
if (c->surface.xwayland->parent)
toplevel_from_wlr_surface(c->surface.xwayland->parent->surface, &p, NULL);
return p;
}
#endif
if (c->surface.xdg->toplevel->parent)
toplevel_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface, &p, NULL);
return p;
}
static inline int
client_has_children(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return !wl_list_empty(&c->surface.xwayland->children);
#endif
/* surface.xdg->link is never empty because it always contains at least the
* surface itself. */
return wl_list_length(&c->surface.xdg->link) > 1;
}
static inline const char *
client_get_title(Client *c)
{
@ -209,35 +208,35 @@ client_get_title(Client *c)
static inline int
client_is_float_type(Client *c)
{
struct wlr_box min = {0}, max = {0};
client_get_size_hints(c, &max, &min);
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;
xcb_size_hints_t *size_hints = surface->size_hints;
size_t i;
if (surface->modal)
return 1;
for (size_t i = 0; i < surface->window_type_len; i++)
for (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;
return 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);
}
#endif
return ((min.width > 0 || min.height > 0 || max.width > 0 || max.height > 0)
&& (min.width == max.width || min.height == max.height));
}
static inline int
client_is_mapped(Client *c)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return c->surface.xwayland->mapped;
#endif
return c->surface.xdg->mapped;
toplevel = c->surface.xdg->toplevel;
state = toplevel->current;
return toplevel->parent || (state.min_width != 0 && state.min_height != 0
&& (state.min_width == state.max_width
|| state.min_height == state.max_height));
}
static inline int
@ -247,7 +246,8 @@ client_is_rendered_on_mon(Client *c, Monitor *m)
* but rather actual displaying of the pixels.
* Usually VISIBLEON suffices and is also faster. */
struct wlr_surface_output *s;
if (!c->scene->node.enabled)
int unused_lx, unused_ly;
if (!wlr_scene_node_coords(&c->scene->node, &unused_lx, &unused_ly))
return 0;
wl_list_for_each(s, &client_surface(c)->current_outputs, link)
if (s->output == m->wlr_output)
@ -285,7 +285,8 @@ static inline int
client_is_unmanaged(Client *c)
{
#ifdef XWAYLAND
return c->type == X11Unmanaged;
if (client_is_x11(c))
return c->surface.xwayland->override_redirect;
#endif
return 0;
}
@ -323,6 +324,14 @@ client_send_close(Client *c)
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
}
static inline void
client_set_border_color(Client *c, const float color[static 4])
{
int i;
for (i = 0; i < 4; i++)
wlr_scene_rect_set_color(c->border[i], color);
}
static inline void
client_set_fullscreen(Client *c, int fullscreen)
{
@ -345,10 +354,10 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
return 0;
}
#endif
if (width == c->surface.xdg->toplevel->current.width
&& height ==c->surface.xdg->toplevel->current.height)
if ((int32_t)width == c->surface.xdg->toplevel->current.width
&& (int32_t)height == c->surface.xdg->toplevel->current.height)
return 0;
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, (int32_t)width, (int32_t)height);
}
static inline void
@ -358,18 +367,25 @@ client_set_tiled(Client *c, uint32_t edges)
if (client_is_x11(c))
return;
#endif
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
>= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
} else {
wlr_xdg_toplevel_set_maximized(c->surface.xdg->toplevel, edges != WLR_EDGE_NONE);
}
}
static inline struct wlr_surface *
client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
static inline void
client_set_suspended(Client *c, int suspended)
{
#ifdef XWAYLAND
if (client_is_x11(c))
return wlr_surface_surface_at(c->surface.xwayland->surface,
cx, cy, sx, sy);
if (client_is_x11(c)) {
wlr_xwayland_surface_set_withdrawn(c->surface.xwayland, suspended);
return;
}
#endif
return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy);
wlr_xdg_toplevel_set_suspended(c->surface.xdg->toplevel, suspended);
}
static inline int

View File

@ -1,29 +1,41 @@
/* Taken from https://github.com/djpohly/dwl/issues/466 */
#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
((hex >> 16) & 0xFF) / 255.0f, \
((hex >> 8) & 0xFF) / 255.0f, \
(hex & 0xFF) / 255.0f }
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
//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};
static const float rootcolor[] = {0.4, 0.0, 0.4, 1.0}; /* Purple: R=0.4, G=0.0, B=0.4, A=1.0 */
static const float bordercolor[] = {0.6, 0.0, 0.6, 1.0}; /* Purple: R=0.6, G=0.0, B=0.6, A=1.0 */
static const float focuscolor[] = {0.8, 0.0, 0.8, 1.0}; /* Purple: R=0.8, G=0.0, B=0.8, A=1.0 */
static const float rootcolor[] = COLOR(0x330044);
static const float bordercolor[] = COLOR(0x32CD32); // Lime green
static const float focuscolor[] = COLOR(0x330044); // Darker purple
static const float urgentcolor[] = COLOR(0x32CD32); // Changed from red to lime green
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
/* autostart */
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
/* logging */
static int log_level = WLR_ERROR;
/* Autostart */
static const char *const autostart[] = {
"/usr/bin/wbg", "/home/s4d/.config/lain.jpg", NULL,
"/usr/libexec/kdeconnectd", NULL,
"/usr/bin/dunst", NULL,
"/usr/local/bin/someblocks", "-s", "/tmp/1000-runtime-dir/somebar-0", NULL,
/* "/usr/bin/mpvpaper", "-o", "no-audio", "loop", "*", ".config/wallpaper.mp4", NULL,*/
NULL /* terminate */
"exec", "dbus-update-activation-environment", "--systemd", "DISPLAY", "I3SOCK", "SWAYSOCK", "WAYLAND_DISPLAY", "XDG_CURRENT_DESKTOP=sway", NULL,
"/usr/bin/wbg", "/home/s4d/.config/lain.jpg", NULL,
"/usr/libexec/kdeconnectd", NULL,
"/usr/bin/pipewire", NULL,
"/usr/bin/dunst", NULL,
"/usr/local/bin/someblocks", NULL,
"/usr/bin/swayidle", "-w", "idle", "timeout", "600", "\"/usr/local/bin/swaylock -f\"", NULL,
"/usr/bin/spotifyd", "--no-daemon", NULL,
"/usr/libexec/xdg-desktop-portal", "-r", NULL,
NULL /* terminate */
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* app_id title tags mask isfloating isterm noswallow monitor */
/* examples:
@ -41,14 +53,16 @@ static const Layout layouts[] = {
};
/* monitors */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
/* Name mfact nmaster scale layout rotate/reflect */
{ "DP-4", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
{ "eDP-1", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
{ "DP-3", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
/* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor:
{ "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 },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
@ -78,9 +92,9 @@ LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
/* You can choose between:
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
@ -117,29 +131,30 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
/* commands */
static const char *termcmd[] = { "kitty", NULL };
static const char *menucmd[] = { "dmenu-wl_run", "-fn", "hack_mono:13", "-sb", "#550077", NULL };
/*static const char *menucmd[] = { "dmenu-wl_path", "|", "wmenu", "-S" "#550077", "-f", "12", "|", "xargs", "dbus-launch", NULL };*/
/*static const char *menucmd[] = {
"sh", "-c",
"dmenu-wl_path | wmenu -S \"#550077\" -f \"hack nerd font mono 13\" | xargs dbus-launch",
NULL
};*/
/*static const char *menucmd[] = { "dmenu-wl_run", "-fn", "hack_mono:13", "-sb", "#550077", NULL };*/
static const char *menucmd[] = { "/bin/sh", "-c",
"dmenu-wl_path | wmenu -S \"#550077\" -N \"#000000\" -n \"#32CD32\" -s \"#000000\" -f \"Hack Mono Bold 13\" | xargs -I_-_ /bin/sh -c \"exec _-_\"",
NULL };
/* volume keys*/
static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "+3%", NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-3%", NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL };
/* volume control */
static const char *volup[] = {"/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "+5%", NULL};
static const char *voldown[] = {"/usr/bin/pactl", "set-sink-volume", "@DEFAULT_SINK@", "-5%", NULL};
static const char *volmute[] = {"/usr/bin/pactl", "set-sink-mute", "@DEFAULT_SINK@", "toggle", NULL};
/* volume input */
static const char *mutemic[] = { "/usr/bin/pactl", "set-source-mute", "@DEFAULT_SOURCE@", "toggle", NULL };
/* backlight */
/* brightness control */
static const char *brightnessup[] = { "/usr/bin/brightnessctl", "s", "3%+", NULL };
static const char *brightnessdown[] = { "/usr/bin/brightnessctl", "s", "3%-", 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_b, togglebar, {0}},*/
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
@ -162,14 +177,14 @@ static const Key keys[] = {
{ 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} },
{0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = downvol} },
{0, XKB_KEY_XF86AudioMute, spawn, {.v = mutevol} },
{0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = upvol} },
{0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightnessup} },
{0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = brightnessdown} },
{0, XKB_KEY_XF86AudioMicMute, spawn, {.v = mutemic } },
{ 0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = volup} },
{ 0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = voldown} },
{ 0, XKB_KEY_XF86AudioMute, spawn, {.v = volmute} },
{ 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightnessup} },
{ 0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = brightnessdown} },
{ 0, XKB_KEY_XF86AudioMicMute, spawn, {.v = mutemic} },
{ 0, XKB_KEY_Print, spawn, SHCMD("grim -g \"$(slurp)\" ~/media/screenshots/$(date +'%h%d-%H%M-ss.png')") },
{ MODKEY, XKB_KEY_q, 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),
@ -183,6 +198,9 @@ static const Key keys[] = {
/* 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} },
/* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is
* do not remove them.
*/
#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),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),

205
config.h
View File

@ -1,205 +0,0 @@
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
//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};
static const float rootcolor[] = {0.4, 0.0, 0.4, 1.0}; /* Purple: R=0.4, G=0.0, B=0.4, A=1.0 */
static const float bordercolor[] = {0.6, 0.0, 0.6, 1.0}; /* Purple: R=0.6, G=0.0, B=0.6, A=1.0 */
static const float focuscolor[] = {0.8, 0.0, 0.8, 1.0}; /* Purple: R=0.8, G=0.0, B=0.8, A=1.0 */
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
/* autostart */
static const char *const autostart[] = {
"/usr/bin/wbg", "/home/s4d/.config/lain.jpg", NULL,
"/usr/libexec/kdeconnectd", NULL,
"/usr/bin/dunst", NULL,
"/usr/local/bin/someblocks", NULL,/*, "-s", "/tmp/1000-runtime-dir/somebar-0", NULL,*/
"/usr/bin/swayidle" "-d", "-w", "timeout", "150", "'swaylock", "-f'", NULL,
/* "/usr/bin/mpvpaper", "-o", "no-audio", "loop", "*", ".config/wallpaper.mp4", NULL,*/
NULL /* terminate */
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* app_id title tags mask isfloating isterm noswallow monitor */
/* examples:
{ "Gimp", NULL, 0, 1, 0, 1, -1 },
*/
{ "firefox", NULL, 1 << 8, 0, 0, 1, -1 },
};
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
static const MonitorRule monrules[] = {
/* Name mfact nmaster scale layout rotate/reflect */
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1},
/* { "eDP-1", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },*/
/* { "DP-4", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },*/
/* { "DP-3", 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },*/
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = NULL,
};
static const int repeat_rate = 25;
static const int repeat_delay = 600;
/* Trackpad */
static const int tap_to_click = 1;
static const int tap_and_drag = 1;
static const int drag_lock = 1;
static const int natural_scrolling = 0;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 0;
/* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG
LIBINPUT_CONFIG_SCROLL_EDGE
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
*/
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
/* You can choose between:
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between:
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
*/
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
/* You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed = 0.0;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
*/
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_LOGO
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *termcmd[] = { "kitty", NULL };
static const char *menucmd[] = { "dmenu-wl_run", "-fn", "hack_mono:13", "-sb", "#550077", NULL };
/*static const char *menucmd[] = {
"sh", "-c",
"dmenu-wl_path | wmenu -S \"#550077\" -f \"hack nerd font mono 13\" | xargs dbus-launch",
NULL
};*/
/* volume output */
static const char *upvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "+3%", NULL };
static const char *downvol[] = { "/usr/bin/pactl", "set-sink-volume", "0", "-3%", NULL };
static const char *mutevol[] = { "/usr/bin/pactl", "set-sink-mute", "0", "toggle", NULL };
/* volume input */
static const char *mutemic[] = { "/usr/bin/pactl", "set-source-mute", "@DEFAULT_SOURCE@", "toggle", NULL };
/* backlight */
static const char *brightnessup[] = { "/usr/bin/brightnessctl", "s", "3%+", NULL };
static const char *brightnessdown[] = { "/usr/bin/brightnessctl", "s", "3%-", NULL };
/* screenshot */
/*static const char *ssselect[] = { "grim -g \"$(slurp)\" ~/media/screenshots/$(date +'%h%d-%H%M-ss.png'", NULL };*/
/*static const char *ssfocus[] = */
/*static const char *ssfull[] = */
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} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ MODKEY, XKB_KEY_Return, zoom, {0} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
{ 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_s, togglesticky, {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} },
{ 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} },
{0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = downvol} },
{0, XKB_KEY_XF86AudioMute, spawn, {.v = mutevol} },
{0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = upvol} },
{0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = brightnessup} },
{0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = brightnessdown} },
{0, XKB_KEY_XF86AudioMicMute, spawn, {.v = mutemic } },
/* {0, XKB_KEY_Print, spawn, {.v = ssselect } },*/
{ 0, XKB_KEY_Print, spawn, SHCMD("grim -g \"$(slurp)\" ~/media/screenshots/$(date +'%h%d-%H%M-ss.png')") },
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} },
/* 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),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};

View File

@ -1,4 +1,4 @@
_VERSION = 0.4
_VERSION = 0.5
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
PKG_CONFIG = pkg-config
@ -6,9 +6,9 @@ PKG_CONFIG = pkg-config
# paths
PREFIX = /usr/local
MANDIR = $(PREFIX)/share/man
DATADIR = $(PREFIX)/share
XWAYLAND =
XLIBS =
# Uncomment to build XWayland support
#XWAYLAND = -DXWAYLAND
#XLIBS = xcb xcb-icccm
XWAYLAND = -DXWAYLAND
XLIBS = xcb xcb-icccm

View File

@ -1,70 +0,0 @@
/* Generated by wayland-scanner 1.22.0 */
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
#ifndef __has_attribute
# define __has_attribute(x) 0 /* Compatibility with non-clang compilers. */
#endif
#if (__has_attribute(visibility) || defined(__GNUC__) && __GNUC__ >= 4)
#define WL_PRIVATE __attribute__ ((visibility("hidden")))
#else
#define WL_PRIVATE
#endif
extern const struct wl_interface wl_output_interface;
extern const struct wl_interface zdwl_ipc_output_v1_interface;
static const struct wl_interface *dwl_ipc_unstable_v1_types[] = {
NULL,
NULL,
NULL,
NULL,
&zdwl_ipc_output_v1_interface,
&wl_output_interface,
};
static const struct wl_message zdwl_ipc_manager_v1_requests[] = {
{ "release", "", dwl_ipc_unstable_v1_types + 0 },
{ "get_output", "no", dwl_ipc_unstable_v1_types + 4 },
};
static const struct wl_message zdwl_ipc_manager_v1_events[] = {
{ "tag", "s", dwl_ipc_unstable_v1_types + 0 },
{ "layout", "s", dwl_ipc_unstable_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface zdwl_ipc_manager_v1_interface = {
"zdwl_ipc_manager_v1", 4,
2, zdwl_ipc_manager_v1_requests,
2, zdwl_ipc_manager_v1_events,
};
static const struct wl_message zdwl_ipc_output_v1_requests[] = {
{ "release", "", dwl_ipc_unstable_v1_types + 0 },
{ "set_layout", "u", dwl_ipc_unstable_v1_types + 0 },
{ "set_tags", "uu", dwl_ipc_unstable_v1_types + 0 },
{ "set_client_tags", "uu", dwl_ipc_unstable_v1_types + 0 },
};
static const struct wl_message zdwl_ipc_output_v1_events[] = {
{ "toggle_visibility", "", dwl_ipc_unstable_v1_types + 0 },
{ "active", "u", dwl_ipc_unstable_v1_types + 0 },
{ "tag", "uuuu", dwl_ipc_unstable_v1_types + 0 },
{ "layout", "u", dwl_ipc_unstable_v1_types + 0 },
{ "title", "s", dwl_ipc_unstable_v1_types + 0 },
{ "frame", "", dwl_ipc_unstable_v1_types + 0 },
{ "appid", "2s", dwl_ipc_unstable_v1_types + 0 },
{ "layout_symbol", "3s", dwl_ipc_unstable_v1_types + 0 },
{ "fullscreen", "4u", dwl_ipc_unstable_v1_types + 0 },
{ "floating", "4u", dwl_ipc_unstable_v1_types + 0 },
};
WL_PRIVATE const struct wl_interface zdwl_ipc_output_v1_interface = {
"zdwl_ipc_output_v1", 4,
4, zdwl_ipc_output_v1_requests,
10, zdwl_ipc_output_v1_events,
};

View File

@ -1,421 +0,0 @@
/* Generated by wayland-scanner 1.22.0 */
#ifndef DWL_IPC_UNSTABLE_V1_SERVER_PROTOCOL_H
#define DWL_IPC_UNSTABLE_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_dwl_ipc_unstable_v1 The dwl_ipc_unstable_v1 protocol
* inter-proccess-communication about dwl's state
*
* @section page_desc_dwl_ipc_unstable_v1 Description
*
* This protocol allows clients to get updates from dwl and vice versa.
*
* Warning! The protocol described in this file is experimental and
* backward incompatible changes may be made. Backward compatible
* changes may be added together with the corresponding interface
* version bump.
* Backward incompatible changes are done by bumping the version
* number in the protocol and interface names and resetting the
* interface version. Once the protocol is to be declared stable,
* the 'z' prefix and the version number in the protocol and
* interface names are removed and the interface version number is
* reset.
*
* @section page_ifaces_dwl_ipc_unstable_v1 Interfaces
* - @subpage page_iface_zdwl_ipc_manager_v1 - manage dwl state
* - @subpage page_iface_zdwl_ipc_output_v1 - control dwl output
*/
struct wl_output;
struct zdwl_ipc_manager_v1;
struct zdwl_ipc_output_v1;
#ifndef ZDWL_IPC_MANAGER_V1_INTERFACE
#define ZDWL_IPC_MANAGER_V1_INTERFACE
/**
* @page page_iface_zdwl_ipc_manager_v1 zdwl_ipc_manager_v1
* @section page_iface_zdwl_ipc_manager_v1_desc Description
*
* This interface is exposed as a global in wl_registry.
*
* Clients can use this interface to get a dwl_output.
* After binding the client will revieve dwl_manager.tag and dwl_manager.layout events.
* The dwl_manager.tag and dwl_manager.layout events expose tags and layouts to the client.
* @section page_iface_zdwl_ipc_manager_v1_api API
* See @ref iface_zdwl_ipc_manager_v1.
*/
/**
* @defgroup iface_zdwl_ipc_manager_v1 The zdwl_ipc_manager_v1 interface
*
* This interface is exposed as a global in wl_registry.
*
* Clients can use this interface to get a dwl_output.
* After binding the client will revieve dwl_manager.tag and dwl_manager.layout events.
* The dwl_manager.tag and dwl_manager.layout events expose tags and layouts to the client.
*/
extern const struct wl_interface zdwl_ipc_manager_v1_interface;
#endif
#ifndef ZDWL_IPC_OUTPUT_V1_INTERFACE
#define ZDWL_IPC_OUTPUT_V1_INTERFACE
/**
* @page page_iface_zdwl_ipc_output_v1 zdwl_ipc_output_v1
* @section page_iface_zdwl_ipc_output_v1_desc Description
*
* Observe and control a dwl output.
*
* Events are double-buffered:
* Clients should cache events and redraw when a dwl_output.done event is sent.
*
* Request are not double-buffered:
* The compositor will update immediately upon request.
* @section page_iface_zdwl_ipc_output_v1_api API
* See @ref iface_zdwl_ipc_output_v1.
*/
/**
* @defgroup iface_zdwl_ipc_output_v1 The zdwl_ipc_output_v1 interface
*
* Observe and control a dwl output.
*
* Events are double-buffered:
* Clients should cache events and redraw when a dwl_output.done event is sent.
*
* Request are not double-buffered:
* The compositor will update immediately upon request.
*/
extern const struct wl_interface zdwl_ipc_output_v1_interface;
#endif
/**
* @ingroup iface_zdwl_ipc_manager_v1
* @struct zdwl_ipc_manager_v1_interface
*/
struct zdwl_ipc_manager_v1_interface {
/**
* release dwl_manager
*
* Indicates that the client will not the dwl_manager object
* anymore. Objects created through this instance are not affected.
*/
void (*release)(struct wl_client *client,
struct wl_resource *resource);
/**
* get a dwl_output for a wl_output
*
* Get a dwl_output for the specified wl_output.
*/
void (*get_output)(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *output);
};
#define ZDWL_IPC_MANAGER_V1_TAG 0
#define ZDWL_IPC_MANAGER_V1_LAYOUT 1
/**
* @ingroup iface_zdwl_ipc_manager_v1
*/
#define ZDWL_IPC_MANAGER_V1_TAG_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_manager_v1
*/
#define ZDWL_IPC_MANAGER_V1_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_manager_v1
*/
#define ZDWL_IPC_MANAGER_V1_RELEASE_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_manager_v1
*/
#define ZDWL_IPC_MANAGER_V1_GET_OUTPUT_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_manager_v1
* Sends an tag event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zdwl_ipc_manager_v1_send_tag(struct wl_resource *resource_, const char *name)
{
wl_resource_post_event(resource_, ZDWL_IPC_MANAGER_V1_TAG, name);
}
/**
* @ingroup iface_zdwl_ipc_manager_v1
* Sends an layout event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zdwl_ipc_manager_v1_send_layout(struct wl_resource *resource_, const char *name)
{
wl_resource_post_event(resource_, ZDWL_IPC_MANAGER_V1_LAYOUT, name);
}
#ifndef ZDWL_IPC_OUTPUT_V1_TAG_STATE_ENUM
#define ZDWL_IPC_OUTPUT_V1_TAG_STATE_ENUM
enum zdwl_ipc_output_v1_tag_state {
/**
* no state
*/
ZDWL_IPC_OUTPUT_V1_TAG_STATE_NONE = 0,
/**
* tag is active
*/
ZDWL_IPC_OUTPUT_V1_TAG_STATE_ACTIVE = 1,
/**
* tag has at least one urgent client
*/
ZDWL_IPC_OUTPUT_V1_TAG_STATE_URGENT = 2,
};
#endif /* ZDWL_IPC_OUTPUT_V1_TAG_STATE_ENUM */
/**
* @ingroup iface_zdwl_ipc_output_v1
* @struct zdwl_ipc_output_v1_interface
*/
struct zdwl_ipc_output_v1_interface {
/**
* release dwl_output
*
* Indicates to that the client no longer needs this dwl_output.
*/
void (*release)(struct wl_client *client,
struct wl_resource *resource);
/**
* Set the layout of this output
*
*
* @param index index of a layout recieved by dwl_manager.layout
*/
void (*set_layout)(struct wl_client *client,
struct wl_resource *resource,
uint32_t index);
/**
* Set the active tags of this output
*
*
* @param tagmask bitmask of the tags that should be set.
* @param toggle_tagset toggle the selected tagset, zero for invalid, nonzero for valid.
*/
void (*set_tags)(struct wl_client *client,
struct wl_resource *resource,
uint32_t tagmask,
uint32_t toggle_tagset);
/**
* Set the tags of the focused client.
*
* The tags are updated as follows: new_tags = (current_tags AND
* and_tags) XOR xor_tags
*/
void (*set_client_tags)(struct wl_client *client,
struct wl_resource *resource,
uint32_t and_tags,
uint32_t xor_tags);
};
#define ZDWL_IPC_OUTPUT_V1_TOGGLE_VISIBILITY 0
#define ZDWL_IPC_OUTPUT_V1_ACTIVE 1
#define ZDWL_IPC_OUTPUT_V1_TAG 2
#define ZDWL_IPC_OUTPUT_V1_LAYOUT 3
#define ZDWL_IPC_OUTPUT_V1_TITLE 4
#define ZDWL_IPC_OUTPUT_V1_FRAME 5
#define ZDWL_IPC_OUTPUT_V1_APPID 6
#define ZDWL_IPC_OUTPUT_V1_LAYOUT_SYMBOL 7
#define ZDWL_IPC_OUTPUT_V1_FULLSCREEN 8
#define ZDWL_IPC_OUTPUT_V1_FLOATING 9
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_TOGGLE_VISIBILITY_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_ACTIVE_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_TAG_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_TITLE_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_FRAME_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_APPID_SINCE_VERSION 2
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_LAYOUT_SYMBOL_SINCE_VERSION 3
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_FULLSCREEN_SINCE_VERSION 4
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_FLOATING_SINCE_VERSION 4
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_RELEASE_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_SET_LAYOUT_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_SET_TAGS_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
*/
#define ZDWL_IPC_OUTPUT_V1_SET_CLIENT_TAGS_SINCE_VERSION 1
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an toggle_visibility event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zdwl_ipc_output_v1_send_toggle_visibility(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_TOGGLE_VISIBILITY);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an active event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zdwl_ipc_output_v1_send_active(struct wl_resource *resource_, uint32_t active)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_ACTIVE, active);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an tag event to the client owning the resource.
* @param resource_ The client's resource
* @param tag Index of the tag
* @param state The state of the tag.
* @param clients The number of clients in the tag.
* @param focused If there is a focused client. Nonzero being valid, zero being invalid.
*/
static inline void
zdwl_ipc_output_v1_send_tag(struct wl_resource *resource_, uint32_t tag, uint32_t state, uint32_t clients, uint32_t focused)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_TAG, tag, state, clients, focused);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an layout event to the client owning the resource.
* @param resource_ The client's resource
* @param layout Index of the layout.
*/
static inline void
zdwl_ipc_output_v1_send_layout(struct wl_resource *resource_, uint32_t layout)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_LAYOUT, layout);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an title event to the client owning the resource.
* @param resource_ The client's resource
* @param title The new title name.
*/
static inline void
zdwl_ipc_output_v1_send_title(struct wl_resource *resource_, const char *title)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_TITLE, title);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an frame event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zdwl_ipc_output_v1_send_frame(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_FRAME);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an appid event to the client owning the resource.
* @param resource_ The client's resource
* @param appid The new appid.
*/
static inline void
zdwl_ipc_output_v1_send_appid(struct wl_resource *resource_, const char *appid)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_APPID, appid);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an layout_symbol event to the client owning the resource.
* @param resource_ The client's resource
* @param layout The new layout
*/
static inline void
zdwl_ipc_output_v1_send_layout_symbol(struct wl_resource *resource_, const char *layout)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_LAYOUT_SYMBOL, layout);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an fullscreen event to the client owning the resource.
* @param resource_ The client's resource
* @param is_fullscreen If the selected client is fullscreen. Nonzero is valid, zero invalid
*/
static inline void
zdwl_ipc_output_v1_send_fullscreen(struct wl_resource *resource_, uint32_t is_fullscreen)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_FULLSCREEN, is_fullscreen);
}
/**
* @ingroup iface_zdwl_ipc_output_v1
* Sends an floating event to the client owning the resource.
* @param resource_ The client's resource
* @param is_floating If the selected client is floating. Nonzero is valid, zero invalid
*/
static inline void
zdwl_ipc_output_v1_send_floating(struct wl_resource *resource_, uint32_t is_floating)
{
wl_resource_post_event(resource_, ZDWL_IPC_OUTPUT_V1_FLOATING, is_floating);
}
#ifdef __cplusplus
}
#endif
#endif

Binary file not shown.

9
dwl.1
View File

@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl v
.Op Fl d
.Op Fl s Ar startup command
.Sh DESCRIPTION
.Nm
@ -22,6 +23,12 @@ option,
writes its name and version to standard error and exits unsuccessfully.
.Pp
When given the
.Fl d
option,
.Nm
enables full wlroots logging, including debug information.
.Pp
When given the
.Fl s
option,
.Nm
@ -101,7 +108,7 @@ These environment variables are used by
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
A directory containing 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.

1540
dwl.c

File diff suppressed because it is too large Load Diff

5
dwl.desktop Normal file
View File

@ -0,0 +1,5 @@
[Desktop Entry]
Name=dwl
Comment=dwm for Wayland
Exec=dwl
Type=Application

BIN
dwl.o

Binary file not shown.

View File

@ -1,111 +0,0 @@
From fd5f1d46a5a61e86d45228d9a3fe8629f6675c8f Mon Sep 17 00:00:00 2001
From: Palanix <palanixyt@gmail.com>
Date: Mon, 4 Apr 2022 16:08:29 +0200
Subject: [PATCH] Updated patch now allowing setting x and y
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me
---
config.def.h | 12 +++++++-----
dwl.c | 26 ++++++++++++--------------
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/config.def.h b/config.def.h
index 447ba0051..9fe6ac072 100644
--- a/config.def.h
+++ b/config.def.h
@@ -26,14 +26,16 @@ static const Layout layouts[] = {
{ "[M]", monocle },
};
-/* monitors */
+/* monitors
+ * The order in which monitors are defined determines their position.
+ * Non-configured monitors are always added to the left. */
static const MonitorRule monrules[] = {
- /* name mfact nmaster scale layout rotate/reflect x y */
- /* example of a HiDPI laptop monitor:
- { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate adaptive*/
+ /* example of a HiDPI laptop monitor at 120Hz:
+ { "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 120.000, 1},
*/
/* defaults */
- { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ { NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 0, 1},
};
/* keyboard */
diff --git a/dwl.c b/dwl.c
index b5e146d10..a58e3090d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -201,6 +201,10 @@ typedef struct {
const Layout *lt;
enum wl_output_transform rr;
int x, y;
+ int resx;
+ int resy;
+ float rate;
+ int adaptive;
} MonitorRule;
typedef struct {
@@ -910,8 +914,6 @@ createmon(struct wl_listener *listener, void *data)
Monitor *m = wlr_output->data = ecalloc(1, sizeof(*m));
m->wlr_output = wlr_output;
- wlr_output_init_render(wlr_output, alloc, drw);
-
/* Initialize monitor state using configured rules */
for (i = 0; i < LENGTH(m->layers); i++)
wl_list_init(&m->layers[i]);
@@ -924,17 +926,16 @@ createmon(struct wl_listener *listener, void *data)
wlr_xcursor_manager_load(cursor_mgr, r->scale);
m->lt[0] = m->lt[1] = r->lt;
wlr_output_set_transform(wlr_output, r->rr);
- m->m.x = r->x;
- m->m.y = r->y;
+
+ wlr_output_set_custom_mode(wlr_output, r->resx, r->resy,
+ r->rate > 0 ? (int)((r->rate * 1000) + 0.5) : 0);
+
+ wlr_output_enable_adaptive_sync(wlr_output, r->adaptive);
break;
}
}
- /* The mode is a tuple of (width, height, refresh rate), and each
- * monitor supports only a specific set of modes. We just pick the
- * monitor's preferred mode; a more sophisticated compositor would let
- * the user configure it. */
- wlr_output_set_mode(wlr_output, wlr_output_preferred_mode(wlr_output));
+ wlr_output_init_render(wlr_output, alloc, drw);
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
@@ -944,9 +945,6 @@ createmon(struct wl_listener *listener, void *data)
if (!wlr_output_commit(wlr_output))
return;
- /* Try to enable adaptive sync, note that not all monitors support it.
- * wlr_output_commit() will deactivate it in case it cannot be enabled */
- wlr_output_enable_adaptive_sync(wlr_output, 1);
wlr_output_commit(wlr_output);
wl_list_insert(&mons, &m->link);
@@ -971,10 +969,10 @@ createmon(struct wl_listener *listener, void *data)
* output (such as DPI, scale factor, manufacturer, etc).
*/
m->scene_output = wlr_scene_output_create(scene, wlr_output);
- if (m->m.x < 0 || m->m.y < 0)
+ if (r->x < 0 || r->y < 0)
wlr_output_layout_add_auto(output_layout, wlr_output);
else
- wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
+ wlr_output_layout_add(output_layout, wlr_output, r->x, r->y);
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
}

154
patches/autostart.patch Normal file
View File

@ -0,0 +1,154 @@
From 51d56a433f23e13ac711b283a03c7903068febf6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
<leohdz172@proton.me>
Date: Sat, 8 Jul 2023 17:11:36 -0600
Subject: [PATCH] port autostart patch from dwm
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
https://dwm.suckless.org/patches/cool_autostart/
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
---
config.def.h | 7 +++++++
dwl.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++-----
2 files changed, 61 insertions(+), 5 deletions(-)
diff --git a/config.def.h b/config.def.h
index a8ed61d..3585711 100644
--- a/config.def.h
+++ b/config.def.h
@@ -20,6 +20,13 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al
/* logging */
static int log_level = WLR_ERROR;
+/* Autostart */
+static const char *const autostart[] = {
+ "wbg", "/path/to/your/image", NULL,
+ NULL /* terminate */
+};
+
+
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
/* examples:
diff --git a/dwl.c b/dwl.c
index 10d5a5b..bbbef2b 100644
--- a/dwl.c
+++ b/dwl.c
@@ -236,6 +236,7 @@ static void arrange(Monitor *m);
static void arrangelayer(Monitor *m, struct wl_list *list,
struct wlr_box *usable_area, int exclusive);
static void arrangelayers(Monitor *m);
+static void autostartexec(void);
static void axisnotify(struct wl_listener *listener, void *data);
static void buttonpress(struct wl_listener *listener, void *data);
static void chvt(const Arg *arg);
@@ -403,6 +404,9 @@ static xcb_atom_t netatom[NetLast];
/* attempt to encapsulate suck into one file */
#include "client.h"
+static pid_t *autostart_pids;
+static size_t autostart_len;
+
/* function implementations */
void
applybounds(Client *c, struct wlr_box *bbox)
@@ -533,6 +537,27 @@ arrangelayers(Monitor *m)
}
}
+void
+autostartexec(void) {
+ const char *const *p;
+ size_t i = 0;
+
+ /* count entries */
+ for (p = autostart; *p; autostart_len++, p++)
+ while (*++p);
+
+ autostart_pids = calloc(autostart_len, sizeof(pid_t));
+ for (p = autostart; *p; i++, p++) {
+ if ((autostart_pids[i] = fork()) == 0) {
+ setsid();
+ execvp(*p, (char *const *)p);
+ die("dwl: execvp %s:", *p);
+ }
+ /* skip arguments */
+ while (*++p);
+ }
+}
+
void
axisnotify(struct wl_listener *listener, void *data)
{
@@ -630,11 +655,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
void
cleanup(void)
{
+ size_t i;
#ifdef XWAYLAND
wlr_xwayland_destroy(xwayland);
xwayland = NULL;
#endif
wl_display_destroy_clients(dpy);
+
+ /* kill child processes */
+ for (i = 0; i < autostart_len; i++) {
+ if (0 < autostart_pids[i]) {
+ kill(autostart_pids[i], SIGTERM);
+ waitpid(autostart_pids[i], NULL, 0);
+ }
+ }
+
if (child_pid > 0) {
kill(child_pid, SIGTERM);
waitpid(child_pid, NULL, 0);
@@ -1294,18 +1329,31 @@ void
handlesig(int signo)
{
if (signo == SIGCHLD) {
-#ifdef XWAYLAND
siginfo_t in;
/* wlroots expects to reap the XWayland process itself, so we
* use WNOWAIT to keep the child waitable until we know it's not
* XWayland.
*/
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
- && (!xwayland || in.si_pid != xwayland->server->pid))
- waitpid(in.si_pid, NULL, 0);
-#else
- while (waitpid(-1, NULL, WNOHANG) > 0);
+#ifdef XWAYLAND
+ && (!xwayland || in.si_pid != xwayland->server->pid)
#endif
+ ) {
+ pid_t *p, *lim;
+ waitpid(in.si_pid, NULL, 0);
+ if (in.si_pid == child_pid)
+ child_pid = -1;
+ if (!(p = autostart_pids))
+ continue;
+ lim = &p[autostart_len];
+
+ for (; p < lim; p++) {
+ if (*p == in.si_pid) {
+ *p = -1;
+ break;
+ }
+ }
+ }
} else if (signo == SIGINT || signo == SIGTERM) {
quit(NULL);
}
@@ -1965,6 +2013,7 @@ run(char *startup_cmd)
die("startup: backend_start");
/* Now that the socket exists and the backend is started, run the startup command */
+ autostartexec();
if (startup_cmd) {
int piperw[2];
if (pipe(piperw) < 0)
--
2.43.0

View File

@ -0,0 +1,69 @@
From 7ba760ab76353e9344a08902a5b12acb431d3843 Mon Sep 17 00:00:00 2001
From: Dmitry Zakharchenko <dmitz@disroot.org>
Date: Wed, 4 Jan 2023 00:25:55 +0200
Subject: [PATCH] sticky: sync with 0.4
---
config.def.h | 1 +
dwl.c | 15 +++++++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index a4f7c13d0..120c27aa1 100644
--- a/config.def.h
+++ b/config.def.h
@@ -126,6 +126,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_s, togglesticky, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
diff --git a/dwl.c b/dwl.c
index 19bb6ce34..ec8c4282d 100644
--- a/dwl.c
+++ b/dwl.c
@@ -64,7 +64,7 @@
#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define CLEANMASK(mask) (mask & ~WLR_MODIFIER_CAPS)
-#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
+#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags] || (C)->issticky))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A))
#define TAGMASK ((1 << LENGTH(tags)) - 1)
@@ -124,7 +124,7 @@ typedef struct {
#endif
unsigned int bw;
unsigned int tags;
- int isfloating, isurgent, isfullscreen;
+ int isfloating, isurgent, isfullscreen, issticky;
uint32_t resize; /* configure serial of a pending resize */
} Client;
@@ -295,6 +295,7 @@ static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglefloating(const Arg *arg);
+static void togglesticky(const Arg *arg);
static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
@@ -2337,6 +2338,16 @@ togglefloating(const Arg *arg)
setfloating(sel, !sel->isfloating);
}
+void
+togglesticky(const Arg *arg)
+{
+ Client *sel = focustop(selmon);
+ if (!sel)
+ return;
+ sel->issticky = !sel->issticky;
+ arrange(selmon);
+}
+
void
togglefullscreen(const Arg *arg)
{

View File

@ -0,0 +1,197 @@
From bc61a2cc74f65ab5bba51ba65edc1efd1269d510 Mon Sep 17 00:00:00 2001
From: Dmitry Zakharchenko <dmitz@disroot.org>
Date: Thu, 5 Jan 2023 14:57:48 +0200
Subject: [PATCH] swallow: sync with 0.4
---
config.def.h | 6 ++--
dwl.c | 100 +++++++++++++++++++++++++++++++++++++++++++++++++--
2 files changed, 100 insertions(+), 6 deletions(-)
diff --git a/config.def.h b/config.def.h
index a4f7c13d0..9dcedacd4 100644
--- a/config.def.h
+++ b/config.def.h
@@ -12,11 +12,11 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
- /* app_id title tags mask isfloating monitor */
+ /* app_id title tags mask isfloating isterm noswallow monitor */
/* examples:
- { "Gimp", NULL, 0, 1, -1 },
+ { "Gimp", NULL, 0, 1, 0, 1, -1 },
*/
- { "firefox", NULL, 1 << 8, 0, -1 },
+ { "firefox", NULL, 1 << 8, 0, 0, 1, -1 },
};
/* layout(s) */
diff --git a/dwl.c b/dwl.c
index 19bb6ce34..262fa62c7 100644
--- a/dwl.c
+++ b/dwl.c
@@ -95,7 +95,8 @@ typedef struct {
} Button;
typedef struct Monitor Monitor;
-typedef struct {
+typedef struct Client Client;
+struct Client {
/* Must keep these three elements in this order */
unsigned int type; /* XDGShell or X11* */
struct wlr_box geom; /* layout-relative, includes border */
@@ -124,9 +125,11 @@ typedef struct {
#endif
unsigned int bw;
unsigned int tags;
- int isfloating, isurgent, isfullscreen;
+ int isfloating, isurgent, isfullscreen, isterm, noswallow;
uint32_t resize; /* configure serial of a pending resize */
-} Client;
+ pid_t pid;
+ Client *swallowing, *swallowedby;
+};
typedef struct {
uint32_t mod;
@@ -201,6 +204,8 @@ typedef struct {
const char *title;
unsigned int tags;
int isfloating;
+ int isterm;
+ int noswallow;
int monitor;
} Rule;
@@ -310,6 +315,10 @@ static Monitor *xytomon(double x, double y);
static struct wlr_scene_node *xytonode(double x, double y, struct wlr_surface **psurface,
Client **pc, LayerSurface **pl, double *nx, double *ny);
static void zoom(const Arg *arg);
+static pid_t getparentprocess(pid_t p);
+static int isdescprocess(pid_t p, pid_t c);
+static Client *termforwin(Client *w);
+static void swallow(Client *c, Client *w);
/* variables */
static const char broken[] = "broken";
@@ -453,6 +462,8 @@ applyrules(Client *c)
if ((!r->title || strstr(title, r->title))
&& (!r->id || strstr(appid, r->id))) {
c->isfloating = r->isfloating;
+ c->isterm = r->isterm;
+ c->noswallow = r->noswallow;
newtags |= r->tags;
i = 0;
wl_list_for_each(m, &mons, link)
@@ -990,6 +1001,8 @@ createnotify(struct wl_listener *listener, void *data)
c->surface.xdg = xdg_surface;
c->bw = borderpx;
+ wl_client_get_credentials(c->surface.xdg->client->client, &c->pid, NULL, NULL);
+
LISTEN(&xdg_surface->events.map, &c->map, mapnotify);
LISTEN(&xdg_surface->events.unmap, &c->unmap, unmapnotify);
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
@@ -1308,6 +1321,61 @@ fullscreennotify(struct wl_listener *listener, void *data)
setfullscreen(c, client_wants_fullscreen(c));
}
+pid_t
+getparentprocess(pid_t p)
+{
+ unsigned int v = 0;
+
+ FILE *f;
+ char buf[256];
+ snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
+
+ if (!(f = fopen(buf, "r")))
+ return 0;
+
+ fscanf(f, "%*u %*s %*c %u", &v);
+ fclose(f);
+
+ return (pid_t)v;
+}
+
+int
+isdescprocess(pid_t p, pid_t c)
+{
+ while (p != c && c != 0)
+ c = getparentprocess(c);
+
+ return (int)c;
+}
+
+Client *
+termforwin(Client *w)
+{
+ Client *c;
+
+ if (!w->pid || w->isterm || w->noswallow)
+ return NULL;
+
+ wl_list_for_each(c, &clients, link)
+ if (c->isterm && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
+ return c;
+
+ return NULL;
+}
+
+void
+swallow(Client *c, Client *w) {
+ c->bw = w->bw;
+ c->isfloating = w->isfloating;
+ c->isurgent = w->isurgent;
+ c->isfullscreen = w->isfullscreen;
+ resize(c, w->geom, 0);
+ wl_list_insert(&w->link, &c->link);
+ wl_list_insert(&w->flink, &c->flink);
+ wlr_scene_node_set_enabled(&w->scene->node, 0);
+ wlr_scene_node_set_enabled(&c->scene->node, 1);
+}
+
void
incnmaster(const Arg *arg)
{
@@ -1528,6 +1596,20 @@ mapnotify(struct wl_listener *listener, void *data)
}
printstatus();
+ if (!c->noswallow) {
+ Client *p = termforwin(c);
+ if (p) {
+ c->swallowedby = p;
+ p->swallowing = c;
+ wl_list_remove(&c->link);
+ wl_list_remove(&c->flink);
+ swallow(c,p);
+ wl_list_remove(&p->link);
+ wl_list_remove(&p->flink);
+ arrange(c->mon);
+ }
+ }
+
unset_fullscreen:
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
wl_list_for_each(w, &clients, link)
@@ -2409,6 +2491,18 @@ unmapnotify(struct wl_listener *listener, void *data)
grabc = NULL;
}
+ if (c->swallowing) {
+ c->swallowing->swallowedby = NULL;
+ c->swallowing = NULL;
+ }
+
+ if (c->swallowedby) {
+ setfullscreen(c->swallowedby, 0);
+ swallow(c->swallowedby, c);
+ c->swallowedby->swallowing = NULL;
+ c->swallowedby = NULL;
+ }
+
if (client_is_unmanaged(c)) {
if (c == exclusive_focus)
exclusive_focus = NULL;

View File

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This is largely ripped from somebar's ipc patchset; just with some personal modifications.
I would probably just submit raphi's patchset but I don't think that would be polite.
-->
<protocol name="dwl_ipc_unstable_v1">
<description summary="inter-proccess-communication about dwl's state">
This protocol allows clients to get updates from dwl and vice versa.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible
changes may be added together with the corresponding interface
version bump.
Backward incompatible changes are done by bumping the version
number in the protocol and interface names and resetting the
interface version. Once the protocol is to be declared stable,
the 'z' prefix and the version number in the protocol and
interface names are removed and the interface version number is
reset.
</description>
<interface name="zdwl_ipc_manager_v1" version="4">
<description summary="manage dwl state">
This interface is exposed as a global in wl_registry.
Clients can use this interface to get a dwl_output.
After binding the client will revieve dwl_manager.tag and dwl_manager.layout events.
The dwl_manager.tag and dwl_manager.layout events expose tags and layouts to the client.
</description>
<request name="release" type="destructor">
<description summary="release dwl_manager">
Indicates that the client will not the dwl_manager object anymore.
Objects created through this instance are not affected.
</description>
</request>
<request name="get_output">
<description summary="get a dwl_output for a wl_output">
Get a dwl_output for the specified wl_output.
</description>
<arg name="id" type="new_id" interface="zdwl_ipc_output_v1"/>
<arg name="output" type="object" interface="wl_output"/>
</request>
<event name="tag">
<description summary="Announces a tag">
This event is sent after binding.
A roundtrip after binding guarantees the client recieved all tags.
</description>
<arg name="name" type="string"/>
</event>
<event name="layout">
<description summary="Announces a layout">
This event is sent after binding.
A roundtrip after binding guarantees the client recieved all layouts.
</description>
<arg name="name" type="string"/>
</event>
</interface>
<interface name="zdwl_ipc_output_v1" version="4">
<description summary="control dwl output">
Observe and control a dwl output.
Events are double-buffered:
Clients should cache events and redraw when a dwl_output.done event is sent.
Request are not double-buffered:
The compositor will update immediately upon request.
</description>
<enum name="tag_state">
<entry name="none" value="0" summary="no state"/>
<entry name="active" value="1" summary="tag is active"/>
<entry name="urgent" value="2" summary="tag has at least one urgent client"/>
</enum>
<request name="release" type="destructor">
<description summary="release dwl_output">
Indicates to that the client no longer needs this dwl_output.
</description>
</request>
<event name="toggle_visibility">
<description summary="Toggle client visibilty">
Indicates the client should hide or show themselves.
If the client is visible then hide, if hidden then show.
</description>
</event>
<event name="active">
<description summary="Update the selected output.">
Indicates if the output is active. Zero is invalid, nonzero is valid.
</description>
<arg name="active" type="uint"/>
</event>
<event name="tag">
<description summary="Update the state of a tag.">
Indicates that a tag has been updated.
</description>
<arg name="tag" type="uint" summary="Index of the tag"/>
<arg name="state" type="uint" enum="tag_state" summary="The state of the tag."/>
<arg name="clients" type="uint" summary="The number of clients in the tag."/>
<arg name="focused" type="uint" summary="If there is a focused client. Nonzero being valid, zero being invalid."/>
</event>
<event name="layout">
<description summary="Update the layout.">
Indicates a new layout is selected.
</description>
<arg name="layout" type="uint" summary="Index of the layout."/>
</event>
<event name="title">
<description summary="Update the title.">
Indicates the title has changed.
</description>
<arg name="title" type="string" summary="The new title name."/>
</event>
<event name="frame">
<description summary="The update sequence is done.">
Indicates that a sequence of status updates have finished and the client should redraw.
</description>
</event>
<request name="set_layout">
<description summary="Set the layout of this output"/>
<arg name="index" type="uint" summary="index of a layout recieved by dwl_manager.layout"/>
</request>
<request name="set_tags">
<description summary="Set the active tags of this output"/>
<arg name="tagmask" type="uint" summary="bitmask of the tags that should be set."/>
<arg name="toggle_tagset" type="uint" summary="toggle the selected tagset, zero for invalid, nonzero for valid."/>
</request>
<request name="set_client_tags">
<description summary="Set the tags of the focused client.">
The tags are updated as follows:
new_tags = (current_tags AND and_tags) XOR xor_tags
</description>
<arg name="and_tags" type="uint"/>
<arg name="xor_tags" type="uint"/>
</request>
<!-- Version 2 -->
<event name="appid" since="2">
<description summary="Update the appid.">
Indicates the appid has changed.
</description>
<arg name="appid" type="string" summary="The new appid."/>
</event>
<!-- Version 3 -->
<event name="layout_symbol" since="3">
<description summary="Update the current layout symbol">
Indicates the layout has changed. Since layout symbols are now dynamic.
As opposed to the zdwl_manager_v1.layout event, this should take precendence when displaying.
This also means ignoring the zdwl_output_v1.layout event.
</description>
<arg name="layout" type="string" summary="The new layout"/>
</event>
<!-- Version 4 -->
<event name="fullscreen" since="4">
<description summary="Update fullscreen status">
Indicates if the selected client on this output is fullscreen.
</description>
<arg name="is_fullscreen" type="uint" summary="If the selected client is fullscreen. Nonzero is valid, zero invalid"/>
</event>
<event name="floating" since="4">
<description summary="Update the floating status">
Indicates if the selected client on this output is floating.
</description>
<arg name="is_floating" type="uint" summary="If the selected client is floating. Nonzero is valid, zero invalid"/>
</event>
</interface>
</protocol>

BIN
util.o

Binary file not shown.

View File

@ -1,606 +0,0 @@
/* Generated by wayland-scanner 1.22.0 */
#ifndef WLR_LAYER_SHELL_UNSTABLE_V1_SERVER_PROTOCOL_H
#define WLR_LAYER_SHELL_UNSTABLE_V1_SERVER_PROTOCOL_H
#include <stdint.h>
#include <stddef.h>
#include "wayland-server.h"
#ifdef __cplusplus
extern "C" {
#endif
struct wl_client;
struct wl_resource;
/**
* @page page_wlr_layer_shell_unstable_v1 The wlr_layer_shell_unstable_v1 protocol
* @section page_ifaces_wlr_layer_shell_unstable_v1 Interfaces
* - @subpage page_iface_zwlr_layer_shell_v1 - create surfaces that are layers of the desktop
* - @subpage page_iface_zwlr_layer_surface_v1 - layer metadata interface
* @section page_copyright_wlr_layer_shell_unstable_v1 Copyright
* <pre>
*
* Copyright © 2017 Drew DeVault
*
* Permission to use, copy, modify, distribute, and sell this
* software and its documentation for any purpose is hereby granted
* without fee, provided that the above copyright notice appear in
* all copies and that both that copyright notice and this permission
* notice appear in supporting documentation, and that the name of
* the copyright holders not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
* SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
* SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
* </pre>
*/
struct wl_output;
struct wl_surface;
struct xdg_popup;
struct zwlr_layer_shell_v1;
struct zwlr_layer_surface_v1;
#ifndef ZWLR_LAYER_SHELL_V1_INTERFACE
#define ZWLR_LAYER_SHELL_V1_INTERFACE
/**
* @page page_iface_zwlr_layer_shell_v1 zwlr_layer_shell_v1
* @section page_iface_zwlr_layer_shell_v1_desc Description
*
* Clients can use this interface to assign the surface_layer role to
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
* rendered with a defined z-depth respective to each other. They may also be
* anchored to the edges and corners of a screen and specify input handling
* semantics. This interface should be suitable for the implementation of
* many desktop shell components, and a broad number of other applications
* that interact with the desktop.
* @section page_iface_zwlr_layer_shell_v1_api API
* See @ref iface_zwlr_layer_shell_v1.
*/
/**
* @defgroup iface_zwlr_layer_shell_v1 The zwlr_layer_shell_v1 interface
*
* Clients can use this interface to assign the surface_layer role to
* wl_surfaces. Such surfaces are assigned to a "layer" of the output and
* rendered with a defined z-depth respective to each other. They may also be
* anchored to the edges and corners of a screen and specify input handling
* semantics. This interface should be suitable for the implementation of
* many desktop shell components, and a broad number of other applications
* that interact with the desktop.
*/
extern const struct wl_interface zwlr_layer_shell_v1_interface;
#endif
#ifndef ZWLR_LAYER_SURFACE_V1_INTERFACE
#define ZWLR_LAYER_SURFACE_V1_INTERFACE
/**
* @page page_iface_zwlr_layer_surface_v1 zwlr_layer_surface_v1
* @section page_iface_zwlr_layer_surface_v1_desc Description
*
* An interface that may be implemented by a wl_surface, for surfaces that
* are designed to be rendered as a layer of a stacked desktop-like
* environment.
*
* Layer surface state (layer, size, anchor, exclusive zone,
* margin, interactivity) is double-buffered, and will be applied at the
* time wl_surface.commit of the corresponding wl_surface is called.
*
* Attaching a null buffer to a layer surface unmaps it.
*
* Unmapping a layer_surface means that the surface cannot be shown by the
* compositor until it is explicitly mapped again. The layer_surface
* returns to the state it had right after layer_shell.get_layer_surface.
* The client can re-map the surface by performing a commit without any
* buffer attached, waiting for a configure event and handling it as usual.
* @section page_iface_zwlr_layer_surface_v1_api API
* See @ref iface_zwlr_layer_surface_v1.
*/
/**
* @defgroup iface_zwlr_layer_surface_v1 The zwlr_layer_surface_v1 interface
*
* An interface that may be implemented by a wl_surface, for surfaces that
* are designed to be rendered as a layer of a stacked desktop-like
* environment.
*
* Layer surface state (layer, size, anchor, exclusive zone,
* margin, interactivity) is double-buffered, and will be applied at the
* time wl_surface.commit of the corresponding wl_surface is called.
*
* Attaching a null buffer to a layer surface unmaps it.
*
* Unmapping a layer_surface means that the surface cannot be shown by the
* compositor until it is explicitly mapped again. The layer_surface
* returns to the state it had right after layer_shell.get_layer_surface.
* The client can re-map the surface by performing a commit without any
* buffer attached, waiting for a configure event and handling it as usual.
*/
extern const struct wl_interface zwlr_layer_surface_v1_interface;
#endif
#ifndef ZWLR_LAYER_SHELL_V1_ERROR_ENUM
#define ZWLR_LAYER_SHELL_V1_ERROR_ENUM
enum zwlr_layer_shell_v1_error {
/**
* wl_surface has another role
*/
ZWLR_LAYER_SHELL_V1_ERROR_ROLE = 0,
/**
* layer value is invalid
*/
ZWLR_LAYER_SHELL_V1_ERROR_INVALID_LAYER = 1,
/**
* wl_surface has a buffer attached or committed
*/
ZWLR_LAYER_SHELL_V1_ERROR_ALREADY_CONSTRUCTED = 2,
};
#endif /* ZWLR_LAYER_SHELL_V1_ERROR_ENUM */
#ifndef ZWLR_LAYER_SHELL_V1_LAYER_ENUM
#define ZWLR_LAYER_SHELL_V1_LAYER_ENUM
/**
* @ingroup iface_zwlr_layer_shell_v1
* available layers for surfaces
*
* These values indicate which layers a surface can be rendered in. They
* are ordered by z depth, bottom-most first. Traditional shell surfaces
* will typically be rendered between the bottom and top layers.
* Fullscreen shell surfaces are typically rendered at the top layer.
* Multiple surfaces can share a single layer, and ordering within a
* single layer is undefined.
*/
enum zwlr_layer_shell_v1_layer {
ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND = 0,
ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM = 1,
ZWLR_LAYER_SHELL_V1_LAYER_TOP = 2,
ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY = 3,
};
#endif /* ZWLR_LAYER_SHELL_V1_LAYER_ENUM */
/**
* @ingroup iface_zwlr_layer_shell_v1
* @struct zwlr_layer_shell_v1_interface
*/
struct zwlr_layer_shell_v1_interface {
/**
* create a layer_surface from a surface
*
* Create a layer surface for an existing surface. This assigns
* the role of layer_surface, or raises a protocol error if another
* role is already assigned.
*
* Creating a layer surface from a wl_surface which has a buffer
* attached or committed is a client error, and any attempts by a
* client to attach or manipulate a buffer prior to the first
* layer_surface.configure call must also be treated as errors.
*
* After creating a layer_surface object and setting it up, the
* client must perform an initial commit without any buffer
* attached. The compositor will reply with a
* layer_surface.configure event. The client must acknowledge it
* and is then allowed to attach a buffer to map the surface.
*
* You may pass NULL for output to allow the compositor to decide
* which output to use. Generally this will be the one that the
* user most recently interacted with.
*
* Clients can specify a namespace that defines the purpose of the
* layer surface.
* @param layer layer to add this surface to
* @param namespace namespace for the layer surface
*/
void (*get_layer_surface)(struct wl_client *client,
struct wl_resource *resource,
uint32_t id,
struct wl_resource *surface,
struct wl_resource *output,
uint32_t layer,
const char *namespace);
/**
* destroy the layer_shell object
*
* This request indicates that the client will not use the
* layer_shell object any more. Objects that have been created
* through this instance are not affected.
* @since 3
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
};
/**
* @ingroup iface_zwlr_layer_shell_v1
*/
#define ZWLR_LAYER_SHELL_V1_GET_LAYER_SURFACE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_shell_v1
*/
#define ZWLR_LAYER_SHELL_V1_DESTROY_SINCE_VERSION 3
#ifndef ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM
#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM
/**
* @ingroup iface_zwlr_layer_surface_v1
* types of keyboard interaction possible for a layer shell surface
*
* Types of keyboard interaction possible for layer shell surfaces. The
* rationale for this is twofold: (1) some applications are not interested
* in keyboard events and not allowing them to be focused can improve the
* desktop experience; (2) some applications will want to take exclusive
* keyboard focus.
*/
enum zwlr_layer_surface_v1_keyboard_interactivity {
/**
* no keyboard focus is possible
*
* This value indicates that this surface is not interested in
* keyboard events and the compositor should never assign it the
* keyboard focus.
*
* This is the default value, set for newly created layer shell
* surfaces.
*
* This is useful for e.g. desktop widgets that display information
* or only have interaction with non-keyboard input devices.
*/
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE = 0,
/**
* request exclusive keyboard focus
*
* Request exclusive keyboard focus if this surface is above the
* shell surface layer.
*
* For the top and overlay layers, the seat will always give
* exclusive keyboard focus to the top-most layer which has
* keyboard interactivity set to exclusive. If this layer contains
* multiple surfaces with keyboard interactivity set to exclusive,
* the compositor determines the one receiving keyboard events in
* an implementation- defined manner. In this case, no guarantee is
* made when this surface will receive keyboard focus (if ever).
*
* For the bottom and background layers, the compositor is allowed
* to use normal focus semantics.
*
* This setting is mainly intended for applications that need to
* ensure they receive all keyboard events, such as a lock screen
* or a password prompt.
*/
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE = 1,
/**
* request regular keyboard focus semantics
*
* This requests the compositor to allow this surface to be
* focused and unfocused by the user in an implementation-defined
* manner. The user should be able to unfocus this surface even
* regardless of the layer it is on.
*
* Typically, the compositor will want to use its normal mechanism
* to manage keyboard focus between layer shell surfaces with this
* setting and regular toplevels on the desktop layer (e.g. click
* to focus). Nevertheless, it is possible for a compositor to
* require a special interaction to focus or unfocus layer shell
* surfaces (e.g. requiring a click even if focus follows the mouse
* normally, or providing a keybinding to switch focus between
* layers).
*
* This setting is mainly intended for desktop shell components
* (e.g. panels) that allow keyboard interaction. Using this option
* can allow implementing a desktop shell that can be fully usable
* without the mouse.
* @since 4
*/
ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND = 2,
};
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ON_DEMAND_SINCE_VERSION 4
#endif /* ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_ENUM */
#ifndef ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
#define ZWLR_LAYER_SURFACE_V1_ERROR_ENUM
enum zwlr_layer_surface_v1_error {
/**
* provided surface state is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SURFACE_STATE = 0,
/**
* size is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_SIZE = 1,
/**
* anchor bitfield is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_ANCHOR = 2,
/**
* keyboard interactivity is invalid
*/
ZWLR_LAYER_SURFACE_V1_ERROR_INVALID_KEYBOARD_INTERACTIVITY = 3,
};
#endif /* ZWLR_LAYER_SURFACE_V1_ERROR_ENUM */
#ifndef ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
#define ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM
enum zwlr_layer_surface_v1_anchor {
/**
* the top edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP = 1,
/**
* the bottom edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM = 2,
/**
* the left edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT = 4,
/**
* the right edge of the anchor rectangle
*/
ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT = 8,
};
#endif /* ZWLR_LAYER_SURFACE_V1_ANCHOR_ENUM */
/**
* @ingroup iface_zwlr_layer_surface_v1
* @struct zwlr_layer_surface_v1_interface
*/
struct zwlr_layer_surface_v1_interface {
/**
* sets the size of the surface
*
* Sets the size of the surface in surface-local coordinates. The
* compositor will display the surface centered with respect to its
* anchors.
*
* If you pass 0 for either value, the compositor will assign it
* and inform you of the assignment in the configure event. You
* must set your anchor to opposite edges in the dimensions you
* omit; not doing so is a protocol error. Both values are 0 by
* default.
*
* Size is double-buffered, see wl_surface.commit.
*/
void (*set_size)(struct wl_client *client,
struct wl_resource *resource,
uint32_t width,
uint32_t height);
/**
* configures the anchor point of the surface
*
* Requests that the compositor anchor the surface to the
* specified edges and corners. If two orthogonal edges are
* specified (e.g. 'top' and 'left'), then the anchor point will be
* the intersection of the edges (e.g. the top left corner of the
* output); otherwise the anchor point will be centered on that
* edge, or in the center if none is specified.
*
* Anchor is double-buffered, see wl_surface.commit.
*/
void (*set_anchor)(struct wl_client *client,
struct wl_resource *resource,
uint32_t anchor);
/**
* configures the exclusive geometry of this surface
*
* Requests that the compositor avoids occluding an area with
* other surfaces. The compositor's use of this information is
* implementation-dependent - do not assume that this region will
* not actually be occluded.
*
* A positive value is only meaningful if the surface is anchored
* to one edge or an edge and both perpendicular edges. If the
* surface is not anchored, anchored to only two perpendicular
* edges (a corner), anchored to only two parallel edges or
* anchored to all edges, a positive value will be treated the same
* as zero.
*
* A positive zone is the distance from the edge in surface-local
* coordinates to consider exclusive.
*
* Surfaces that do not wish to have an exclusive zone may instead
* specify how they should interact with surfaces that do. If set
* to zero, the surface indicates that it would like to be moved to
* avoid occluding surfaces with a positive exclusive zone. If set
* to -1, the surface indicates that it would not like to be moved
* to accommodate for other surfaces, and the compositor should
* extend it all the way to the edges it is anchored to.
*
* For example, a panel might set its exclusive zone to 10, so that
* maximized shell surfaces are not shown on top of it. A
* notification might set its exclusive zone to 0, so that it is
* moved to avoid occluding the panel, but shell surfaces are shown
* underneath it. A wallpaper or lock screen might set their
* exclusive zone to -1, so that they stretch below or over the
* panel.
*
* The default value is 0.
*
* Exclusive zone is double-buffered, see wl_surface.commit.
*/
void (*set_exclusive_zone)(struct wl_client *client,
struct wl_resource *resource,
int32_t zone);
/**
* sets a margin from the anchor point
*
* Requests that the surface be placed some distance away from
* the anchor point on the output, in surface-local coordinates.
* Setting this value for edges you are not anchored to has no
* effect.
*
* The exclusive zone includes the margin.
*
* Margin is double-buffered, see wl_surface.commit.
*/
void (*set_margin)(struct wl_client *client,
struct wl_resource *resource,
int32_t top,
int32_t right,
int32_t bottom,
int32_t left);
/**
* requests keyboard events
*
* Set how keyboard events are delivered to this surface. By
* default, layer shell surfaces do not receive keyboard events;
* this request can be used to change this.
*
* This setting is inherited by child surfaces set by the get_popup
* request.
*
* Layer surfaces receive pointer, touch, and tablet events
* normally. If you do not want to receive them, set the input
* region on your surface to an empty region.
*
* Keyboard interactivity is double-buffered, see
* wl_surface.commit.
*/
void (*set_keyboard_interactivity)(struct wl_client *client,
struct wl_resource *resource,
uint32_t keyboard_interactivity);
/**
* assign this layer_surface as an xdg_popup parent
*
* This assigns an xdg_popup's parent to this layer_surface. This
* popup should have been created via xdg_surface::get_popup with
* the parent set to NULL, and this request must be invoked before
* committing the popup's initial state.
*
* See the documentation of xdg_popup for more details about what
* an xdg_popup is and how it is used.
*/
void (*get_popup)(struct wl_client *client,
struct wl_resource *resource,
struct wl_resource *popup);
/**
* ack a configure event
*
* When a configure event is received, if a client commits the
* surface in response to the configure event, then the client must
* make an ack_configure request sometime before the commit
* request, passing along the serial of the configure event.
*
* If the client receives multiple configure events before it can
* respond to one, it only has to ack the last configure event.
*
* A client is not required to commit immediately after sending an
* ack_configure request - it may even ack_configure several times
* before its next surface commit.
*
* A client may send multiple ack_configure requests before
* committing, but only the last request sent before a commit
* indicates which configure event the client really is responding
* to.
* @param serial the serial from the configure event
*/
void (*ack_configure)(struct wl_client *client,
struct wl_resource *resource,
uint32_t serial);
/**
* destroy the layer_surface
*
* This request destroys the layer surface.
*/
void (*destroy)(struct wl_client *client,
struct wl_resource *resource);
/**
* change the layer of the surface
*
* Change the layer that the surface is rendered on.
*
* Layer is double-buffered, see wl_surface.commit.
* @param layer layer to move this surface to
* @since 2
*/
void (*set_layer)(struct wl_client *client,
struct wl_resource *resource,
uint32_t layer);
};
#define ZWLR_LAYER_SURFACE_V1_CONFIGURE 0
#define ZWLR_LAYER_SURFACE_V1_CLOSED 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_CONFIGURE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_CLOSED_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_SIZE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_ANCHOR_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_EXCLUSIVE_ZONE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_MARGIN_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_KEYBOARD_INTERACTIVITY_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_GET_POPUP_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_ACK_CONFIGURE_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_DESTROY_SINCE_VERSION 1
/**
* @ingroup iface_zwlr_layer_surface_v1
*/
#define ZWLR_LAYER_SURFACE_V1_SET_LAYER_SINCE_VERSION 2
/**
* @ingroup iface_zwlr_layer_surface_v1
* Sends an configure event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zwlr_layer_surface_v1_send_configure(struct wl_resource *resource_, uint32_t serial, uint32_t width, uint32_t height)
{
wl_resource_post_event(resource_, ZWLR_LAYER_SURFACE_V1_CONFIGURE, serial, width, height);
}
/**
* @ingroup iface_zwlr_layer_surface_v1
* Sends an closed event to the client owning the resource.
* @param resource_ The client's resource
*/
static inline void
zwlr_layer_surface_v1_send_closed(struct wl_resource *resource_)
{
wl_resource_post_event(resource_, ZWLR_LAYER_SURFACE_V1_CLOSED);
}
#ifdef __cplusplus
}
#endif
#endif

File diff suppressed because it is too large Load Diff