mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-26 19:26:32 +00:00
Merge branch 'xdg-activation' into wlroots-next
This commit is contained in:
commit
f9f3f3432b
2 changed files with 43 additions and 11 deletions
|
@ -15,6 +15,7 @@ dwl is not meant to provide every feature under the sun. Instead, like dwm, it s
|
||||||
- Configurable multi-monitor layout support, including position and rotation
|
- Configurable multi-monitor layout support, including position and rotation
|
||||||
- Configurable HiDPI/multi-DPI support
|
- Configurable HiDPI/multi-DPI support
|
||||||
- Provide information to external status bars via stdout/stdin
|
- Provide information to external status bars via stdout/stdin
|
||||||
|
- Urgency hints via xdg-activate protocol
|
||||||
- Various Wayland protocols
|
- Various Wayland protocols
|
||||||
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
|
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
|
||||||
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
|
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
|
||||||
|
@ -22,7 +23,6 @@ dwl is not meant to provide every feature under the sun. Instead, like dwm, it s
|
||||||
Features under consideration (possibly as patches) are:
|
Features under consideration (possibly as patches) are:
|
||||||
|
|
||||||
- Protocols made trivial by wlroots
|
- Protocols made trivial by wlroots
|
||||||
- Implement urgent/focus-request once the xdg-activation protocol [hits wlroots](https://github.com/swaywm/wlroots/pull/2718)
|
|
||||||
- Implement the input-inhibitor protocol to support screen lockers
|
- Implement the input-inhibitor protocol to support screen lockers
|
||||||
- Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring
|
- Implement the idle-inhibit protocol which lets applications such as mpv disable idle monitoring
|
||||||
- Layer shell popups (used by Waybar)
|
- Layer shell popups (used by Waybar)
|
||||||
|
@ -38,7 +38,7 @@ Feature *non-goals* for the main codebase include:
|
||||||
|
|
||||||
## Building dwl
|
## 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`.
|
To enable XWayland, you should also install xorg-xwayland and uncomment its flag in `config.mk`.
|
||||||
|
|
||||||
|
|
50
dwl.c
50
dwl.c
|
@ -37,6 +37,7 @@
|
||||||
#include <wlr/types/wlr_viewporter.h>
|
#include <wlr/types/wlr_viewporter.h>
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
|
#include <wlr/types/wlr_xdg_activation_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
|
@ -107,7 +108,7 @@ typedef struct {
|
||||||
#endif
|
#endif
|
||||||
int bw;
|
int bw;
|
||||||
unsigned int tags;
|
unsigned int tags;
|
||||||
int isfloating;
|
int isfloating, isurgent;
|
||||||
uint32_t resize; /* configure serial of a pending resize */
|
uint32_t resize; /* configure serial of a pending resize */
|
||||||
int prevx;
|
int prevx;
|
||||||
int prevy;
|
int prevy;
|
||||||
|
@ -291,6 +292,7 @@ static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
static void unmapnotify(struct wl_listener *listener, void *data);
|
static void unmapnotify(struct wl_listener *listener, void *data);
|
||||||
static void updatemons(struct wl_listener *listener, void *data);
|
static void updatemons(struct wl_listener *listener, void *data);
|
||||||
static void updatetitle(struct wl_listener *listener, void *data);
|
static void updatetitle(struct wl_listener *listener, void *data);
|
||||||
|
static void urgent(struct wl_listener *listener, void *data);
|
||||||
static void view(const Arg *arg);
|
static void view(const Arg *arg);
|
||||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||||
static Client *xytoclient(double x, double y);
|
static Client *xytoclient(double x, double y);
|
||||||
|
@ -307,6 +309,7 @@ static struct wlr_renderer *drw;
|
||||||
static struct wlr_compositor *compositor;
|
static struct wlr_compositor *compositor;
|
||||||
|
|
||||||
static struct wlr_xdg_shell *xdg_shell;
|
static struct wlr_xdg_shell *xdg_shell;
|
||||||
|
static struct wlr_xdg_activation_v1 *activation;
|
||||||
static struct wl_list clients; /* tiling order */
|
static struct wl_list clients; /* tiling order */
|
||||||
static struct wl_list fstack; /* focus order */
|
static struct wl_list fstack; /* focus order */
|
||||||
static struct wl_list stack; /* stacking z-order */
|
static struct wl_list stack; /* stacking z-order */
|
||||||
|
@ -348,6 +351,7 @@ static struct wl_listener new_xdg_surface = {.notify = createnotify};
|
||||||
static struct wl_listener new_layer_shell_surface = {.notify = createlayersurface};
|
static struct wl_listener new_layer_shell_surface = {.notify = createlayersurface};
|
||||||
static struct wl_listener output_mgr_apply = {.notify = outputmgrapply};
|
static struct wl_listener output_mgr_apply = {.notify = outputmgrapply};
|
||||||
static struct wl_listener output_mgr_test = {.notify = outputmgrtest};
|
static struct wl_listener output_mgr_test = {.notify = outputmgrtest};
|
||||||
|
static struct wl_listener request_activate = {.notify = urgent};
|
||||||
static struct wl_listener request_cursor = {.notify = setcursor};
|
static struct wl_listener request_cursor = {.notify = setcursor};
|
||||||
static struct wl_listener request_set_psel = {.notify = setpsel};
|
static struct wl_listener request_set_psel = {.notify = setpsel};
|
||||||
static struct wl_listener request_set_sel = {.notify = setsel};
|
static struct wl_listener request_set_sel = {.notify = setsel};
|
||||||
|
@ -1077,6 +1081,7 @@ focusclient(Client *c, int lift)
|
||||||
wl_list_remove(&c->flink);
|
wl_list_remove(&c->flink);
|
||||||
wl_list_insert(&fstack, &c->flink);
|
wl_list_insert(&fstack, &c->flink);
|
||||||
selmon = c->mon;
|
selmon = c->mon;
|
||||||
|
c->isurgent = 0;
|
||||||
}
|
}
|
||||||
printstatus();
|
printstatus();
|
||||||
|
|
||||||
|
@ -1552,22 +1557,29 @@ void
|
||||||
printstatus(void)
|
printstatus(void)
|
||||||
{
|
{
|
||||||
Monitor *m = NULL;
|
Monitor *m = NULL;
|
||||||
Client *c = NULL;
|
Client *c;
|
||||||
unsigned int activetags;
|
unsigned int occ, urg, sel;
|
||||||
|
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(m, &mons, link) {
|
||||||
activetags=0;
|
occ = urg = 0;
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->mon == m)
|
if (c->mon != m)
|
||||||
activetags |= c->tags;
|
continue;
|
||||||
|
occ |= c->tags;
|
||||||
|
if (c->isurgent)
|
||||||
|
urg |= c->tags;
|
||||||
}
|
}
|
||||||
if (focustop(m))
|
if ((c = focustop(m))) {
|
||||||
printf("%s title %s\n", m->wlr_output->name, client_get_title(focustop(m)));
|
printf("%s title %s\n", m->wlr_output->name, client_get_title(focustop(m)));
|
||||||
else
|
sel = c->tags;
|
||||||
|
} else {
|
||||||
printf("%s title \n", m->wlr_output->name);
|
printf("%s title \n", m->wlr_output->name);
|
||||||
|
sel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
||||||
printf("%s tags %u %u\n", m->wlr_output->name, activetags, m->tagset[m->seltags]);
|
printf("%s tags %u %u %u %u\n", m->wlr_output->name, occ, m->tagset[m->seltags],
|
||||||
|
sel, urg);
|
||||||
printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol);
|
printf("%s layout %s\n", m->wlr_output->name, m->lt[m->sellt]->symbol);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
@ -1819,6 +1831,7 @@ run(char *startup_cmd)
|
||||||
}
|
}
|
||||||
/* If nobody is reading the status output, don't terminate */
|
/* If nobody is reading the status output, don't terminate */
|
||||||
signal(SIGPIPE, SIG_IGN);
|
signal(SIGPIPE, SIG_IGN);
|
||||||
|
printstatus();
|
||||||
|
|
||||||
/* Start the backend. This will enumerate outputs and inputs, become the DRM
|
/* Start the backend. This will enumerate outputs and inputs, become the DRM
|
||||||
* master, etc */
|
* master, etc */
|
||||||
|
@ -2009,6 +2022,10 @@ setup(void)
|
||||||
wlr_primary_selection_v1_device_manager_create(dpy);
|
wlr_primary_selection_v1_device_manager_create(dpy);
|
||||||
wlr_viewporter_create(dpy);
|
wlr_viewporter_create(dpy);
|
||||||
|
|
||||||
|
/* Initializes the interface used to implement urgency hints */
|
||||||
|
activation = wlr_xdg_activation_v1_create(dpy);
|
||||||
|
wl_signal_add(&activation->events.request_activate, &request_activate);
|
||||||
|
|
||||||
/* Creates an output layout, which a wlroots utility for working with an
|
/* Creates an output layout, which a wlroots utility for working with an
|
||||||
* arrangement of screens in a physical layout. */
|
* arrangement of screens in a physical layout. */
|
||||||
output_layout = wlr_output_layout_create();
|
output_layout = wlr_output_layout_create();
|
||||||
|
@ -2322,6 +2339,21 @@ updatetitle(struct wl_listener *listener, void *data)
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
urgent(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct wlr_xdg_activation_v1_request_activate_event *event = data;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if (!wlr_surface_is_xdg_surface(event->surface))
|
||||||
|
return;
|
||||||
|
c = wlr_xdg_surface_from_wlr_surface(event->surface)->data;
|
||||||
|
if (c != selclient()) {
|
||||||
|
c->isurgent = 1;
|
||||||
|
printstatus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
view(const Arg *arg)
|
view(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue