Last active
March 22, 2025 11:49
-
-
Save lidgnulinux/d20ff34dbd65568ff7841566fdf73303 to your computer and use it in GitHub Desktop.
Vanity gaps & foreign toplevel management patch for dwl v0.7.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile b/Makefile | |
index 3358bae..9652529 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -21,7 +21,8 @@ dwl: dwl.o util.o | |
$(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ | |
dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \ | |
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \ | |
- wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h | |
+ wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \ | |
+ wlr-foreign-toplevel-management-unstable-v1-protocol.h | |
util.o: util.c util.h | |
# wayland-scanner is a tool which generates C headers and rigging for Wayland | |
@@ -45,6 +46,9 @@ wlr-output-power-management-unstable-v1-protocol.h: | |
xdg-shell-protocol.h: | |
$(WAYLAND_SCANNER) server-header \ | |
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@ | |
+wlr-foreign-toplevel-management-unstable-v1-protocol.h: | |
+ $(WAYLAND_SCANNER) server-header \ | |
+ protocols/wlr-foreign-toplevel-management-unstable-v1.xml $@ | |
config.h: | |
cp config.def.h $@ | |
diff --git a/config.def.h b/config.def.h | |
index 22d2171..5adfb77 100644 | |
--- a/config.def.h | |
+++ b/config.def.h | |
@@ -6,7 +6,13 @@ | |
/* 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 int smartgaps = 0; /* 1 means no outer gap when there is only one window */ | |
+static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */ | |
+static const unsigned int borderpx = 4; /* border pixel of windows */ | |
+static const unsigned int gappih = 5; /* horiz inner gap between windows */ | |
+static const unsigned int gappiv = 5; /* vert inner gap between windows */ | |
+static const unsigned int gappoh = 5; /* horiz outer gap between windows and screen edge */ | |
+static const unsigned int gappov = 5; /* vert outer gap between windows and screen edge */ | |
static const float rootcolor[] = COLOR(0x222222ff); | |
static const float bordercolor[] = COLOR(0x444444ff); | |
static const float focuscolor[] = COLOR(0x005577ff); | |
@@ -108,6 +114,7 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA | |
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */ | |
#define MODKEY WLR_MODIFIER_ALT | |
+#define MOD4KEY WLR_MODIFIER_LOGO | |
#define TAGKEYS(KEY,SKEY,TAG) \ | |
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \ | |
@@ -120,7 +127,7 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA | |
/* commands */ | |
static const char *termcmd[] = { "foot", NULL }; | |
-static const char *menucmd[] = { "wmenu-run", NULL }; | |
+static const char *menucmd[] = { "fuzzel", NULL }; | |
static const Key keys[] = { | |
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */ | |
@@ -133,6 +140,22 @@ static const Key keys[] = { | |
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} }, | |
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} }, | |
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} }, | |
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} }, | |
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} }, | |
+ { MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } }, | |
+ { MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } }, | |
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } }, | |
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } }, | |
{ MODKEY, XKB_KEY_Return, zoom, {0} }, | |
{ MODKEY, XKB_KEY_Tab, view, {0} }, | |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} }, | |
@@ -172,5 +195,5 @@ static const Key keys[] = { | |
static const Button buttons[] = { | |
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} }, | |
{ MODKEY, BTN_MIDDLE, togglefloating, {0} }, | |
- { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, | |
+ { MOD4KEY, BTN_LEFT, moveresize, {.ui = CurResize} }, | |
}; | |
diff --git a/dwl.c b/dwl.c | |
index a2711f6..94f60bf 100644 | |
--- a/dwl.c | |
+++ b/dwl.c | |
@@ -24,6 +24,7 @@ | |
#include <wlr/types/wlr_data_device.h> | |
#include <wlr/types/wlr_drm.h> | |
#include <wlr/types/wlr_export_dmabuf_v1.h> | |
+#include <wlr/types/wlr_foreign_toplevel_management_v1.h> | |
#include <wlr/types/wlr_fractional_scale_v1.h> | |
#include <wlr/types/wlr_gamma_control_v1.h> | |
#include <wlr/types/wlr_idle_inhibit_v1.h> | |
@@ -128,6 +129,11 @@ typedef struct { | |
struct wl_listener fullscreen; | |
struct wl_listener set_decoration_mode; | |
struct wl_listener destroy_decoration; | |
+ struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel; | |
+ struct wl_listener factivate; | |
+ struct wl_listener fclose; | |
+ struct wl_listener ffullscreen; | |
+ struct wl_listener fdestroy; | |
struct wlr_box prev; /* layout-relative, includes border */ | |
struct wlr_box bounds; | |
#ifdef XWAYLAND | |
@@ -200,6 +206,10 @@ struct Monitor { | |
struct wlr_box w; /* window area, layout-relative */ | |
struct wl_list layers[4]; /* LayerSurface.link */ | |
const Layout *lt[2]; | |
+ int gappih; /* horizontal gap between windows */ | |
+ int gappiv; /* vertical gap between windows */ | |
+ int gappoh; /* horizontal outer gaps */ | |
+ int gappov; /* vertical outer gaps */ | |
unsigned int seltags; | |
unsigned int sellt; | |
uint32_t tagset[2]; | |
@@ -273,6 +283,7 @@ static void createpopup(struct wl_listener *listener, void *data); | |
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint); | |
static void cursorframe(struct wl_listener *listener, void *data); | |
static void cursorwarptohint(void); | |
+static void defaultgaps(const Arg *arg); | |
static void destroydecoration(struct wl_listener *listener, void *data); | |
static void destroydragicon(struct wl_listener *listener, void *data); | |
static void destroyidleinhibitor(struct wl_listener *listener, void *data); | |
@@ -293,6 +304,13 @@ static void fullscreennotify(struct wl_listener *listener, void *data); | |
static void gpureset(struct wl_listener *listener, void *data); | |
static void handlesig(int signo); | |
static void incnmaster(const Arg *arg); | |
+static void incgaps(const Arg *arg); | |
+static void incigaps(const Arg *arg); | |
+static void incihgaps(const Arg *arg); | |
+static void incivgaps(const Arg *arg); | |
+static void incogaps(const Arg *arg); | |
+static void incohgaps(const Arg *arg); | |
+static void incovgaps(const Arg *arg); | |
static void inputdevice(struct wl_listener *listener, void *data); | |
static int keybinding(uint32_t mods, xkb_keysym_t sym); | |
static void keypress(struct wl_listener *listener, void *data); | |
@@ -327,6 +345,7 @@ static void setcursorshape(struct wl_listener *listener, void *data); | |
static void setfloating(Client *c, int floating); | |
static void setfullscreen(Client *c, int fullscreen); | |
static void setgamma(struct wl_listener *listener, void *data); | |
+static void setgaps(int oh, int ov, int ih, int iv); | |
static void setlayout(const Arg *arg); | |
static void setmfact(const Arg *arg); | |
static void setmon(Client *c, Monitor *m, uint32_t newtags); | |
@@ -340,6 +359,7 @@ static void tagmon(const Arg *arg); | |
static void tile(Monitor *m); | |
static void togglefloating(const Arg *arg); | |
static void togglefullscreen(const Arg *arg); | |
+static void togglegaps(const Arg *arg); | |
static void toggletag(const Arg *arg); | |
static void toggleview(const Arg *arg); | |
static void unlocksession(struct wl_listener *listener, void *data); | |
@@ -355,6 +375,11 @@ static Monitor *xytomon(double x, double y); | |
static void xytonode(double x, double y, struct wlr_surface **psurface, | |
Client **pc, LayerSurface **pl, double *nx, double *ny); | |
static void zoom(const Arg *arg); | |
+static void createforeigntoplevel(Client *c); | |
+static void factivatenotify(struct wl_listener *listener, void *data); | |
+static void fclosenotify(struct wl_listener *listener, void *data); | |
+static void fdestroynotify(struct wl_listener *listener, void *data); | |
+static void ffullscreennotify(struct wl_listener *listener, void *data); | |
/* variables */ | |
static const char broken[] = "broken"; | |
@@ -402,6 +427,8 @@ static struct wlr_scene_rect *locked_bg; | |
static struct wlr_session_lock_v1 *cur_lock; | |
static struct wl_listener lock_listener = {.notify = locksession}; | |
+static struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_mgr; | |
+ | |
static struct wlr_seat *seat; | |
static KeyboardGroup *kb_group; | |
static unsigned int cursor_mode; | |
@@ -413,6 +440,8 @@ static struct wlr_box sgeom; | |
static struct wl_list mons; | |
static Monitor *selmon; | |
+static int enablegaps = 1; /* enables gaps, used by togglegaps */ | |
+ | |
#ifdef XWAYLAND | |
static void activatex11(struct wl_listener *listener, void *data); | |
static void associatex11(struct wl_listener *listener, void *data); | |
@@ -466,6 +495,11 @@ applyrules(Client *c) | |
if (!(title = client_get_title(c))) | |
title = broken; | |
+ if (c->foreign_toplevel) { | |
+ wlr_foreign_toplevel_handle_v1_set_app_id(c->foreign_toplevel, appid); | |
+ wlr_foreign_toplevel_handle_v1_set_title(c->foreign_toplevel, title); | |
+ } | |
+ | |
for (r = rules; r < END(rules); r++) { | |
if ((!r->title || strstr(title, r->title)) | |
&& (!r->id || strstr(appid, r->id))) { | |
@@ -989,6 +1023,11 @@ createmon(struct wl_listener *listener, void *data) | |
for (i = 0; i < LENGTH(m->layers); i++) | |
wl_list_init(&m->layers[i]); | |
+ m->gappih = gappih; | |
+ m->gappiv = gappiv; | |
+ m->gappoh = gappoh; | |
+ m->gappov = gappov; | |
+ | |
wlr_output_state_init(&state); | |
/* Initialize monitor state using configured rules */ | |
m->tagset[0] = m->tagset[1] = 1; | |
@@ -1171,6 +1210,12 @@ cursorwarptohint(void) | |
} | |
} | |
+void | |
+defaultgaps(const Arg *arg) | |
+{ | |
+ setgaps(gappoh, gappov, gappih, gappiv); | |
+} | |
+ | |
void | |
destroydecoration(struct wl_listener *listener, void *data) | |
{ | |
@@ -1391,6 +1436,8 @@ focusclient(Client *c, int lift) | |
client_set_border_color(old_c, bordercolor); | |
client_activate_surface(old, 0); | |
+ if (old_c->foreign_toplevel) | |
+ wlr_foreign_toplevel_handle_v1_set_activated(old_c->foreign_toplevel, 0); | |
} | |
} | |
printstatus(); | |
@@ -1409,6 +1456,8 @@ focusclient(Client *c, int lift) | |
/* Activate the new client */ | |
client_activate_surface(client_surface(c), 1); | |
+ if (c->foreign_toplevel) | |
+ wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, 1); | |
} | |
void | |
@@ -1524,6 +1573,83 @@ incnmaster(const Arg *arg) | |
arrange(selmon); | |
} | |
+void | |
+incgaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh + arg->i, | |
+ selmon->gappov + arg->i, | |
+ selmon->gappih + arg->i, | |
+ selmon->gappiv + arg->i | |
+ ); | |
+} | |
+ | |
+void | |
+incigaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh, | |
+ selmon->gappov, | |
+ selmon->gappih + arg->i, | |
+ selmon->gappiv + arg->i | |
+ ); | |
+} | |
+ | |
+void | |
+incihgaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh, | |
+ selmon->gappov, | |
+ selmon->gappih + arg->i, | |
+ selmon->gappiv | |
+ ); | |
+} | |
+ | |
+void | |
+incivgaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh, | |
+ selmon->gappov, | |
+ selmon->gappih, | |
+ selmon->gappiv + arg->i | |
+ ); | |
+} | |
+ | |
+void | |
+incogaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh + arg->i, | |
+ selmon->gappov + arg->i, | |
+ selmon->gappih, | |
+ selmon->gappiv | |
+ ); | |
+} | |
+ | |
+void | |
+incohgaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh + arg->i, | |
+ selmon->gappov, | |
+ selmon->gappih, | |
+ selmon->gappiv | |
+ ); | |
+} | |
+ | |
+void | |
+incovgaps(const Arg *arg) | |
+{ | |
+ setgaps( | |
+ selmon->gappoh, | |
+ selmon->gappov + arg->i, | |
+ selmon->gappih, | |
+ selmon->gappiv | |
+ ); | |
+} | |
+ | |
void | |
inputdevice(struct wl_listener *listener, void *data) | |
{ | |
@@ -1719,6 +1845,8 @@ mapnotify(struct wl_listener *listener, void *data) | |
c->border[i]->node.data = c; | |
} | |
+ createforeigntoplevel(c); | |
+ | |
/* Initialize client geometry with room for border */ | |
client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | WLR_EDGE_RIGHT); | |
c->geom.width += 2 * c->bw; | |
@@ -1775,8 +1903,12 @@ monocle(Monitor *m) | |
wl_list_for_each(c, &clients, link) { | |
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) | |
continue; | |
- resize(c, m->w, 0); | |
n++; | |
+ if (!monoclegaps) | |
+ resize(c, m->w, 0); | |
+ else | |
+ resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov, | |
+ .width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0); | |
} | |
if (n) | |
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); | |
@@ -2352,6 +2484,16 @@ setgamma(struct wl_listener *listener, void *data) | |
wlr_output_schedule_frame(m->wlr_output); | |
} | |
+void | |
+setgaps(int oh, int ov, int ih, int iv) | |
+{ | |
+ selmon->gappoh = MAX(oh, 0); | |
+ selmon->gappov = MAX(ov, 0); | |
+ selmon->gappih = MAX(ih, 0); | |
+ selmon->gappiv = MAX(iv, 0); | |
+ arrange(selmon); | |
+} | |
+ | |
void | |
setlayout(const Arg *arg) | |
{ | |
@@ -2392,12 +2534,17 @@ setmon(Client *c, Monitor *m, uint32_t newtags) | |
c->prev = c->geom; | |
/* Scene graph sends surface leave/enter events on move and resize */ | |
- if (oldmon) | |
+ if (oldmon) { | |
+ if (c->foreign_toplevel) | |
+ wlr_foreign_toplevel_handle_v1_output_leave(c->foreign_toplevel, oldmon->wlr_output); | |
arrange(oldmon); | |
+ } | |
if (m) { | |
/* Make sure window actually overlaps with the monitor */ | |
resize(c, c->geom, 0); | |
c->tags = newtags ? newtags : m->tagset[m->seltags]; /* assign tags of target monitor */ | |
+ if (c->foreign_toplevel) | |
+ wlr_foreign_toplevel_handle_v1_output_enter(c->foreign_toplevel, m->wlr_output); | |
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */ | |
setfloating(c, c->isfloating); | |
} | |
@@ -2512,6 +2659,9 @@ setup(void) | |
gamma_control_mgr = wlr_gamma_control_manager_v1_create(dpy); | |
LISTEN_STATIC(&gamma_control_mgr->events.set_gamma, setgamma); | |
+ /* Initializes foreign toplevel management */ | |
+ foreign_toplevel_mgr = wlr_foreign_toplevel_manager_v1_create(dpy); | |
+ | |
power_mgr = wlr_output_power_manager_v1_create(dpy); | |
LISTEN_STATIC(&power_mgr->events.set_mode, powermgrsetmode); | |
@@ -2691,7 +2841,7 @@ tagmon(const Arg *arg) | |
void | |
tile(Monitor *m) | |
{ | |
- unsigned int mw, my, ty; | |
+ unsigned int mw, my, ty, h, r, oe = enablegaps, ie = enablegaps; | |
int i, n = 0; | |
Client *c; | |
@@ -2701,22 +2851,31 @@ tile(Monitor *m) | |
if (n == 0) | |
return; | |
+ if (smartgaps == n) { | |
+ oe = 0; // outer gaps disabled | |
+ } | |
+ | |
if (n > m->nmaster) | |
- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0; | |
+ mw = m->nmaster ? (int)roundf((m->w.width + m->gappiv*ie) * m->mfact) : 0; | |
else | |
- mw = m->w.width; | |
- i = my = ty = 0; | |
+ mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie; | |
+ i = 0; | |
+ my = ty = m->gappoh*oe; | |
wl_list_for_each(c, &clients, link) { | |
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen) | |
continue; | |
if (i < m->nmaster) { | |
- resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw, | |
- .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0); | |
- my += c->geom.height; | |
+ r = MIN(n, m->nmaster) - i; | |
+ h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; | |
+ resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my, | |
+ .width = mw - m->gappiv*ie, .height = h}, 0); | |
+ my += c->geom.height + m->gappih*ie; | |
} else { | |
- resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty, | |
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0); | |
- ty += c->geom.height; | |
+ r = n - i; | |
+ h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r; | |
+ resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty, | |
+ .width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0); | |
+ ty += c->geom.height + m->gappih*ie; | |
} | |
i++; | |
} | |
@@ -2739,6 +2898,13 @@ togglefullscreen(const Arg *arg) | |
setfullscreen(sel, !sel->isfullscreen); | |
} | |
+void | |
+togglegaps(const Arg *arg) | |
+{ | |
+ enablegaps = !enablegaps; | |
+ arrange(selmon); | |
+} | |
+ | |
void | |
toggletag(const Arg *arg) | |
{ | |
@@ -2810,6 +2976,11 @@ unmapnotify(struct wl_listener *listener, void *data) | |
wl_list_remove(&c->flink); | |
} | |
+ if (c->foreign_toplevel) { | |
+ wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel); | |
+ c->foreign_toplevel = NULL; | |
+ } | |
+ | |
wlr_scene_node_destroy(&c->scene->node); | |
printstatus(); | |
motionnotify(0, NULL, 0, 0, 0, 0); | |
@@ -2925,6 +3096,12 @@ void | |
updatetitle(struct wl_listener *listener, void *data) | |
{ | |
Client *c = wl_container_of(listener, c, set_title); | |
+ if (c->foreign_toplevel) { | |
+ const char *title; | |
+ if (!(title = client_get_title(c))) | |
+ title = broken; | |
+ wlr_foreign_toplevel_handle_v1_set_title(c->foreign_toplevel, title); | |
+ } | |
if (c == focustop(c->mon)) | |
printstatus(); | |
} | |
@@ -3054,6 +3231,54 @@ zoom(const Arg *arg) | |
arrange(selmon); | |
} | |
+void | |
+createforeigntoplevel(Client *c) | |
+{ | |
+ c->foreign_toplevel = wlr_foreign_toplevel_handle_v1_create(foreign_toplevel_mgr); | |
+ | |
+ LISTEN(&c->foreign_toplevel->events.request_activate, &c->factivate, factivatenotify); | |
+ LISTEN(&c->foreign_toplevel->events.request_close, &c->fclose, fclosenotify); | |
+ LISTEN(&c->foreign_toplevel->events.request_fullscreen, &c->ffullscreen, ffullscreennotify); | |
+ LISTEN(&c->foreign_toplevel->events.destroy, &c->fdestroy, fdestroynotify); | |
+} | |
+ | |
+void | |
+factivatenotify(struct wl_listener *listener, void *data) | |
+{ | |
+ Client *c = wl_container_of(listener, c, factivate); | |
+ if (c->mon == selmon) { | |
+ c->tags = c->mon->tagset[c->mon->seltags]; | |
+ } else { | |
+ setmon(c, selmon, 0); | |
+ } | |
+ focusclient(c, 1); | |
+ arrange(c->mon); | |
+} | |
+ | |
+void | |
+fclosenotify(struct wl_listener *listener, void *data) | |
+{ | |
+ Client *c = wl_container_of(listener, c, fclose); | |
+ client_send_close(c); | |
+} | |
+ | |
+void | |
+ffullscreennotify(struct wl_listener *listener, void *data) { | |
+ Client *c = wl_container_of(listener, c, ffullscreen); | |
+ struct wlr_foreign_toplevel_handle_v1_fullscreen_event *event = data; | |
+ setfullscreen(c, event->fullscreen); | |
+} | |
+ | |
+void | |
+fdestroynotify(struct wl_listener *listener, void *data) | |
+{ | |
+ Client *c = wl_container_of(listener, c, fdestroy); | |
+ wl_list_remove(&c->factivate.link); | |
+ wl_list_remove(&c->fclose.link); | |
+ wl_list_remove(&c->ffullscreen.link); | |
+ wl_list_remove(&c->fdestroy.link); | |
+} | |
+ | |
#ifdef XWAYLAND | |
void | |
activatex11(struct wl_listener *listener, void *data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<protocol name="wlr_output_power_management_unstable_v1"> | |
<copyright> | |
Copyright © 2019 Purism SPC | |
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 (including the next | |
paragraph) 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. | |
</copyright> | |
<description summary="Control power management modes of outputs"> | |
This protocol allows clients to control power management modes | |
of outputs that are currently part of the compositor space. The | |
intent is to allow special clients like desktop shells to power | |
down outputs when the system is idle. | |
To modify outputs not currently part of the compositor space see | |
wlr-output-management. | |
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="zwlr_output_power_manager_v1" version="1"> | |
<description summary="manager to create per-output power management"> | |
This interface is a manager that allows creating per-output power | |
management mode controls. | |
</description> | |
<request name="get_output_power"> | |
<description summary="get a power management for an output"> | |
Create a output power management mode control that can be used to | |
adjust the power management mode for a given output. | |
</description> | |
<arg name="id" type="new_id" interface="zwlr_output_power_v1"/> | |
<arg name="output" type="object" interface="wl_output"/> | |
</request> | |
<request name="destroy" type="destructor"> | |
<description summary="destroy the manager"> | |
All objects created by the manager will still remain valid, until their | |
appropriate destroy request has been called. | |
</description> | |
</request> | |
</interface> | |
<interface name="zwlr_output_power_v1" version="1"> | |
<description summary="adjust power management mode for an output"> | |
This object offers requests to set the power management mode of | |
an output. | |
</description> | |
<enum name="mode"> | |
<entry name="off" value="0" | |
summary="Output is turned off."/> | |
<entry name="on" value="1" | |
summary="Output is turned on, no power saving"/> | |
</enum> | |
<enum name="error"> | |
<entry name="invalid_mode" value="1" summary="inexistent power save mode"/> | |
</enum> | |
<request name="set_mode"> | |
<description summary="Set an outputs power save mode"> | |
Set an output's power save mode to the given mode. The mode change | |
is effective immediately. If the output does not support the given | |
mode a failed event is sent. | |
</description> | |
<arg name="mode" type="uint" enum="mode" summary="the power save mode to set"/> | |
</request> | |
<event name="mode"> | |
<description summary="Report a power management mode change"> | |
Report the power management mode change of an output. | |
The mode event is sent after an output changed its power | |
management mode. The reason can be a client using set_mode or the | |
compositor deciding to change an output's mode. | |
This event is also sent immediately when the object is created | |
so the client is informed about the current power management mode. | |
</description> | |
<arg name="mode" type="uint" enum="mode" | |
summary="the output's new power management mode"/> | |
</event> | |
<event name="failed"> | |
<description summary="object no longer valid"> | |
This event indicates that the output power management mode control | |
is no longer valid. This can happen for a number of reasons, | |
including: | |
- The output doesn't support power management | |
- Another client already has exclusive power management mode control | |
for this output | |
- The output disappeared | |
Upon receiving this event, the client should destroy this object. | |
</description> | |
</event> | |
<request name="destroy" type="destructor"> | |
<description summary="destroy this power management"> | |
Destroys the output power management mode control object. | |
</description> | |
</request> | |
</interface> | |
</protocol> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Version=1.0 | |
Name=Xfce Session (Wayland with dwl) | |
Comment=Use this session to run Xfce as your desktop environment | |
Exec=/usr/bin/dwl -s /usr/bin/xfce4-session | |
Icon= | |
Type=Application | |
DesktopNames=XFCE | |
Keywords=xfce;wayland;desktop;environment;session; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Additional window(s) rule.