mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-10-26 17:54:14 +00:00
Merge remote-tracking branch 'djpohly/main' into input-protocol
This commit is contained in:
commit
49b8591b3a
21
README.md
21
README.md
@ -38,7 +38,7 @@ Feature *non-goals* for the main codebase include:
|
||||
|
||||
## Building dwl
|
||||
|
||||
dwl has only two dependencies: wlroots-git and wayland-protocols. Simply install these (and their `-devel` versions if your distro has separate development packages) and run `make`.
|
||||
dwl has only two dependencies: wlroots and wayland-protocols. Simply install these (and their `-devel` versions if your distro has separate development packages) and run `make`. If you wish to build against a Git version of wlroots, check out the [wlroots-next branch](https://github.com/djpohly/dwl/tree/wlroots-next).
|
||||
|
||||
To enable XWayland, you should also install xorg-xwayland and uncomment its flag in `config.mk`.
|
||||
|
||||
@ -50,14 +50,27 @@ As in the dwm community, we encourage users to share patches they have created.
|
||||
|
||||
## Running dwl
|
||||
|
||||
dwl can be run as-is, with no arguments. In an existing Wayland or X11 session, this will open a window to act as a virtual display. When run from a TTY, the Wayland server will take over the entire virtual terminal. Clients started by dwl will have `WAYLAND_DISPLAY` set in their environment, and other clients can be started from outside the session by setting this variable accordingly.
|
||||
dwl can be run on any of the backends supported by wlroots. This means you can run it as a separate window inside either an X11 or Wayland session, as well as directly from a VT console. Depending on your distro's setup, you may need to add your user to the `video` and `input` groups before you can run dwl on a VT.
|
||||
|
||||
You can also specify a startup program using the `-s` option. The argument to this option will be run at startup as a shell command (using `sh -c`) and can serve a similar function to `.xinitrc`: starting a service manager or other startup applications. Unlike `.xinitrc`, the display server will not shut down when this process terminates. Instead, as dwl is shutting down, it will send this process a SIGTERM and wait for it to terminate (if it hasn't already). This makes it ideal not only for initialization but also for execing into a user-level service manager like s6 or `systemd --user`.
|
||||
When dwl is run with no arguments, it will launch the server and begin handling any shortcuts configured in `config.h`. There is no status bar or other decoration initially; these are instead clients that can be run within the Wayland session.
|
||||
|
||||
Note: Wayland requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager such as `elogind` or `systemd-logind`. If your system doesn't do this automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
If you would like to run a script or command automatically at startup, you can specify the command using the `-s` option. This command will be executed as a shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`, but differs in that the display server will not shut down when this process terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait for it to terminate (if it hasn't already). This makes it ideal for execing into a user service manager like [s6](https://skarnet.org/software/s6/), [anopa](https://jjacky.com/anopa/), [runit](http://smarden.org/runit/faq.html#userservices), or [`systemd --user`](https://wiki.archlinux.org/title/Systemd/User).
|
||||
|
||||
Note: The `-s` command is run as a *child process* of dwl, which means that it does not have the ability to affect the environment of dwl or of any processes that it spawns. If you need to set environment variables that affect the entire dwl session, these must be set prior to running dwl. For example, Wayland requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager such as `elogind` or `systemd-logind`. If your system doesn't do this automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||
|
||||
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-$(id -u)
|
||||
mkdir -p $XDG_RUNTIME_DIR
|
||||
dwl
|
||||
|
||||
### Status information
|
||||
|
||||
Information about selected layouts, current window title, and selected/occupied/urgent tags is written to the stdin of the `-s` command (see the `printstatus()` function for details). This information can be used to populate an external status bar with a script that parses the information. Failing to read this information will cause dwl to block, so if you do want to run a startup command that does not consume the status information, you can close standard input with the `<&-` shell redirection, for example:
|
||||
|
||||
dwl -s 'foot --server <&-'
|
||||
|
||||
If your startup command is a shell script, you can achieve the same inside the script with the line
|
||||
|
||||
exec <&-
|
||||
|
||||
## Replacements for X applications
|
||||
|
||||
|
||||
27
dwl.c
27
dwl.c
@ -31,6 +31,7 @@
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_output_management_v1.h>
|
||||
#include <wlr/types/wlr_pointer.h>
|
||||
#include <wlr/types/wlr_presentation_time.h>
|
||||
#include <wlr/types/wlr_primary_selection.h>
|
||||
#include <wlr/types/wlr_primary_selection_v1.h>
|
||||
#include <wlr/types/wlr_screencopy_v1.h>
|
||||
@ -396,14 +397,11 @@ static struct wl_list input_popups; /* dwl_input_popup::view_link to be rendered
|
||||
static struct wlr_idle *idle;
|
||||
static struct wlr_layer_shell_v1 *layer_shell;
|
||||
static struct wlr_output_manager_v1 *output_mgr;
|
||||
static struct wlr_presentation *presentation;
|
||||
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||
|
||||
static struct wlr_cursor *cursor;
|
||||
static struct wlr_xcursor_manager *cursor_mgr;
|
||||
#ifdef XWAYLAND
|
||||
static struct wlr_xcursor *xcursor;
|
||||
static struct wlr_xcursor_manager *xcursor_mgr;
|
||||
#endif
|
||||
|
||||
static struct wlr_seat *seat;
|
||||
struct wlr_input_method_manager_v2 *input_method_manager;
|
||||
@ -873,7 +871,7 @@ createkeyboard(struct wlr_input_device *device)
|
||||
|
||||
/* Prepare an XKB keymap and assign it to the keyboard. */
|
||||
context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
keymap = xkb_map_new_from_names(context, &xkb_rules,
|
||||
keymap = xkb_keymap_new_from_names(context, &xkb_rules,
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
|
||||
wlr_keyboard_set_keymap(device->keyboard, keymap);
|
||||
@ -1171,7 +1169,6 @@ focusclient(Client *c, int lift)
|
||||
selmon = c->mon;
|
||||
c->isurgent = 0;
|
||||
}
|
||||
printstatus();
|
||||
|
||||
/* Deactivate old client if focus is changing */
|
||||
if (old && (!c || client_surface(c) != old)) {
|
||||
@ -1194,6 +1191,8 @@ focusclient(Client *c, int lift)
|
||||
}
|
||||
}
|
||||
|
||||
printstatus();
|
||||
|
||||
if (!c) {
|
||||
/* With no client, all we have left is to clear focus */
|
||||
wlr_seat_keyboard_notify_clear_focus(seat);
|
||||
@ -1811,6 +1810,8 @@ render(struct wlr_surface *surface, int sx, int sy, void *data)
|
||||
/* This lets the client know that we've displayed that frame and it can
|
||||
* prepare another one now if it likes. */
|
||||
wlr_surface_send_frame_done(surface, rdata->when);
|
||||
|
||||
wlr_presentation_surface_sampled_on_output(presentation, surface, output);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2866,6 +2867,8 @@ setup(void)
|
||||
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
||||
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
||||
|
||||
presentation = wlr_presentation_create(dpy, backend);
|
||||
|
||||
/* create text_input-, and input_method-protocol relevant globals */
|
||||
input_method_manager = wlr_input_method_manager_v2_create(dpy);
|
||||
text_input_manager = wlr_text_input_manager_v3_create(dpy);
|
||||
@ -2883,18 +2886,6 @@ setup(void)
|
||||
wl_signal_add(&xwayland->events.ready, &xwayland_ready);
|
||||
wl_signal_add(&xwayland->events.new_surface, &new_xwayland_surface);
|
||||
|
||||
/*
|
||||
* Create the XWayland cursor manager at scale 1, setting its default
|
||||
* pointer to match the rest of dwl.
|
||||
*/
|
||||
xcursor_mgr = wlr_xcursor_manager_create(NULL, 24);
|
||||
wlr_xcursor_manager_load(xcursor_mgr, 1);
|
||||
if ((xcursor = wlr_xcursor_manager_get_xcursor(xcursor_mgr, "left_ptr", 1)))
|
||||
wlr_xwayland_set_cursor(xwayland,
|
||||
xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
|
||||
xcursor->images[0]->width, xcursor->images[0]->height,
|
||||
xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
|
||||
|
||||
setenv("DISPLAY", xwayland->display_name, 1);
|
||||
} else {
|
||||
fprintf(stderr, "failed to setup XWayland X server, continuing without it\n");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user