forked from mirror/dwl
Merge branch 'push' of github:djpohly/dwl into push
This commit is contained in:
commit
a89872f02e
13 changed files with 1655 additions and 1135 deletions
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
@ -7,4 +7,16 @@ assignees: ''
|
|||
|
||||
---
|
||||
|
||||
## Info
|
||||
dwl version:
|
||||
wlroots version:
|
||||
## Description
|
||||
<!--
|
||||
Only report bugs that can be reproduced on the main line
|
||||
Report patch issues to their respective authors
|
||||
If the patch author doesn't respond within a reasonable time, email me:
|
||||
|
||||
Leonardo Hernández Hernández <leohdz172@protonmail.com>
|
||||
|
||||
but note that I'm NOT making any promises
|
||||
-->
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -2,7 +2,7 @@ dwl - dwm for Wayland
|
|||
|
||||
Copyright © 2020 dwl team
|
||||
|
||||
See also the files LICENSE.tinywl and LICENSE.dwm.
|
||||
See also the files LICENSE.tinywl, LICENSE.dwm and LICENSE.sway.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
19
LICENSE.sway
Normal file
19
LICENSE.sway
Normal file
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2016-2017 Drew DeVault
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
81
Makefile
81
Makefile
|
@ -1,63 +1,60 @@
|
|||
.POSIX:
|
||||
.SUFFIXES:
|
||||
|
||||
include config.mk
|
||||
|
||||
CFLAGS += -I. -DWLR_USE_UNSTABLE -std=c99
|
||||
# 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
|
||||
|
||||
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
|
||||
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
|
||||
|
||||
PKGS = wlroots wayland-server xcb xkbcommon libinput
|
||||
CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p)))
|
||||
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
|
||||
# CFLAGS / LDFLAGS
|
||||
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
|
||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(LIBS)
|
||||
|
||||
all: dwl
|
||||
dwl: dwl.o util.o
|
||||
$(CC) dwl.o util.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
|
||||
dwl.o: dwl.c push.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
|
||||
util.o: util.c util.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
|
||||
# to your build system yourself and provide them in the include path.
|
||||
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
||||
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||
|
||||
xdg-shell-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header \
|
||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
xdg-shell-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code \
|
||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
|
||||
xdg-shell-protocol.o: xdg-shell-protocol.h
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header \
|
||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code \
|
||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||
|
||||
wlr-layer-shell-unstable-v1-protocol.o: wlr-layer-shell-unstable-v1-protocol.h
|
||||
|
||||
idle-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header \
|
||||
protocols/idle.xml $@
|
||||
|
||||
idle-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code \
|
||||
protocols/idle.xml $@
|
||||
|
||||
idle-protocol.o: idle-protocol.h
|
||||
|
||||
config.h: | config.def.h
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
|
||||
dwl.o: config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h idle-protocol.h
|
||||
|
||||
dwl.o: push.c
|
||||
|
||||
dwl: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o idle-protocol.o
|
||||
|
||||
clean:
|
||||
rm -f dwl *.o *-protocol.h *-protocol.c
|
||||
rm -f dwl *.o *-protocol.h
|
||||
|
||||
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\
|
||||
dwl-$(VERSION)
|
||||
tar -caf dwl-$(VERSION).tar.gz dwl-$(VERSION)
|
||||
rm -rf dwl-$(VERSION)
|
||||
|
||||
install: dwl
|
||||
install -D dwl $(PREFIX)/bin/dwl
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
cp -f dwl $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
||||
cp -f dwl.1 $(DESTDIR)$(MANDIR)/man1
|
||||
chmod 644 $(DESTDIR)$(MANDIR)/man1/dwl.1
|
||||
uninstall:
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl $(DESTDIR)$(MANDIR)/man1/dwl.1
|
||||
|
||||
.DEFAULT_GOAL=dwl
|
||||
.PHONY: clean
|
||||
.SUFFIXES: .c .o
|
||||
.c.o:
|
||||
$(CC) $(CPPFLAGS) $(DWLCFLAGS) -c $<
|
||||
|
|
142
README.md
142
README.md
|
@ -1,77 +1,157 @@
|
|||
# dwl - dwm for Wayland
|
||||
|
||||
Join us on our [Discord server](https://discord.gg/jJxZnrGPWN)!
|
||||
Join us on our [Discord server] or at [#dwl] on irc.libera.chat.
|
||||
|
||||
dwl is a compact, hackable compositor for Wayland based on [wlroots](https://github.com/swaywm/wlroots). It is intended to fill the same space in the Wayland world that dwm does in X11, primarily in terms of philosophy, and secondarily in terms of functionality. Like dwm, dwl is:
|
||||
dwl is a compact, hackable compositor for [Wayland] based on [wlroots]. It is
|
||||
intended to fill the same space in the Wayland world that dwm does in X11,
|
||||
primarily in terms of philosophy, and secondarily in terms of functionality.
|
||||
Like dwm, dwl is:
|
||||
|
||||
- Easy to understand, hack on, and extend with patches
|
||||
- One C source file (or a very small number) configurable via `config.h`
|
||||
- Limited to 2000 SLOC to promote hackability
|
||||
- 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 sticks to features which are necessary, simple, and straightforward to implement given the base on which it is built. Implemented default features are:
|
||||
dwl is not meant to provide every feature under the sun. Instead, like dwm, it
|
||||
sticks to features which are necessary, simple, and straightforward to implement
|
||||
given the base on which it is built. Implemented default features are:
|
||||
|
||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings, client rules, mouse move/resize. Providing a built-in status bar is an exception to this goal, to avoid dependencies on font rendering and/or drawing libraries when an external bar could work well.
|
||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings,
|
||||
client rules, mouse move/resize. Providing a built-in status bar is an
|
||||
exception to this goal, to avoid dependencies on font rendering and/or
|
||||
drawing libraries when an external bar could work well.
|
||||
- Configurable multi-monitor layout support, including position and rotation
|
||||
- Configurable HiDPI/multi-DPI support
|
||||
- Idle-inhibit protocol which lets applications such as mpv disable idle
|
||||
monitoring
|
||||
- Provide information to external status bars via stdout/stdin
|
||||
- Urgency hints via xdg-activate protocol
|
||||
- Support screen lockers via input-inhibitor protocol
|
||||
- Various Wayland protocols
|
||||
- XWayland support as provided by wlroots
|
||||
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
|
||||
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
|
||||
- Layer shell popups (used by Waybar)
|
||||
- Damage tracking provided by scenegraph API
|
||||
|
||||
Features under consideration (possibly as patches) are:
|
||||
|
||||
- Protocols made trivial by wlroots
|
||||
- Provide information to external status bars via stdout or another file descriptor
|
||||
- Implement the input-inhibitor protocol to support screen lockers
|
||||
- Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring
|
||||
- Layer shell popups (used by Waybar)
|
||||
- Basic yes/no damage tracking to avoid needless redraws
|
||||
- More in-depth damage region tracking ([which may improve power usage](https://mozillagfx.wordpress.com/2019/10/22/dramatically-reduced-power-usage-in-firefox-70-on-macos-with-core-animation/))
|
||||
- Implement the text-input and input-method protocols to support IME once ibus implements input-method v2 (see https://github.com/ibus/ibus/pull/2256 and https://github.com/djpohly/dwl/pull/12)
|
||||
- Implement urgent/attention/focus-request once it's part of the xdg-shell protocol (https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/9)
|
||||
- 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)
|
||||
|
||||
Feature *non-goals* include:
|
||||
Feature *non-goals* for the main codebase include:
|
||||
|
||||
- Client-side decoration (any more than is necessary to tell the clients not to)
|
||||
- Client-initiated window management, such as move, resize, and close, which can be done through the compositor
|
||||
- Client-initiated window management, such as move, resize, and close, which can
|
||||
be done through the compositor
|
||||
- Animations and visual effects
|
||||
|
||||
## Building dwl
|
||||
|
||||
dwl has only two dependencies: wlroots-git and wayland-protocols. Simply install these and run `make`.
|
||||
dwl has only two dependencies: `wlroots` and `wayland-protocols`.
|
||||
|
||||
To enable XWayland, you should also install xorg-xwayland and uncomment its flag in `config.mk`.
|
||||
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`.
|
||||
|
||||
## Configuration
|
||||
|
||||
All configuration is done by editing `config.h` and recompiling, in the same manner as dwm. There is no way to separately restart the window manager in Wayland without restarting the entire display server, so any changes will take effect the next time dwl is executed.
|
||||
All configuration is done by editing `config.h` and recompiling, in the same
|
||||
manner as dwm. There is no way to separately restart the window manager in
|
||||
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](https://github.com/djpohly/dwl/wiki/Patches)!
|
||||
As in the dwm community, we encourage users to share patches they have created.
|
||||
Check out the [patches page on our wiki]!
|
||||
|
||||
## Running dwl
|
||||
|
||||
dwl can be run as-is, with no arguments. In an existing Wayland or X11 session, this will open a window to act as a virtual display. When run from a TTY, the Wayland server will take over the entire virtual terminal. Clients started by dwl will have `WAYLAND_DISPLAY` set in their environment, and other clients can be started from outside the session by setting this variable accordingly.
|
||||
dwl can be run on any of the backends supported by wlroots. This means you can
|
||||
run it as a separate window inside either an X11 or Wayland session, as well
|
||||
as directly from a VT console. Depending on your distro's setup, you may need
|
||||
to add your user to the `video` and `input` groups before you can run dwl on
|
||||
a VT. If you are using `elogind` or `systemd-logind` you need to install
|
||||
polkit; otherwise you need to add yourself in the `seat` group and
|
||||
enable/start the seatd daemon.
|
||||
|
||||
You can also specify a startup program using the `-s` option. The argument to this option will be run at startup as a shell command (using `sh -c`) and can serve a similar function to `.xinitrc`: starting a service manager or other startup applications. Unlike `.xinitrc`, the display server will not shut down when this process terminates. Instead, as dwl is shutting down, it will send this process a SIGTERM and wait for it to terminate (if it hasn't already). This makes it ideal not only for initialization but also for execing into a user-level service manager like s6 or `systemd --user`.
|
||||
When dwl is run with no arguments, it will launch the server and begin handling
|
||||
any shortcuts configured in `config.h`. There is no status bar or other
|
||||
decoration initially; these are instead clients that can be run within
|
||||
the Wayland session.
|
||||
|
||||
Note: Wayland requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager such as `elogind` or `systemd-logind`. If your system doesn't do this automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
If you would like to run a script or command automatically at startup, you can
|
||||
specify the command using the `-s` option. This command will be executed as a
|
||||
shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`,
|
||||
but differs in that the display server will not shut down when this process
|
||||
terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait
|
||||
for it to terminate (if it hasn't already). This makes it ideal for execing into
|
||||
a user service manager like [s6], [anopa], [runit], 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
|
||||
that it spawns. If you need to set environment variables that affect the entire
|
||||
dwl session, these must be set prior to running dwl. For example, Wayland
|
||||
requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager
|
||||
such as `elogind` or `systemd-logind`. If your system doesn't do this
|
||||
automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
|
||||
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-$(id -u)
|
||||
mkdir -p $XDG_RUNTIME_DIR
|
||||
dwl
|
||||
|
||||
### Status information
|
||||
|
||||
Information about selected layouts, current window title, and
|
||||
selected/occupied/urgent tags is written to the stdin of the `-s` command (see
|
||||
the `printstatus()` function for details). This information can be used to
|
||||
populate an external status bar with a script that parses the information.
|
||||
Failing to read this information will cause dwl to block, so if you do want to
|
||||
run a startup command that does not consume the status information, you can
|
||||
close standard input with the `<&-` shell redirection, for example:
|
||||
|
||||
dwl -s 'foot --server <&-'
|
||||
|
||||
If your startup command is a shell script, you can achieve the same inside the
|
||||
script with the line
|
||||
|
||||
exec <&-
|
||||
|
||||
To get a list of status bars that work with dwl consult our [wiki].
|
||||
|
||||
## Replacements for X applications
|
||||
|
||||
You can find a [list of Wayland applications on the sway wiki](https://github.com/swaywm/sway/wiki/i3-Migration-Guide).
|
||||
|
||||
## IRC channel
|
||||
|
||||
dwl's IRC channel is #dwl on irc.freenode.net.
|
||||
You can find a [list of useful resources on our wiki].
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots developers. This was made possible in many cases by looking at how sway accomplished something, then trying to do the same in as suckless a way as possible.
|
||||
dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots
|
||||
developers. This was made possible in many cases by looking at how sway
|
||||
accomplished something, then trying to do the same in as suckless a way as
|
||||
possible.
|
||||
|
||||
Many thanks to suckless.org and the dwm developers and community for the inspiration, and to the various contributors to the project, including:
|
||||
Many thanks to suckless.org and the dwm developers and community for the
|
||||
inspiration, and to the various contributors to the project, including:
|
||||
|
||||
- Alexander Courtis for the XWayland implementation
|
||||
- Guido Cella for the layer-shell protocol implementation, patch maintenance, and for helping to keep the project running
|
||||
- Guido Cella for the layer-shell protocol implementation, patch maintenance,
|
||||
and for helping to keep the project running
|
||||
- Stivvo for output management and fullscreen support, and patch maintenance
|
||||
|
||||
|
||||
[Discord server]: https://discord.gg/jJxZnrGPWN
|
||||
[#dwl]: 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
|
||||
[s6]: https://skarnet.org/software/s6/
|
||||
[anopa]: https://jjacky.com/anopa/
|
||||
[runit]: http://smarden.org/runit/faq.html#userservices
|
||||
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
|
||||
[wiki]: https://github.com/djpohly/dwl/wiki#compatible-status-bars
|
||||
[list of useful resources on our wiki]:
|
||||
https://github.com/djpohly/dwl/wiki#migrating-from-x
|
||||
|
|
249
client.h
249
client.h
|
@ -5,7 +5,7 @@
|
|||
* that they will simply compile out if the chosen #defines leave them unused.
|
||||
*/
|
||||
|
||||
/* Leave this function first; it's used in the others */
|
||||
/* Leave these functions first; they're used in the others */
|
||||
static inline int
|
||||
client_is_x11(Client *c)
|
||||
{
|
||||
|
@ -16,33 +16,116 @@ client_is_x11(Client *c)
|
|||
#endif
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_from_wlr_surface(struct wlr_surface *s)
|
||||
{
|
||||
struct wlr_xdg_surface *surface;
|
||||
|
||||
#ifdef XWAYLAND
|
||||
struct wlr_xwayland_surface *xsurface;
|
||||
if (s && wlr_surface_is_xwayland_surface(s)
|
||||
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s)))
|
||||
return xsurface->data;
|
||||
#endif
|
||||
if (s && wlr_surface_is_xdg_surface(s)
|
||||
&& (surface = wlr_xdg_surface_from_wlr_surface(s))
|
||||
&& surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL)
|
||||
return surface->data;
|
||||
|
||||
if (s && wlr_surface_is_subsurface(s))
|
||||
return client_from_wlr_surface(wlr_surface_get_root_surface(s));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
client_get_parent(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c) && c->surface.xwayland->parent)
|
||||
return client_from_wlr_surface(c->surface.xwayland->parent->surface);
|
||||
#endif
|
||||
if (c->surface.xdg->toplevel->parent)
|
||||
return client_from_wlr_surface(c->surface.xdg->toplevel->parent->base->surface);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
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 *
|
||||
client_surface(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->surface;
|
||||
#endif
|
||||
return c->surface.xdg->surface;
|
||||
}
|
||||
|
||||
/* The others */
|
||||
static inline void
|
||||
client_activate_surface(struct wlr_surface *s, int activated)
|
||||
{
|
||||
struct wlr_xdg_surface *surface;
|
||||
#ifdef XWAYLAND
|
||||
if (wlr_surface_is_xwayland_surface(s)) {
|
||||
wlr_xwayland_surface_activate(
|
||||
wlr_xwayland_surface_from_wlr_surface(s), activated);
|
||||
struct wlr_xwayland_surface *xsurface;
|
||||
if (wlr_surface_is_xwayland_surface(s)
|
||||
&& (xsurface = wlr_xwayland_surface_from_wlr_surface(s))) {
|
||||
wlr_xwayland_surface_activate(xsurface, activated);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (wlr_surface_is_xdg_surface(s))
|
||||
wlr_xdg_toplevel_set_activated(
|
||||
wlr_xdg_surface_from_wlr_surface(s), activated);
|
||||
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);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
client_set_bounds(Client *c, int32_t width, int32_t height)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return 0;
|
||||
#endif
|
||||
if (c->surface.xdg->client->shell->version >=
|
||||
XDG_TOPLEVEL_CONFIGURE_BOUNDS_SINCE_VERSION)
|
||||
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)) {
|
||||
wlr_surface_for_each_surface(c->surface.xwayland->surface,
|
||||
fn, data);
|
||||
if (client_is_x11(c))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
wlr_xdg_surface_for_each_surface(c->surface.xdg, fn, data);
|
||||
wlr_xdg_surface_for_each_popup_surface(c->surface.xdg, fn, data);
|
||||
}
|
||||
|
||||
static inline const char *
|
||||
|
@ -82,16 +165,50 @@ 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);
|
||||
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c)) {
|
||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||
if (surface->modal)
|
||||
return 1;
|
||||
|
||||
for (size_t i = 0; i < surface->window_type_len; i++)
|
||||
if (surface->window_type[i] == netatom[NetWMWindowTypeDialog]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeSplash]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeToolbar]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeUtility])
|
||||
return 1;
|
||||
}
|
||||
#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))
|
||||
for (size_t i = 0; i < c->surface.xwayland->window_type_len; i++)
|
||||
if (c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeDialog] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeSplash] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeToolbar] ||
|
||||
c->surface.xwayland->window_type[i] == netatom[NetWMWindowTypeUtility])
|
||||
return 1;
|
||||
return c->surface.xwayland->mapped;
|
||||
#endif
|
||||
return c->surface.xdg->mapped;
|
||||
}
|
||||
|
||||
static inline int
|
||||
client_is_rendered_on_mon(Client *c, Monitor *m)
|
||||
{
|
||||
/* This is needed for when you don't want to check formal assignment,
|
||||
* but rather actual displaying of the pixels.
|
||||
* Usually VISIBLEON suffices and is also faster. */
|
||||
struct wlr_surface_output *s;
|
||||
if (!c->scene->node.enabled)
|
||||
return 0;
|
||||
wl_list_for_each(s, &client_surface(c)->current_outputs, link)
|
||||
if (s->output == m->wlr_output)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -104,6 +221,27 @@ client_is_unmanaged(Client *c)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
|
||||
{
|
||||
if (kb)
|
||||
wlr_seat_keyboard_notify_enter(seat, s, kb->keycodes,
|
||||
kb->num_keycodes, &kb->modifiers);
|
||||
else
|
||||
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_restack_surface(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
wlr_xwayland_surface_restack(c->surface.xwayland, NULL,
|
||||
XCB_STACK_MODE_ABOVE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_send_close(Client *c)
|
||||
{
|
||||
|
@ -113,7 +251,7 @@ client_send_close(Client *c)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
wlr_xdg_toplevel_send_close(c->surface.xdg);
|
||||
wlr_xdg_toplevel_send_close(c->surface.xdg->toplevel);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -125,7 +263,7 @@ client_set_fullscreen(Client *c, int fullscreen)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg, fullscreen);
|
||||
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
|
@ -138,17 +276,17 @@ client_set_size(Client *c, uint32_t width, uint32_t height)
|
|||
return 0;
|
||||
}
|
||||
#endif
|
||||
return wlr_xdg_toplevel_set_size(c->surface.xdg, width, height);
|
||||
return wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, width, height);
|
||||
}
|
||||
|
||||
static inline struct wlr_surface *
|
||||
client_surface(Client *c)
|
||||
static inline void
|
||||
client_set_tiled(Client *c, uint32_t edges)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->surface;
|
||||
return;
|
||||
#endif
|
||||
return c->surface.xdg->surface;
|
||||
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
|
||||
}
|
||||
|
||||
static inline struct wlr_surface *
|
||||
|
@ -161,3 +299,64 @@ client_surface_at(Client *c, double cx, double cy, double *sx, double *sy)
|
|||
#endif
|
||||
return wlr_xdg_surface_surface_at(c->surface.xdg, cx, cy, sx, sy);
|
||||
}
|
||||
|
||||
static inline int
|
||||
client_wants_focus(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
return client_is_unmanaged(c)
|
||||
&& wlr_xwayland_or_surface_wants_focus(c->surface.xwayland)
|
||||
&& wlr_xwayland_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int
|
||||
client_wants_fullscreen(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->fullscreen;
|
||||
#endif
|
||||
return c->surface.xdg->toplevel->requested.fullscreen;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
toplevel_from_popup(struct wlr_xdg_popup *popup)
|
||||
{
|
||||
struct wlr_xdg_surface *surface = popup->base;
|
||||
|
||||
while (1) {
|
||||
switch (surface->role) {
|
||||
case WLR_XDG_SURFACE_ROLE_POPUP:
|
||||
if (!surface->popup->parent)
|
||||
return NULL;
|
||||
else if (wlr_surface_is_layer_surface(surface->popup->parent))
|
||||
return wlr_layer_surface_v1_from_wlr_surface(surface->popup->parent)->data;
|
||||
else if (!wlr_surface_is_xdg_surface(surface->popup->parent))
|
||||
return NULL;
|
||||
|
||||
surface = wlr_xdg_surface_from_wlr_surface(surface->popup->parent);
|
||||
break;
|
||||
case WLR_XDG_SURFACE_ROLE_TOPLEVEL:
|
||||
return surface->data;
|
||||
case WLR_XDG_SURFACE_ROLE_NONE:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void *
|
||||
toplevel_from_wlr_layer_surface(struct wlr_surface *s)
|
||||
{
|
||||
Client *c;
|
||||
struct wlr_layer_surface_v1 *wlr_layer_surface;
|
||||
|
||||
if ((c = client_from_wlr_surface(s)))
|
||||
return c;
|
||||
else if (s && wlr_surface_is_layer_surface(s)
|
||||
&& (wlr_layer_surface = wlr_layer_surface_v1_from_wlr_surface(s)))
|
||||
return wlr_layer_surface->data;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
72
config.def.h
72
config.def.h
|
@ -1,9 +1,12 @@
|
|||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
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 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};
|
||||
/* 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};
|
||||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
|
@ -12,8 +15,8 @@ static const Rule rules[] = {
|
|||
/* app_id title tags mask isfloating monitor */
|
||||
/* examples:
|
||||
{ "Gimp", NULL, 0, 1, -1 },
|
||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
||||
*/
|
||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
|
@ -24,16 +27,14 @@ static const Layout layouts[] = {
|
|||
{ "[M]", monocle },
|
||||
};
|
||||
|
||||
/* monitors
|
||||
* The order in which monitors are defined determines their position.
|
||||
* Non-configured monitors are always added to the left. */
|
||||
/* monitors */
|
||||
static const MonitorRule monrules[] = {
|
||||
/* name mfact nmaster scale layout rotate/reflect x y */
|
||||
/* name mfact nmaster scale layout rotate/reflect */
|
||||
/* example of a HiDPI laptop monitor:
|
||||
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
*/
|
||||
/* defaults */
|
||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
|
||||
};
|
||||
|
||||
/* keyboard */
|
||||
|
@ -42,6 +43,7 @@ static const struct xkb_rule_names xkb_rules = {
|
|||
/* example:
|
||||
.options = "ctrl:nocaps",
|
||||
*/
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
static const int repeat_rate = 25;
|
||||
|
@ -49,9 +51,49 @@ 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_ALT
|
||||
|
||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
|
@ -62,7 +104,7 @@ static const int natural_scrolling = 0;
|
|||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
/* commands */
|
||||
static const char *termcmd[] = { "alacritty", NULL };
|
||||
static const char *termcmd[] = { "foot", NULL };
|
||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||
|
||||
static const Key keys[] = {
|
||||
|
@ -84,7 +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_e, togglefullscreen, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
|
@ -96,7 +138,7 @@ static const Key keys[] = {
|
|||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
|
||||
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
|
||||
TAGKEYS( XKB_KEY_6, XKB_KEY_caret, 5),
|
||||
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
|
||||
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
|
||||
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
||||
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
||||
|
|
14
config.mk
14
config.mk
|
@ -1,8 +1,14 @@
|
|||
_VERSION = 0.4-rc1
|
||||
VERSION = `git describe --long --tags --dirty 2>/dev/null || echo $(_VERSION)`
|
||||
|
||||
PKG_CONFIG = pkg-config
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
MANDIR = $(PREFIX)/share/man
|
||||
|
||||
# Default compile flags (overridable by environment)
|
||||
CFLAGS ?= -g -Wall -Wextra -Werror -Wno-unused-parameter -Wno-sign-compare -Wno-unused-function -Wno-unused-variable -Wdeclaration-after-statement
|
||||
|
||||
XWAYLAND =
|
||||
XLIBS =
|
||||
# Uncomment to build XWayland support
|
||||
#CFLAGS += -DXWAYLAND
|
||||
#XWAYLAND = -DXWAYLAND
|
||||
#XLIBS = xcb xcb-icccm
|
||||
|
|
151
dwl.1
Normal file
151
dwl.1
Normal file
|
@ -0,0 +1,151 @@
|
|||
.Dd January 8, 2021
|
||||
.Dt DWL 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm dwl
|
||||
.Nd dwm for Wayland
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl v
|
||||
.Op Fl s Ar startup command
|
||||
.Sh DESCRIPTION
|
||||
.Nm
|
||||
is a Wayland compositor based on wlroots.
|
||||
It is intended to fill the same space in the Wayland world that
|
||||
.Nm dwm
|
||||
does for X11.
|
||||
.Pp
|
||||
When given the
|
||||
.Fl v
|
||||
option,
|
||||
.Nm
|
||||
writes its name and version to standard error and exits unsuccessfully.
|
||||
.Pp
|
||||
When given the
|
||||
.Fl s
|
||||
option,
|
||||
.Nm
|
||||
starts a shell process running
|
||||
.Ar command
|
||||
when starting.
|
||||
When stopping, it sends
|
||||
.Dv SIGTERM
|
||||
to the child process and waits for it to exit.
|
||||
.Pp
|
||||
Users are encouraged to customize
|
||||
.Nm
|
||||
by editing the sources, in particular
|
||||
.Pa config.h .
|
||||
The default key bindings are as follows:
|
||||
.Bl -tag -width 20n -offset indent -compact
|
||||
.It Mod-[1-9]
|
||||
Show only all windows with a tag.
|
||||
.It Mod-Ctrl-[1-9]
|
||||
Show all windows with a tag.
|
||||
.It Mod-Shift-[1-9]
|
||||
Move window to a single tag.
|
||||
.It Mod-Ctrl-Shift-[1-9]
|
||||
Toggle tag for window.
|
||||
.It Mod-p
|
||||
Spawn
|
||||
.Nm bemenu-run .
|
||||
.It Mod-Shift-Return
|
||||
Spawn
|
||||
.Nm foot .
|
||||
.It Mod-[jk]
|
||||
Move focus down/up the stack.
|
||||
.It Mod-[id]
|
||||
Increase/decrease number of windows in master area.
|
||||
.It Mod-[hl]
|
||||
Decrease/increase master area.
|
||||
.It Mod-Return
|
||||
Move window on top of stack or switch top of stack with second window.
|
||||
.It Mod-Tab
|
||||
Show only all windows with previous tag.
|
||||
.It Mod-Shift-c
|
||||
Close window.
|
||||
.It Mod-t
|
||||
Switch to tabbed layout.
|
||||
.It Mod-f
|
||||
Switch to floating layout.
|
||||
.It Mod-m
|
||||
Switch to monocle layout.
|
||||
.It Mod-Space
|
||||
Switch to previous layout.
|
||||
.It Mod-Shift-Space
|
||||
Toggle floating state of window.
|
||||
.It Mod-e
|
||||
Toggle fullscreen state of window.
|
||||
.It Mod-0
|
||||
Show all windows.
|
||||
.It Mod-Shift-0
|
||||
Set all tags for window.
|
||||
.It Mod-,
|
||||
Move focus to previous monitor.
|
||||
.It Mod-.
|
||||
Move focus to next monitor.
|
||||
.It Mod-Shift-,
|
||||
Move window to previous monitor.
|
||||
.It Mod-Shift-.
|
||||
Move window to next monitor.
|
||||
.It Mod-Shift-q
|
||||
Quit
|
||||
.Nm .
|
||||
.El
|
||||
These might differ depending on your keyboard layout.
|
||||
.Sh ENVIRONMENT
|
||||
These environment variables are used by
|
||||
.Nm :
|
||||
.Bl -tag -width XDG_RUNTIME_DIR
|
||||
.It Ev XDG_RUNTIME_DIR
|
||||
A directory where temporary user files, such as the Wayland socket,
|
||||
are stored.
|
||||
.It Ev XDG_CONFIG_DIR
|
||||
A directory containung configuration of various programs and
|
||||
libraries, including libxkbcommon.
|
||||
.It Ev DISPLAY , WAYLAND_DISPLAY , WAYLAND_SOCKET
|
||||
Tell how to connect to an underlying X11 or Wayland server.
|
||||
.It Ev WLR_*
|
||||
Various variables specific to wlroots.
|
||||
.It Ev XKB_* , XLOCALEDIR , XCOMPOSEFILE
|
||||
Various variables specific to libxkbcommon.
|
||||
.It Ev XCURSOR_PATH
|
||||
List of directories to search for XCursor themes in.
|
||||
.It Ev HOME
|
||||
A directory where there are always dear files there for you.
|
||||
Waiting for you to clean them up.
|
||||
.El
|
||||
.Pp
|
||||
These are set by
|
||||
.Nm :
|
||||
.Bl -tag -width WAYLAND_DISPLAY
|
||||
.It Ev WAYLAND_DISPLAY
|
||||
Tell how to connect to
|
||||
.Nm .
|
||||
.It Ev DISPLAY
|
||||
If using
|
||||
.Nm Xwayland ,
|
||||
tell how to connect to the
|
||||
.Nm Xwayland
|
||||
server.
|
||||
.El
|
||||
.Sh EXAMPLES
|
||||
Start
|
||||
.Nm
|
||||
with s6 in the background:
|
||||
.Dl dwl -s 's6-svscan <&-'
|
||||
.Sh SEE ALSO
|
||||
.Xr foot 1 ,
|
||||
.Xr bemenu 1 ,
|
||||
.Xr dwm 1 ,
|
||||
.Xr xkeyboard-config 7
|
||||
.Sh CAVEATS
|
||||
The child process's standard input is connected with a pipe to
|
||||
.Nm .
|
||||
If the child process neither reads from the pipe nor closes its
|
||||
standard input,
|
||||
.Nm
|
||||
will freeze after a while due to it blocking when writing to the full
|
||||
pipe buffer.
|
||||
.Sh BUGS
|
||||
All of them.
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="idle">
|
||||
<copyright><![CDATA[
|
||||
Copyright (C) 2015 Martin Gräßlin
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
]]></copyright>
|
||||
<interface name="org_kde_kwin_idle" version="1">
|
||||
<description summary="User idle time manager">
|
||||
This interface allows to monitor user idle time on a given seat. The interface
|
||||
allows to register timers which trigger after no user activity was registered
|
||||
on the seat for a given interval. It notifies when user activity resumes.
|
||||
|
||||
This is useful for applications wanting to perform actions when the user is not
|
||||
interacting with the system, e.g. chat applications setting the user as away, power
|
||||
management features to dim screen, etc..
|
||||
</description>
|
||||
<request name="get_idle_timeout">
|
||||
<arg name="id" type="new_id" interface="org_kde_kwin_idle_timeout"/>
|
||||
<arg name="seat" type="object" interface="wl_seat"/>
|
||||
<arg name="timeout" type="uint" summary="The idle timeout in msec"/>
|
||||
</request>
|
||||
</interface>
|
||||
<interface name="org_kde_kwin_idle_timeout" version="1">
|
||||
<request name="release" type="destructor">
|
||||
<description summary="release the timeout object"/>
|
||||
</request>
|
||||
<request name="simulate_user_activity">
|
||||
<description summary="Simulates user activity for this timeout, behaves just like real user activity on the seat"/>
|
||||
</request>
|
||||
<event name="idle">
|
||||
<description summary="Triggered when there has not been any user activity in the requested idle time interval"/>
|
||||
</event>
|
||||
<event name="resumed">
|
||||
<description summary="Triggered on the first user activity after an idle event"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
35
util.c
Normal file
35
util.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* See LICENSE.dwm file for copyright and license details. */
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "util.h"
|
||||
|
||||
void
|
||||
die(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
|
||||
fputc(' ', stderr);
|
||||
perror(NULL);
|
||||
} else {
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (!(p = calloc(nmemb, size)))
|
||||
die("calloc:");
|
||||
return p;
|
||||
}
|
4
util.h
Normal file
4
util.h
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* See LICENSE.dwm file for copyright and license details. */
|
||||
|
||||
void die(const char *fmt, ...);
|
||||
void *ecalloc(size_t nmemb, size_t size);
|
Loading…
Reference in a new issue