Compare commits
10 Commits
d29062d6bf
...
3298080ded
Author | SHA1 | Date | |
---|---|---|---|
|
3298080ded | ||
|
8c9439a119 | ||
|
a40b099a8e | ||
|
9775f02d0c | ||
|
5867d3723d | ||
|
c5e2aa5f75 | ||
|
d07f77114b | ||
|
3dfb6453ef | ||
|
2d730ee55d | ||
|
31dfbcf09b |
18
Makefile
18
Makefile
@@ -17,12 +17,15 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
|
||||
|
||||
all: dwl
|
||||
dwl: dwl.o util.o
|
||||
$(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o
|
||||
$(CC) dwl.o util.o dwl-ipc-unstable-v2-protocol.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
dwl.o: dwl.c client.h config.h config.mk patches.h 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-foreign-toplevel-management-unstable-v1-protocol.h \
|
||||
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-protocol.h \
|
||||
dwl-ipc-unstable-v2-protocol.h
|
||||
util.o: util.c util.h
|
||||
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c dwl-ipc-unstable-v2-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
|
||||
@@ -45,6 +48,15 @@ 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 $@
|
||||
dwl-ipc-unstable-v2-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header \
|
||||
protocols/dwl-ipc-unstable-v2.xml $@
|
||||
dwl-ipc-unstable-v2-protocol.c:
|
||||
$(WAYLAND_SCANNER) private-code \
|
||||
protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
|
106
README.org
106
README.org
@@ -9,13 +9,20 @@
|
||||
- [[#patches][Patches]]
|
||||
- [[#attach-top][Attach Top]]
|
||||
- [[#auto-start][Auto Start]]
|
||||
- [[#foreign-toplevel-management][Foreign Toplevel Management]]
|
||||
- [[#ipc][IPC]]
|
||||
- [[#natural-scroll-trackpad][Natural Scroll Trackpad]]
|
||||
- [[#numlock-capslock][Numlock Capslock]]
|
||||
- [[#per-tag][Per Tag]]
|
||||
- [[#restore-monitor][Restore Monitor]]
|
||||
- [[#setup-env][Setup Env]]
|
||||
- [[#vanity-gaps][Vanity Gaps]]
|
||||
- [[#warp-cursor][Warp Cursor]]
|
||||
- [[#dwl-configuration][dwl Configuration]]
|
||||
- [[#appearance][Appearance]]
|
||||
- [[#tagging][Tagging]]
|
||||
- [[#logging][Logging]]
|
||||
- [[#environment-variables][Environment Variables]]
|
||||
- [[#autostart][Autostart]]
|
||||
- [[#window-rules][Window Rules]]
|
||||
- [[#layouts][Layouts]]
|
||||
@@ -72,6 +79,50 @@ Note: Commands from array are executed using execvp(). So if you need to execute
|
||||
#define AUTOSTART_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/foreign-toplevel-management][Foreign Toplevel Management]]
|
||||
|
||||
Implement ~foreign-toplevel-management~, it add handlers for activate, close, fullscreen and destroy request events, it's missing minimize and maximize request handlers.
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define FOREIGN_TOPLEVEL_MANAGEMENT_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/ipc][IPC]]
|
||||
|
||||
Largely based on [[https://sr.ht/~raphi/][raphi]]'s [[https://sr.ht/~raphi/somebar/][somebar]], this patch provides an ipc for wayland clients to get and set dwl state. The ipc is intended for status bars, but can also be scripted with tools like [[https://codeberg.org/notchoc/dwlmsg][dwlmsg]].
|
||||
|
||||
Status information to stdout is currently disabled as dwl tends to freeze. For now, ~dwlmsg -w~ should act as a drop-in replacement.
|
||||
|
||||
Note to [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/pertag][pertag]] users: apply [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/ipc/ipcpertag.patch][this]] for ipc tagsetting to work as expected
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define IPC_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/naturalscrolltrackpad][Natural Scroll Trackpad]]
|
||||
|
||||
Set natural scrolling only for trackpads.
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define NATURALSCROLLTRACKPAD_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/numlock-capslock][Numlock Capslock]]
|
||||
|
||||
Allows activating numlock or capslock at startup.
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define NUMLOCK_CAPSLOCK_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/pertag][Per Tag]]
|
||||
|
||||
Makes layout, mwfact and nmaster individual for every tag.
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define PERTAG_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/restore-monitor][Restore Monitor]]
|
||||
|
||||
Moves clients to their old output when it is reattached.
|
||||
@@ -80,6 +131,14 @@ Moves clients to their old output when it is reattached.
|
||||
#define RESTORE_MONITOR_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/setupenv][Setup Env]]
|
||||
|
||||
Allow configuring environment variables in config.h
|
||||
|
||||
#+BEGIN_SRC c :tangle patches.def.h
|
||||
#define SETUPENV_PATCH 1
|
||||
#+END_SRC
|
||||
|
||||
** [[https://codeberg.org/dwl/dwl-patches/src/branch/main/patches/vanitygaps][Vanity Gaps]]
|
||||
|
||||
Adds (inner) gaps between client windows and (outer) gaps between windows and the screen edge in a flexible manner.
|
||||
@@ -148,22 +207,49 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
static int log_level = WLR_ERROR;
|
||||
#+END_SRC
|
||||
|
||||
** Environment Variables
|
||||
#+BEGIN_SRC c :tangle config.h
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "TERM", "xterm-256color" },
|
||||
{ "SHELL", "/bin/fish" },
|
||||
{ "EDITOR", "emacs" },
|
||||
{ "GIT_EDITOR", "emacs" },
|
||||
{ "BROWSER", "vivaldi-stable" },
|
||||
{ "QT_QPA_PLATFORMTHEME", "qt6ct" },
|
||||
{ "_JAVA_AWT_WM_NONREPARENTING", "1" },
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
#+END_SRC
|
||||
|
||||
** Autostart
|
||||
|
||||
#+BEGIN_SRC c :tangle config.h
|
||||
#if AUTOSTART_PATCH
|
||||
static const char *const autostart[] = {
|
||||
/* Display / Compositor Setup */
|
||||
"/usr/bin/shikane", NULL,
|
||||
"/usr/bin/bash", "/home/sravan/.azotebg", NULL,
|
||||
"/usr/bin/gammastep", "-x", NULL,
|
||||
/* Background Processes */
|
||||
"/usr/libexec/polkit-gnome-authentication-agent-1", NULL,
|
||||
"/usr/bin/kdeconnectd", "--replace", NULL,
|
||||
"/usr/bin/bash", "/home/sravan/.scripts/dunst.sh", "--on", NULL,
|
||||
"/usr/bin/wl-paste", "--type", "text", "--watch", "cliphist", "store", NULL,
|
||||
"/usr/bin/wl-paste", "--type", "image", "--watch", "cliphist", "store", NULL,
|
||||
/* Tray Applications */
|
||||
"/usr/bin/gammastep-indicator", NULL,
|
||||
"/usr/bin/blueman-applet", NULL,
|
||||
"/usr/bin/nm-applet", NULL,
|
||||
"/usr/bin/kdeconnect-indicator", NULL,
|
||||
"/usr/bin/flameshot", NULL,
|
||||
"/usr/bin/udiskie", "-a", "-n", "-s", NULL,
|
||||
/* GUI Applications */
|
||||
"/usr/bin/nextcloud", NULL,
|
||||
"/usr/bin/syncthing-gtk", NULL,
|
||||
"/usr/bin/openrgb", NULL,
|
||||
"/usr/bin/udiskie", "-a", "-n", "-s", NULL,
|
||||
"wl-paste", "--type", "text", "--watch", "cliphist", "store", NULL,
|
||||
"wl-paste", "--type", "image", "--watch", "cliphist", "store", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
#endif // AUTOSTART_PATCH
|
||||
@@ -221,6 +307,12 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
/* numlock and capslock */
|
||||
static const int numlock = 1;
|
||||
static const int capslock = 0;
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
|
||||
static const int repeat_rate = 25;
|
||||
static const int repeat_delay = 600;
|
||||
#+END_SRC
|
||||
@@ -231,10 +323,11 @@ static const int repeat_delay = 600;
|
||||
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 natural_scrolling = 1;
|
||||
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
|
||||
@@ -291,13 +384,16 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
|
||||
#+BEGIN_SRC c :tangle config.h
|
||||
static const char *termcmd[] = { "kitty", NULL };
|
||||
static const char *menucmd[] = { "fuzzel", NULL };
|
||||
static const char *menucmd[] = { "rofi", "-show", "combi", 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} },
|
||||
#if IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_b, togglebar, {0} },
|
||||
#endif // IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
|
14
config.def.h
14
config.def.h
@@ -26,6 +26,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
|
||||
/* Autostart */
|
||||
static const char *const autostart[] = {
|
||||
"wbg", "/path/to/your/image", NULL,
|
||||
@@ -73,6 +78,12 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
/* numlock and capslock */
|
||||
static const int numlock = 1;
|
||||
static const int capslock = 0;
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
|
||||
static const int repeat_rate = 25;
|
||||
static const int repeat_delay = 600;
|
||||
|
||||
@@ -140,6 +151,9 @@ static const Key keys[] = {
|
||||
/* modifier key function argument */
|
||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
#if IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_b, togglebar, {0} },
|
||||
#endif // IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
|
44
config.h
44
config.h
@@ -28,19 +28,43 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "TERM", "xterm-256color" },
|
||||
{ "SHELL", "/bin/fish" },
|
||||
{ "EDITOR", "emacs" },
|
||||
{ "GIT_EDITOR", "emacs" },
|
||||
{ "BROWSER", "vivaldi-stable" },
|
||||
{ "QT_QPA_PLATFORMTHEME", "qt6ct" },
|
||||
{ "_JAVA_AWT_WM_NONREPARENTING", "1" },
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
#if AUTOSTART_PATCH
|
||||
static const char *const autostart[] = {
|
||||
/* Display / Compositor Setup */
|
||||
"/usr/bin/shikane", NULL,
|
||||
"/usr/bin/bash", "/home/sravan/.azotebg", NULL,
|
||||
"/usr/bin/gammastep", "-x", NULL,
|
||||
/* Background Processes */
|
||||
"/usr/libexec/polkit-gnome-authentication-agent-1", NULL,
|
||||
"/usr/bin/kdeconnectd", "--replace", NULL,
|
||||
"/usr/bin/bash", "/home/sravan/.scripts/dunst.sh", "--on", NULL,
|
||||
"/usr/bin/wl-paste", "--type", "text", "--watch", "cliphist", "store", NULL,
|
||||
"/usr/bin/wl-paste", "--type", "image", "--watch", "cliphist", "store", NULL,
|
||||
/* Tray Applications */
|
||||
"/usr/bin/gammastep-indicator", NULL,
|
||||
"/usr/bin/blueman-applet", NULL,
|
||||
"/usr/bin/nm-applet", NULL,
|
||||
"/usr/bin/kdeconnect-indicator", NULL,
|
||||
"/usr/bin/flameshot", NULL,
|
||||
"/usr/bin/udiskie", "-a", "-n", "-s", NULL,
|
||||
/* GUI Applications */
|
||||
"/usr/bin/nextcloud", NULL,
|
||||
"/usr/bin/syncthing-gtk", NULL,
|
||||
"/usr/bin/openrgb", NULL,
|
||||
"/usr/bin/udiskie", "-a", "-n", "-s", NULL,
|
||||
"wl-paste", "--type", "text", "--watch", "cliphist", "store", NULL,
|
||||
"wl-paste", "--type", "image", "--watch", "cliphist", "store", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
#endif // AUTOSTART_PATCH
|
||||
@@ -82,16 +106,23 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
/* numlock and capslock */
|
||||
static const int numlock = 1;
|
||||
static const int capslock = 0;
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
|
||||
static const int repeat_rate = 25;
|
||||
static const int repeat_delay = 600;
|
||||
|
||||
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 natural_scrolling = 1;
|
||||
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
|
||||
@@ -140,13 +171,16 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
static const char *termcmd[] = { "kitty", NULL };
|
||||
static const char *menucmd[] = { "fuzzel", NULL };
|
||||
static const char *menucmd[] = { "rofi", "-show", "combi", 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} },
|
||||
#if IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_b, togglebar, {0} },
|
||||
#endif // IPC_PATCH
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
|
605
dwl.c
605
dwl.c
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* See LICENSE file for copyright and license details.
|
||||
*/
|
||||
#include "patches.h"
|
||||
#include <getopt.h>
|
||||
#include <libinput.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
@@ -14,6 +15,9 @@
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
#include <wlr/interfaces/wlr_keyboard.h>
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||
@@ -24,6 +28,9 @@
|
||||
#include <wlr/types/wlr_data_device.h>
|
||||
#include <wlr/types/wlr_drm.h>
|
||||
#include <wlr/types/wlr_export_dmabuf_v1.h>
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||
#include <wlr/types/wlr_gamma_control_v1.h>
|
||||
#include <wlr/types/wlr_idle_inhibit_v1.h>
|
||||
@@ -65,9 +72,11 @@
|
||||
#include <wlr/xwayland.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <xcb/xcb_icccm.h>
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
|
||||
#include "patches.h"
|
||||
#if IPC_PATCH
|
||||
#include "dwl-ipc-unstable-v2-protocol.h"
|
||||
#endif // IPC_PATCH
|
||||
#include "util.h"
|
||||
|
||||
/* macros */
|
||||
@@ -88,7 +97,7 @@ enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock,
|
||||
#ifdef XWAYLAND
|
||||
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
|
||||
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
@@ -104,6 +113,9 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
#if PERTAG_PATCH
|
||||
typedef struct Pertag Pertag;
|
||||
#endif // PERTAG_PATCH
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
@@ -132,6 +144,13 @@ typedef struct {
|
||||
struct wl_listener fullscreen;
|
||||
struct wl_listener set_decoration_mode;
|
||||
struct wl_listener destroy_decoration;
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
||||
struct wl_listener factivate;
|
||||
struct wl_listener fclose;
|
||||
struct wl_listener ffullscreen;
|
||||
struct wl_listener fdestroy;
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
struct wlr_box prev; /* layout-relative, includes border */
|
||||
struct wlr_box bounds;
|
||||
#ifdef XWAYLAND
|
||||
@@ -140,13 +159,21 @@ typedef struct {
|
||||
struct wl_listener dissociate;
|
||||
struct wl_listener configure;
|
||||
struct wl_listener set_hints;
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
int isfloating, isurgent, isfullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
#if IPC_PATCH
|
||||
typedef struct {
|
||||
struct wl_list link;
|
||||
struct wl_resource *resource;
|
||||
Monitor *mon;
|
||||
} DwlIpcOutput;
|
||||
#endif // IPC_PATCH
|
||||
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
xkb_keysym_t keysym;
|
||||
@@ -192,6 +219,9 @@ typedef struct {
|
||||
|
||||
struct Monitor {
|
||||
struct wl_list link;
|
||||
#if IPC_PATCH
|
||||
struct wl_list dwl_ipc_outputs;
|
||||
#endif // IPC_PATCH
|
||||
struct wlr_output *wlr_output;
|
||||
struct wlr_scene_output *scene_output;
|
||||
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
|
||||
@@ -204,6 +234,9 @@ struct Monitor {
|
||||
struct wlr_box w; /* window area, layout-relative */
|
||||
struct wl_list layers[4]; /* LayerSurface.link */
|
||||
const Layout *lt[2];
|
||||
#if PERTAG_PATCH
|
||||
Pertag *pertag;
|
||||
#endif // PERTAG_PATCH
|
||||
#if VANITYGAPS_PATCH
|
||||
int gappih; /* horizontal gap between windows */
|
||||
int gappiv; /* vertical gap between windows */
|
||||
@@ -243,6 +276,13 @@ typedef struct {
|
||||
int monitor;
|
||||
} Rule;
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
typedef struct {
|
||||
const char *variable;
|
||||
const char *value;
|
||||
} Env;
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
typedef struct {
|
||||
struct wlr_scene_tree *scene;
|
||||
|
||||
@@ -301,6 +341,19 @@ static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
#if IPC_PATCH
|
||||
static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id);
|
||||
static void dwl_ipc_manager_destroy(struct wl_resource *resource);
|
||||
static void dwl_ipc_manager_get_output(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *output);
|
||||
static void dwl_ipc_manager_release(struct wl_client *client, struct wl_resource *resource);
|
||||
static void dwl_ipc_output_destroy(struct wl_resource *resource);
|
||||
static void dwl_ipc_output_printstatus(Monitor *monitor);
|
||||
static void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output);
|
||||
static void dwl_ipc_output_set_client_tags(struct wl_client *client, struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags);
|
||||
static void dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index);
|
||||
static void dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset);
|
||||
static void dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource);
|
||||
#endif // IPC_PATCH
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
@@ -366,6 +419,9 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
#if IPC_PATCH
|
||||
static void togglebar(const Arg *arg);
|
||||
#endif // IPC_PATCH
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
#if VANITYGAPS_PATCH
|
||||
@@ -389,11 +445,21 @@ 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);
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
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);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static pid_t child_pid = -1;
|
||||
static int locked;
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
static uint32_t locked_mods = 0;
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
static void *exclusive_focus;
|
||||
static struct wl_display *dpy;
|
||||
static struct wl_event_loop *event_loop;
|
||||
@@ -436,6 +502,10 @@ static struct wlr_scene_rect *locked_bg;
|
||||
static struct wlr_session_lock_v1 *cur_lock;
|
||||
static struct wl_listener lock_listener = {.notify = locksession};
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
static struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_mgr;
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
static struct wlr_seat *seat;
|
||||
static KeyboardGroup *kb_group;
|
||||
static unsigned int cursor_mode;
|
||||
@@ -447,6 +517,11 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
#if IPC_PATCH
|
||||
static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {.release = dwl_ipc_manager_release, .get_output = dwl_ipc_manager_get_output};
|
||||
static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {.release = dwl_ipc_output_release, .set_tags = dwl_ipc_output_set_tags, .set_layout = dwl_ipc_output_set_layout, .set_client_tags = dwl_ipc_output_set_client_tags};
|
||||
#endif // IPC_PATCH
|
||||
|
||||
#if VANITYGAPS_PATCH
|
||||
static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
||||
#endif // VANITYGAPS_PATCH
|
||||
@@ -462,7 +537,7 @@ static void sethints(struct wl_listener *listener, void *data);
|
||||
static void xwaylandready(struct wl_listener *listener, void *data);
|
||||
static struct wlr_xwayland *xwayland;
|
||||
static xcb_atom_t netatom[NetLast];
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
@@ -470,6 +545,16 @@ static xcb_atom_t netatom[NetLast];
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
|
||||
#if PERTAG_PATCH
|
||||
struct Pertag {
|
||||
unsigned int curtag, prevtag; /* current and previous tag */
|
||||
int nmasters[TAGCOUNT + 1]; /* number of windows in master area */
|
||||
float mfacts[TAGCOUNT + 1]; /* mfacts per tag */
|
||||
unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */
|
||||
const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */
|
||||
};
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
#if AUTOSTART_PATCH
|
||||
static pid_t *autostart_pids;
|
||||
static size_t autostart_len;
|
||||
@@ -509,6 +594,13 @@ applyrules(Client *c)
|
||||
if (!(title = client_get_title(c)))
|
||||
title = broken;
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
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);
|
||||
}
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
for (r = rules; r < END(rules); r++) {
|
||||
if ((!r->title || strstr(title, r->title))
|
||||
&& (!r->id || strstr(appid, r->id))) {
|
||||
@@ -751,7 +843,7 @@ cleanup(void)
|
||||
#ifdef XWAYLAND
|
||||
wlr_xwayland_destroy(xwayland);
|
||||
xwayland = NULL;
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
wl_display_destroy_clients(dpy);
|
||||
|
||||
#if AUTOSTART_PATCH
|
||||
@@ -789,6 +881,12 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
LayerSurface *l, *tmp;
|
||||
size_t i;
|
||||
|
||||
#if IPC_PATCH
|
||||
DwlIpcOutput *ipc_output, *ipc_output_tmp;
|
||||
wl_list_for_each_safe(ipc_output, ipc_output_tmp, &m->dwl_ipc_outputs, link)
|
||||
wl_resource_destroy(ipc_output->resource);
|
||||
#endif // IPC_PATCH
|
||||
|
||||
/* m->layers[i] are intentionally not unlinked */
|
||||
for (i = 0; i < LENGTH(m->layers); i++) {
|
||||
wl_list_for_each_safe(l, tmp, &m->layers[i], link)
|
||||
@@ -803,6 +901,9 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||
wlr_scene_output_destroy(m->scene_output);
|
||||
|
||||
#if PERTAG_PATCH
|
||||
free(m->pertag);
|
||||
#endif // PERTAG_PATCH
|
||||
closemon(m);
|
||||
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||
free(m);
|
||||
@@ -962,6 +1063,10 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
||||
/* Set the keymap to match the group keymap */
|
||||
wlr_keyboard_set_keymap(keyboard, kb_group->wlr_group->keyboard.keymap);
|
||||
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
wlr_keyboard_notify_modifiers(keyboard, 0, 0, locked_mods, 0);
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
|
||||
/* Add the new keyboard to the group */
|
||||
wlr_keyboard_group_add_keyboard(kb_group->wlr_group, keyboard);
|
||||
}
|
||||
@@ -983,6 +1088,23 @@ createkeyboardgroup(void)
|
||||
die("failed to compile keymap");
|
||||
|
||||
wlr_keyboard_set_keymap(&group->wlr_group->keyboard, keymap);
|
||||
#if NUMLOCK_CAPSLOCK_PATCH
|
||||
if (numlock) {
|
||||
xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
|
||||
if (mod_index != XKB_MOD_INVALID)
|
||||
locked_mods |= (uint32_t)1 << mod_index;
|
||||
}
|
||||
|
||||
if (capslock) {
|
||||
xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
||||
if (mod_index != XKB_MOD_INVALID)
|
||||
locked_mods |= (uint32_t)1 << mod_index;
|
||||
}
|
||||
|
||||
if (locked_mods)
|
||||
wlr_keyboard_notify_modifiers(&group->wlr_group->keyboard, 0, 0, locked_mods, 0);
|
||||
#endif // NUMLOCK_CAPSLOCK_PATCH
|
||||
|
||||
xkb_keymap_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
|
||||
@@ -1074,6 +1196,10 @@ createmon(struct wl_listener *listener, void *data)
|
||||
m = wlr_output->data = ecalloc(1, sizeof(*m));
|
||||
m->wlr_output = wlr_output;
|
||||
|
||||
#if IPC_PATCH
|
||||
wl_list_init(&m->dwl_ipc_outputs);
|
||||
#endif // IPC_PATCH
|
||||
|
||||
for (i = 0; i < LENGTH(m->layers); i++)
|
||||
wl_list_init(&m->layers[i]);
|
||||
|
||||
@@ -1120,6 +1246,20 @@ createmon(struct wl_listener *listener, void *data)
|
||||
wl_list_insert(&mons, &m->link);
|
||||
printstatus();
|
||||
|
||||
#if PERTAG_PATCH
|
||||
m->pertag = calloc(1, sizeof(Pertag));
|
||||
m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
|
||||
for (i = 0; i <= TAGCOUNT; i++) {
|
||||
m->pertag->nmasters[i] = m->nmaster;
|
||||
m->pertag->mfacts[i] = m->mfact;
|
||||
|
||||
m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
m->pertag->sellts[i] = m->sellt;
|
||||
}
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
/* The xdg-protocol specifies:
|
||||
*
|
||||
* If the fullscreened surface is not opaque, the compositor must make
|
||||
@@ -1187,10 +1327,16 @@ createpointer(struct wlr_pointer *pointer)
|
||||
libinput_device_config_tap_set_drag_enabled(device, tap_and_drag);
|
||||
libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock);
|
||||
libinput_device_config_tap_set_button_map(device, button_map);
|
||||
}
|
||||
|
||||
#if NATURALSCROLLTRACKPAD_PATCH
|
||||
if (libinput_device_config_scroll_has_natural_scroll(device))
|
||||
libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
|
||||
#endif // NATURALSCROLLTRACKPAD_PATCH
|
||||
}
|
||||
|
||||
#if !NATURALSCROLLTRACKPAD_PATCH
|
||||
if (libinput_device_config_scroll_has_natural_scroll(device))
|
||||
libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
|
||||
#endif // NATURALSCROLLTRACKPAD_PATCH
|
||||
|
||||
if (libinput_device_config_dwt_is_available(device))
|
||||
libinput_device_config_dwt_set_enabled(device, disable_while_typing);
|
||||
@@ -1383,7 +1529,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||
wl_list_remove(&c->dissociate.link);
|
||||
wl_list_remove(&c->set_hints.link);
|
||||
} else
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
{
|
||||
wl_list_remove(&c->commit.link);
|
||||
wl_list_remove(&c->map.link);
|
||||
@@ -1451,6 +1597,250 @@ dirtomon(enum wlr_direction dir)
|
||||
return selmon;
|
||||
}
|
||||
|
||||
#if IPC_PATCH
|
||||
void
|
||||
dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||
{
|
||||
struct wl_resource *manager_resource = wl_resource_create(client, &zdwl_ipc_manager_v2_interface, version, id);
|
||||
if (!manager_resource) {
|
||||
wl_client_post_no_memory(client);
|
||||
return;
|
||||
}
|
||||
wl_resource_set_implementation(manager_resource, &dwl_manager_implementation, NULL, dwl_ipc_manager_destroy);
|
||||
|
||||
zdwl_ipc_manager_v2_send_tags(manager_resource, TAGCOUNT);
|
||||
|
||||
for (unsigned int i = 0; i < LENGTH(layouts); i++)
|
||||
zdwl_ipc_manager_v2_send_layout(manager_resource, layouts[i].symbol);
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_manager_destroy(struct wl_resource *resource)
|
||||
{
|
||||
/* No state to destroy */
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_manager_get_output(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *output)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
Monitor *monitor = wlr_output_from_resource(output)->data;
|
||||
struct wl_resource *output_resource = wl_resource_create(client, &zdwl_ipc_output_v2_interface, wl_resource_get_version(resource), id);
|
||||
if (!output_resource)
|
||||
return;
|
||||
|
||||
ipc_output = ecalloc(1, sizeof(*ipc_output));
|
||||
ipc_output->resource = output_resource;
|
||||
ipc_output->mon = monitor;
|
||||
wl_resource_set_implementation(output_resource, &dwl_output_implementation, ipc_output, dwl_ipc_output_destroy);
|
||||
wl_list_insert(&monitor->dwl_ipc_outputs, &ipc_output->link);
|
||||
dwl_ipc_output_printstatus_to(ipc_output);
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_manager_release(struct wl_client *client, struct wl_resource *resource)
|
||||
{
|
||||
wl_resource_destroy(resource);
|
||||
}
|
||||
|
||||
static void
|
||||
dwl_ipc_output_destroy(struct wl_resource *resource)
|
||||
{
|
||||
DwlIpcOutput *ipc_output = wl_resource_get_user_data(resource);
|
||||
wl_list_remove(&ipc_output->link);
|
||||
free(ipc_output);
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_printstatus(Monitor *monitor)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
wl_list_for_each(ipc_output, &monitor->dwl_ipc_outputs, link)
|
||||
dwl_ipc_output_printstatus_to(ipc_output);
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output)
|
||||
{
|
||||
Monitor *monitor = ipc_output->mon;
|
||||
Client *c, *focused;
|
||||
int tagmask, state, numclients, focused_client, tag;
|
||||
const char *title, *appid;
|
||||
focused = focustop(monitor);
|
||||
zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
|
||||
|
||||
for (tag = 0 ; tag < TAGCOUNT; tag++) {
|
||||
numclients = state = focused_client = 0;
|
||||
tagmask = 1 << tag;
|
||||
if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
|
||||
state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
|
||||
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (c->mon != monitor)
|
||||
continue;
|
||||
if (!(c->tags & tagmask))
|
||||
continue;
|
||||
if (c == focused)
|
||||
focused_client = 1;
|
||||
if (c->isurgent)
|
||||
state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
|
||||
|
||||
numclients++;
|
||||
}
|
||||
zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state, numclients, focused_client);
|
||||
}
|
||||
title = focused ? client_get_title(focused) : "";
|
||||
appid = focused ? client_get_appid(focused) : "";
|
||||
|
||||
zdwl_ipc_output_v2_send_layout(ipc_output->resource, monitor->lt[monitor->sellt] - layouts);
|
||||
zdwl_ipc_output_v2_send_title(ipc_output->resource, title);
|
||||
zdwl_ipc_output_v2_send_appid(ipc_output->resource, appid);
|
||||
zdwl_ipc_output_v2_send_layout_symbol(ipc_output->resource, monitor->ltsymbol);
|
||||
if (wl_resource_get_version(ipc_output->resource) >= ZDWL_IPC_OUTPUT_V2_FULLSCREEN_SINCE_VERSION) {
|
||||
zdwl_ipc_output_v2_send_fullscreen(ipc_output->resource, focused ? focused->isfullscreen : 0);
|
||||
}
|
||||
if (wl_resource_get_version(ipc_output->resource) >= ZDWL_IPC_OUTPUT_V2_FLOATING_SINCE_VERSION) {
|
||||
zdwl_ipc_output_v2_send_floating(ipc_output->resource, focused ? focused->isfloating : 0);
|
||||
}
|
||||
zdwl_ipc_output_v2_send_frame(ipc_output->resource);
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_set_client_tags(struct wl_client *client, struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
Monitor *monitor;
|
||||
Client *selected_client;
|
||||
unsigned int newtags = 0;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
return;
|
||||
|
||||
monitor = ipc_output->mon;
|
||||
selected_client = focustop(monitor);
|
||||
if (!selected_client)
|
||||
return;
|
||||
|
||||
newtags = (selected_client->tags & and_tags) ^ xor_tags;
|
||||
if (!newtags)
|
||||
return;
|
||||
|
||||
selected_client->tags = newtags;
|
||||
if (selmon == monitor)
|
||||
focusclient(focustop(monitor), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
#if !PERTAG_PATCH
|
||||
Monitor *monitor;
|
||||
#else // PERTAG_PATCH
|
||||
Client *c = NULL;
|
||||
Monitor *monitor = NULL;
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
return;
|
||||
|
||||
monitor = ipc_output->mon;
|
||||
|
||||
#if PERTAG_PATCH
|
||||
if (monitor != selmon)
|
||||
c = focustop(selmon);
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
if (index >= LENGTH(layouts))
|
||||
return;
|
||||
|
||||
#if !PERTAG_PATCH
|
||||
if (index != monitor->lt[monitor->sellt] - layouts)
|
||||
monitor->sellt ^= 1;
|
||||
|
||||
monitor->lt[monitor->sellt] = &layouts[index];
|
||||
arrange(monitor);
|
||||
printstatus();
|
||||
#else // PERTAG_PATCH
|
||||
if (c) {
|
||||
monitor = selmon;
|
||||
selmon = ipc_output->mon;
|
||||
}
|
||||
setlayout(&(Arg){.v = &layouts[index]});
|
||||
if (c) {
|
||||
selmon = monitor;
|
||||
focusclient(c, 0);
|
||||
}
|
||||
#endif // PERTAG_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
#if !PERTAG_PATCH
|
||||
Monitor *monitor;
|
||||
#else // PERTAG_PATCH
|
||||
Client *c = NULL;
|
||||
Monitor *monitor = NULL;
|
||||
#endif // PERTAG_PATCH
|
||||
unsigned int newtags = tagmask & TAGMASK;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
return;
|
||||
monitor = ipc_output->mon;
|
||||
|
||||
#if !PERTAG_PATCH
|
||||
if (!newtags || newtags == monitor->tagset[monitor->seltags])
|
||||
#else // PERTAG_PATCH
|
||||
if (monitor != selmon)
|
||||
c = focustop(selmon);
|
||||
|
||||
if (!newtags)
|
||||
#endif // PERTAG_PATCH
|
||||
return;
|
||||
#if !PERTAG_PATCH
|
||||
if (toggle_tagset)
|
||||
monitor->seltags ^= 1;
|
||||
#else // PERTAG_PATCH
|
||||
/* view toggles seltags for us so we un-toggle it */
|
||||
if (!toggle_tagset) {
|
||||
monitor->seltags ^= 1;
|
||||
monitor->tagset[monitor->seltags] = 0;
|
||||
}
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
#if !PERTAG_PATCH
|
||||
monitor->tagset[monitor->seltags] = newtags;
|
||||
if (selmon == monitor)
|
||||
focusclient(focustop(monitor), 1);
|
||||
arrange(monitor);
|
||||
printstatus();
|
||||
#else // PERTAG_PATCH
|
||||
if (c) {
|
||||
monitor = selmon;
|
||||
selmon = ipc_output->mon;
|
||||
}
|
||||
view(&(Arg){.ui = newtags});
|
||||
if (c) {
|
||||
selmon = monitor;
|
||||
focusclient(c, 0);
|
||||
}
|
||||
#endif // PERTAG_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource)
|
||||
{
|
||||
wl_resource_destroy(resource);
|
||||
}
|
||||
#endif // IPC_PATCH
|
||||
|
||||
void
|
||||
focusclient(Client *c, int lift)
|
||||
{
|
||||
@@ -1512,6 +1902,10 @@ focusclient(Client *c, int lift)
|
||||
client_set_border_color(old_c, bordercolor);
|
||||
|
||||
client_activate_surface(old, 0);
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (old_c->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(old_c->foreign_toplevel, 0);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
}
|
||||
}
|
||||
printstatus();
|
||||
@@ -1530,6 +1924,10 @@ focusclient(Client *c, int lift)
|
||||
|
||||
/* Activate the new client */
|
||||
client_activate_surface(client_surface(c), 1);
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (c->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_set_activated(c->foreign_toplevel, 1);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1628,7 +2026,7 @@ handlesig(int signo)
|
||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
||||
#ifdef XWAYLAND
|
||||
&& (!xwayland || in.si_pid != xwayland->server->pid)
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
) {
|
||||
pid_t *p, *lim;
|
||||
waitpid(in.si_pid, NULL, 0);
|
||||
@@ -1655,9 +2053,9 @@ handlesig(int signo)
|
||||
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
|
||||
#else // XWAYLAND
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
#endif // AUTOSTART_PATCH
|
||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
||||
quit(NULL);
|
||||
@@ -1669,7 +2067,11 @@ incnmaster(const Arg *arg)
|
||||
{
|
||||
if (!arg || !selmon)
|
||||
return;
|
||||
#if !PERTAG_PATCH
|
||||
selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
#else // PERTAG_PATCH
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
|
||||
#endif // PERTAG_PATCH
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -1947,6 +2349,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
c->border[i]->node.data = c;
|
||||
}
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
createforeigntoplevel(c);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
/* 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;
|
||||
@@ -1966,7 +2372,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
wl_list_insert(&p->link, &c->link);
|
||||
else
|
||||
wl_list_insert(&clients, &c->link);
|
||||
#else
|
||||
#else // ATTACHTOP_PATCH
|
||||
wl_list_insert(&clients, &c->link);
|
||||
#endif // ATTACHTOP_PATCH
|
||||
wl_list_insert(&fstack, &c->flink);
|
||||
@@ -2294,6 +2700,7 @@ void
|
||||
printstatus(void)
|
||||
{
|
||||
Monitor *m = NULL;
|
||||
#if !IPC_PATCH
|
||||
Client *c;
|
||||
uint32_t occ, urg, sel;
|
||||
const char *appid, *title;
|
||||
@@ -2329,6 +2736,10 @@ printstatus(void)
|
||||
printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol);
|
||||
}
|
||||
fflush(stdout);
|
||||
#else // IPC_PATCH
|
||||
wl_list_for_each(m, &mons, link)
|
||||
dwl_ipc_output_printstatus(m);
|
||||
#endif // IPC_PATCH
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2476,6 +2887,10 @@ run(char *startup_cmd)
|
||||
if (!socket)
|
||||
die("startup: display_add_socket_auto");
|
||||
setenv("WAYLAND_DISPLAY", socket, 1);
|
||||
#if SETUPENV_PATCH
|
||||
for (size_t i = 0; i < LENGTH(envs); i++)
|
||||
setenv(envs[i].variable, envs[i].value, 1);
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
/* Start the backend. This will enumerate outputs and inputs, become the DRM
|
||||
* master, etc */
|
||||
@@ -2631,9 +3046,17 @@ setlayout(const Arg *arg)
|
||||
if (!selmon)
|
||||
return;
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
#if !PERTAG_PATCH
|
||||
selmon->sellt ^= 1;
|
||||
#else // PERTAG_PATCH
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
#endif // PERTAG_PATCH
|
||||
if (arg && arg->v)
|
||||
#if !PERTAG_PATCH
|
||||
selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
#else // PERTAG_PATCH
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
#endif // PERTAG_PATCH
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
@@ -2650,7 +3073,11 @@ setmfact(const Arg *arg)
|
||||
f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
#if !PERTAG_PATCH
|
||||
selmon->mfact = f;
|
||||
#else // PERTAG_PATCH
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
#endif // PERTAG_PATCH
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -2665,12 +3092,24 @@ setmon(Client *c, Monitor *m, uint32_t newtags)
|
||||
c->prev = c->geom;
|
||||
|
||||
/* Scene graph sends surface leave/enter events on move and resize */
|
||||
#if !FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (oldmon)
|
||||
arrange(oldmon);
|
||||
#else // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (oldmon) {
|
||||
if (c->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_output_leave(c->foreign_toplevel, oldmon->wlr_output);
|
||||
arrange(oldmon);
|
||||
}
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
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 FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (c->foreign_toplevel)
|
||||
wlr_foreign_toplevel_handle_v1_output_enter(c->foreign_toplevel, m->wlr_output);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
setfullscreen(c, c->isfullscreen); /* This will call arrange(c->mon) */
|
||||
setfloating(c, c->isfloating);
|
||||
}
|
||||
@@ -2788,6 +3227,11 @@ setup(void)
|
||||
power_mgr = wlr_output_power_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&power_mgr->events.set_mode, powermgrsetmode);
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
/* Initializes foreign toplevel management */
|
||||
foreign_toplevel_mgr = wlr_foreign_toplevel_manager_v1_create(dpy);
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
/* Creates an output layout, which a wlroots utility for working with an
|
||||
* arrangement of screens in a physical layout. */
|
||||
output_layout = wlr_output_layout_create(dpy);
|
||||
@@ -2898,6 +3342,10 @@ setup(void)
|
||||
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
|
||||
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
|
||||
|
||||
#if IPC_PATCH
|
||||
wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL, dwl_ipc_manager_bind);
|
||||
#endif // IPC_PATCH
|
||||
|
||||
/* Make sure XWayland clients don't connect to the parent X server,
|
||||
* e.g when running in the x11 backend or the wayland backend and the
|
||||
* compositor has Xwayland support */
|
||||
@@ -2915,7 +3363,7 @@ setup(void)
|
||||
} else {
|
||||
fprintf(stderr, "failed to setup XWayland X server, continuing without it\n");
|
||||
}
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
}
|
||||
|
||||
void
|
||||
@@ -3042,6 +3490,15 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
#if IPC_PATCH
|
||||
void
|
||||
togglebar(const Arg *arg) {
|
||||
DwlIpcOutput *ipc_output;
|
||||
wl_list_for_each(ipc_output, &selmon->dwl_ipc_outputs, link)
|
||||
zdwl_ipc_output_v2_send_toggle_visibility(ipc_output->resource);
|
||||
}
|
||||
#endif // IPC_PATCH
|
||||
|
||||
void
|
||||
togglefloating(const Arg *arg)
|
||||
{
|
||||
@@ -3086,9 +3543,33 @@ void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
uint32_t newtagset;
|
||||
#if PERTAG_PATCH
|
||||
size_t i;
|
||||
#endif // PERTAG_PATCH
|
||||
if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
|
||||
return;
|
||||
|
||||
#if PERTAG_PATCH
|
||||
if (newtagset == (uint32_t)~0) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = 0;
|
||||
}
|
||||
|
||||
/* test if the user did not select the same tag */
|
||||
if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
|
||||
/* apply settings for this view */
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
@@ -3139,6 +3620,13 @@ unmapnotify(struct wl_listener *listener, void *data)
|
||||
wl_list_remove(&c->flink);
|
||||
}
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (c->foreign_toplevel) {
|
||||
wlr_foreign_toplevel_handle_v1_destroy(c->foreign_toplevel);
|
||||
c->foreign_toplevel = NULL;
|
||||
}
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
wlr_scene_node_destroy(&c->scene->node);
|
||||
printstatus();
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
@@ -3254,6 +3742,14 @@ void
|
||||
updatetitle(struct wl_listener *listener, void *data)
|
||||
{
|
||||
Client *c = wl_container_of(listener, c, set_title);
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
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);
|
||||
}
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
if (c == focustop(c->mon))
|
||||
printstatus();
|
||||
}
|
||||
@@ -3277,11 +3773,40 @@ urgent(struct wl_listener *listener, void *data)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
#if PERTAG_PATCH
|
||||
size_t i, tmptag;
|
||||
#endif // PERTAG_PATCH
|
||||
//
|
||||
if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
#if !PERTAG_PATCH
|
||||
if (arg->ui & TAGMASK)
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
#else // PERTAG_PATCH
|
||||
if (arg->ui & ~0) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
|
||||
if (arg->ui == TAGMASK)
|
||||
selmon->pertag->curtag = 0;
|
||||
else {
|
||||
for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
selmon->pertag->curtag = i + 1;
|
||||
}
|
||||
} else {
|
||||
tmptag = selmon->pertag->prevtag;
|
||||
selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
selmon->pertag->curtag = tmptag;
|
||||
}
|
||||
|
||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
#endif // PERTAG_PATCH
|
||||
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
@@ -3406,6 +3931,56 @@ zoom(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
#if FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
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);
|
||||
}
|
||||
#endif // FOREIGN_TOPLEVEL_MANAGEMENT_PATCH
|
||||
|
||||
#ifdef XWAYLAND
|
||||
void
|
||||
activatex11(struct wl_listener *listener, void *data)
|
||||
@@ -3533,7 +4108,7 @@ xwaylandready(struct wl_listener *listener, void *data)
|
||||
|
||||
xcb_disconnect(xc);
|
||||
}
|
||||
#endif
|
||||
#endif // XWAYLAND
|
||||
|
||||
int
|
||||
main(int argc, char *argv[])
|
||||
|
@@ -2,8 +2,20 @@
|
||||
|
||||
#define AUTOSTART_PATCH 1
|
||||
|
||||
#define FOREIGN_TOPLEVEL_MANAGEMENT_PATCH 1
|
||||
|
||||
#define IPC_PATCH 1
|
||||
|
||||
#define NATURALSCROLLTRACKPAD_PATCH 1
|
||||
|
||||
#define NUMLOCK_CAPSLOCK_PATCH 1
|
||||
|
||||
#define PERTAG_PATCH 1
|
||||
|
||||
#define RESTORE_MONITOR_PATCH 1
|
||||
|
||||
#define SETUPENV_PATCH 1
|
||||
|
||||
#define VANITYGAPS_PATCH 1
|
||||
|
||||
#define WARPCURSOR_PATCH 1
|
||||
|
507
patches/foreign-toplevel-management-20240502.patch
Normal file
507
patches/foreign-toplevel-management-20240502.patch
Normal file
@@ -0,0 +1,507 @@
|
||||
From dc63d64cd69f515013464b3feb8acb411f5a348f Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Thu, 2 May 2024 17:25:45 -0500
|
||||
Subject: [PATCH] implement foreign toplevel management
|
||||
|
||||
---
|
||||
Makefile | 5 +-
|
||||
dwl.c | 93 +++++-
|
||||
...oreign-toplevel-management-unstable-v1.xml | 270 ++++++++++++++++++
|
||||
3 files changed, 366 insertions(+), 2 deletions(-)
|
||||
create mode 100644 protocols/wlr-foreign-toplevel-management-unstable-v1.xml
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index a67fdd3..e0e1260 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -16,7 +16,7 @@ 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 config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h xdg-shell-protocol.h
|
||||
+dwl.o: dwl.c config.mk config.h client.h cursor-shape-v1-protocol.h pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-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
|
||||
@@ -37,6 +37,9 @@ wlr-layer-shell-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/dwl.c b/dwl.c
|
||||
index bf763df..648616d 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -22,6 +22,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>
|
||||
@@ -126,6 +127,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
|
||||
@@ -347,6 +353,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";
|
||||
@@ -392,6 +403,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 = {0};
|
||||
static KeyboardGroup vkb_group = {0};
|
||||
@@ -458,6 +471,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))) {
|
||||
@@ -1288,6 +1306,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();
|
||||
@@ -1306,6 +1326,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
|
||||
@@ -1599,6 +1621,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;
|
||||
@@ -2232,12 +2256,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);
|
||||
}
|
||||
@@ -2351,6 +2380,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);
|
||||
+
|
||||
/* Creates an output layout, which a wlroots utility for working with an
|
||||
* arrangement of screens in a physical layout. */
|
||||
output_layout = wlr_output_layout_create();
|
||||
@@ -2691,6 +2723,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);
|
||||
@@ -2802,6 +2839,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();
|
||||
}
|
||||
@@ -2929,6 +2972,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)
|
||||
diff --git a/protocols/wlr-foreign-toplevel-management-unstable-v1.xml b/protocols/wlr-foreign-toplevel-management-unstable-v1.xml
|
||||
new file mode 100644
|
||||
index 0000000..44505bb
|
||||
--- /dev/null
|
||||
+++ b/protocols/wlr-foreign-toplevel-management-unstable-v1.xml
|
||||
@@ -0,0 +1,270 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<protocol name="wlr_foreign_toplevel_management_unstable_v1">
|
||||
+ <copyright>
|
||||
+ Copyright © 2018 Ilia Bozhinov
|
||||
+
|
||||
+ 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.
|
||||
+ </copyright>
|
||||
+
|
||||
+ <interface name="zwlr_foreign_toplevel_manager_v1" version="3">
|
||||
+ <description summary="list and control opened apps">
|
||||
+ The purpose of this protocol is to enable the creation of taskbars
|
||||
+ and docks by providing them with a list of opened applications and
|
||||
+ letting them request certain actions on them, like maximizing, etc.
|
||||
+
|
||||
+ After a client binds the zwlr_foreign_toplevel_manager_v1, each opened
|
||||
+ toplevel window will be sent via the toplevel event
|
||||
+ </description>
|
||||
+
|
||||
+ <event name="toplevel">
|
||||
+ <description summary="a toplevel has been created">
|
||||
+ This event is emitted whenever a new toplevel window is created. It
|
||||
+ is emitted for all toplevels, regardless of the app that has created
|
||||
+ them.
|
||||
+
|
||||
+ All initial details of the toplevel(title, app_id, states, etc.) will
|
||||
+ be sent immediately after this event via the corresponding events in
|
||||
+ zwlr_foreign_toplevel_handle_v1.
|
||||
+ </description>
|
||||
+ <arg name="toplevel" type="new_id" interface="zwlr_foreign_toplevel_handle_v1"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <request name="stop">
|
||||
+ <description summary="stop sending events">
|
||||
+ Indicates the client no longer wishes to receive events for new toplevels.
|
||||
+ However the compositor may emit further toplevel_created events, until
|
||||
+ the finished event is emitted.
|
||||
+
|
||||
+ The client must not send any more requests after this one.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <event name="finished" type="destructor">
|
||||
+ <description summary="the compositor has finished with the toplevel manager">
|
||||
+ This event indicates that the compositor is done sending events to the
|
||||
+ zwlr_foreign_toplevel_manager_v1. The server will destroy the object
|
||||
+ immediately after sending this request, so it will become invalid and
|
||||
+ the client should free any resources associated with it.
|
||||
+ </description>
|
||||
+ </event>
|
||||
+ </interface>
|
||||
+
|
||||
+ <interface name="zwlr_foreign_toplevel_handle_v1" version="3">
|
||||
+ <description summary="an opened toplevel">
|
||||
+ A zwlr_foreign_toplevel_handle_v1 object represents an opened toplevel
|
||||
+ window. Each app may have multiple opened toplevels.
|
||||
+
|
||||
+ Each toplevel has a list of outputs it is visible on, conveyed to the
|
||||
+ client with the output_enter and output_leave events.
|
||||
+ </description>
|
||||
+
|
||||
+ <event name="title">
|
||||
+ <description summary="title change">
|
||||
+ This event is emitted whenever the title of the toplevel changes.
|
||||
+ </description>
|
||||
+ <arg name="title" type="string"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <event name="app_id">
|
||||
+ <description summary="app-id change">
|
||||
+ This event is emitted whenever the app-id of the toplevel changes.
|
||||
+ </description>
|
||||
+ <arg name="app_id" type="string"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <event name="output_enter">
|
||||
+ <description summary="toplevel entered an output">
|
||||
+ This event is emitted whenever the toplevel becomes visible on
|
||||
+ the given output. A toplevel may be visible on multiple outputs.
|
||||
+ </description>
|
||||
+ <arg name="output" type="object" interface="wl_output"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <event name="output_leave">
|
||||
+ <description summary="toplevel left an output">
|
||||
+ This event is emitted whenever the toplevel stops being visible on
|
||||
+ the given output. It is guaranteed that an entered-output event
|
||||
+ with the same output has been emitted before this event.
|
||||
+ </description>
|
||||
+ <arg name="output" type="object" interface="wl_output"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <request name="set_maximized">
|
||||
+ <description summary="requests that the toplevel be maximized">
|
||||
+ Requests that the toplevel be maximized. If the maximized state actually
|
||||
+ changes, this will be indicated by the state event.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="unset_maximized">
|
||||
+ <description summary="requests that the toplevel be unmaximized">
|
||||
+ Requests that the toplevel be unmaximized. If the maximized state actually
|
||||
+ changes, this will be indicated by the state event.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="set_minimized">
|
||||
+ <description summary="requests that the toplevel be minimized">
|
||||
+ Requests that the toplevel be minimized. If the minimized state actually
|
||||
+ changes, this will be indicated by the state event.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="unset_minimized">
|
||||
+ <description summary="requests that the toplevel be unminimized">
|
||||
+ Requests that the toplevel be unminimized. If the minimized state actually
|
||||
+ changes, this will be indicated by the state event.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="activate">
|
||||
+ <description summary="activate the toplevel">
|
||||
+ Request that this toplevel be activated on the given seat.
|
||||
+ There is no guarantee the toplevel will be actually activated.
|
||||
+ </description>
|
||||
+ <arg name="seat" type="object" interface="wl_seat"/>
|
||||
+ </request>
|
||||
+
|
||||
+ <enum name="state">
|
||||
+ <description summary="types of states on the toplevel">
|
||||
+ The different states that a toplevel can have. These have the same meaning
|
||||
+ as the states with the same names defined in xdg-toplevel
|
||||
+ </description>
|
||||
+
|
||||
+ <entry name="maximized" value="0" summary="the toplevel is maximized"/>
|
||||
+ <entry name="minimized" value="1" summary="the toplevel is minimized"/>
|
||||
+ <entry name="activated" value="2" summary="the toplevel is active"/>
|
||||
+ <entry name="fullscreen" value="3" summary="the toplevel is fullscreen" since="2"/>
|
||||
+ </enum>
|
||||
+
|
||||
+ <event name="state">
|
||||
+ <description summary="the toplevel state changed">
|
||||
+ This event is emitted immediately after the zlw_foreign_toplevel_handle_v1
|
||||
+ is created and each time the toplevel state changes, either because of a
|
||||
+ compositor action or because of a request in this protocol.
|
||||
+ </description>
|
||||
+
|
||||
+ <arg name="state" type="array"/>
|
||||
+ </event>
|
||||
+
|
||||
+ <event name="done">
|
||||
+ <description summary="all information about the toplevel has been sent">
|
||||
+ This event is sent after all changes in the toplevel state have been
|
||||
+ sent.
|
||||
+
|
||||
+ This allows changes to the zwlr_foreign_toplevel_handle_v1 properties
|
||||
+ to be seen as atomic, even if they happen via multiple events.
|
||||
+ </description>
|
||||
+ </event>
|
||||
+
|
||||
+ <request name="close">
|
||||
+ <description summary="request that the toplevel be closed">
|
||||
+ Send a request to the toplevel to close itself. The compositor would
|
||||
+ typically use a shell-specific method to carry out this request, for
|
||||
+ example by sending the xdg_toplevel.close event. However, this gives
|
||||
+ no guarantees the toplevel will actually be destroyed. If and when
|
||||
+ this happens, the zwlr_foreign_toplevel_handle_v1.closed event will
|
||||
+ be emitted.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="set_rectangle">
|
||||
+ <description summary="the rectangle which represents the toplevel">
|
||||
+ The rectangle of the surface specified in this request corresponds to
|
||||
+ the place where the app using this protocol represents the given toplevel.
|
||||
+ It can be used by the compositor as a hint for some operations, e.g
|
||||
+ minimizing. The client is however not required to set this, in which
|
||||
+ case the compositor is free to decide some default value.
|
||||
+
|
||||
+ If the client specifies more than one rectangle, only the last one is
|
||||
+ considered.
|
||||
+
|
||||
+ The dimensions are given in surface-local coordinates.
|
||||
+ Setting width=height=0 removes the already-set rectangle.
|
||||
+ </description>
|
||||
+
|
||||
+ <arg name="surface" type="object" interface="wl_surface"/>
|
||||
+ <arg name="x" type="int"/>
|
||||
+ <arg name="y" type="int"/>
|
||||
+ <arg name="width" type="int"/>
|
||||
+ <arg name="height" type="int"/>
|
||||
+ </request>
|
||||
+
|
||||
+ <enum name="error">
|
||||
+ <entry name="invalid_rectangle" value="0"
|
||||
+ summary="the provided rectangle is invalid"/>
|
||||
+ </enum>
|
||||
+
|
||||
+ <event name="closed">
|
||||
+ <description summary="this toplevel has been destroyed">
|
||||
+ This event means the toplevel has been destroyed. It is guaranteed there
|
||||
+ won't be any more events for this zwlr_foreign_toplevel_handle_v1. The
|
||||
+ toplevel itself becomes inert so any requests will be ignored except the
|
||||
+ destroy request.
|
||||
+ </description>
|
||||
+ </event>
|
||||
+
|
||||
+ <request name="destroy" type="destructor">
|
||||
+ <description summary="destroy the zwlr_foreign_toplevel_handle_v1 object">
|
||||
+ Destroys the zwlr_foreign_toplevel_handle_v1 object.
|
||||
+
|
||||
+ This request should be called either when the client does not want to
|
||||
+ use the toplevel anymore or after the closed event to finalize the
|
||||
+ destruction of the object.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <!-- Version 2 additions -->
|
||||
+
|
||||
+ <request name="set_fullscreen" since="2">
|
||||
+ <description summary="request that the toplevel be fullscreened">
|
||||
+ Requests that the toplevel be fullscreened on the given output. If the
|
||||
+ fullscreen state and/or the outputs the toplevel is visible on actually
|
||||
+ change, this will be indicated by the state and output_enter/leave
|
||||
+ events.
|
||||
+
|
||||
+ The output parameter is only a hint to the compositor. Also, if output
|
||||
+ is NULL, the compositor should decide which output the toplevel will be
|
||||
+ fullscreened on, if at all.
|
||||
+ </description>
|
||||
+ <arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="unset_fullscreen" since="2">
|
||||
+ <description summary="request that the toplevel be unfullscreened">
|
||||
+ Requests that the toplevel be unfullscreened. If the fullscreen state
|
||||
+ actually changes, this will be indicated by the state event.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <!-- Version 3 additions -->
|
||||
+
|
||||
+ <event name="parent" since="3">
|
||||
+ <description summary="parent change">
|
||||
+ This event is emitted whenever the parent of the toplevel changes.
|
||||
+
|
||||
+ No event is emitted when the parent handle is destroyed by the client.
|
||||
+ </description>
|
||||
+ <arg name="parent" type="object" interface="zwlr_foreign_toplevel_handle_v1" allow-null="true"/>
|
||||
+ </event>
|
||||
+ </interface>
|
||||
+</protocol>
|
||||
--
|
||||
2.43.2
|
||||
|
597
patches/ipc-20240806.patch
Normal file
597
patches/ipc-20240806.patch
Normal file
@@ -0,0 +1,597 @@
|
||||
From 6c6d655b68770ce82a24fde9b58c4d97b672553a Mon Sep 17 00:00:00 2001
|
||||
From: choc <notchoc@proton.me>
|
||||
Date: Mon, 23 Oct 2023 10:35:17 +0800
|
||||
Subject: [PATCH] implement dwl-ipc-unstable-v2
|
||||
https://codeberg.org/dwl/dwl-patches/wiki/ipc
|
||||
|
||||
---
|
||||
Makefile | 14 +-
|
||||
config.def.h | 1 +
|
||||
dwl.c | 257 ++++++++++++++++++++++++++----
|
||||
protocols/dwl-ipc-unstable-v2.xml | 181 +++++++++++++++++++++
|
||||
4 files changed, 419 insertions(+), 34 deletions(-)
|
||||
create mode 100644 protocols/dwl-ipc-unstable-v2.xml
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 8db7409..a79a080 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -17,12 +17,14 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEV
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
||||
|
||||
all: dwl
|
||||
-dwl: dwl.o util.o
|
||||
- $(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
+dwl: dwl.o util.o dwl-ipc-unstable-v2-protocol.o
|
||||
+ $(CC) dwl.o util.o dwl-ipc-unstable-v2-protocol.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 \
|
||||
+ dwl-ipc-unstable-v2-protocol.h
|
||||
util.o: util.c util.h
|
||||
+dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.c dwl-ipc-unstable-v2-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
|
||||
@@ -45,6 +47,12 @@ wlr-output-power-management-unstable-v1-protocol.h:
|
||||
xdg-shell-protocol.h:
|
||||
$(WAYLAND_SCANNER) server-header \
|
||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
||||
+dwl-ipc-unstable-v2-protocol.h:
|
||||
+ $(WAYLAND_SCANNER) server-header \
|
||||
+ protocols/dwl-ipc-unstable-v2.xml $@
|
||||
+dwl-ipc-unstable-v2-protocol.c:
|
||||
+ $(WAYLAND_SCANNER) private-code \
|
||||
+ protocols/dwl-ipc-unstable-v2.xml $@
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..1593033 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -127,6 +127,7 @@ static const Key keys[] = {
|
||||
/* 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} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 8a587d1..7a4949b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -68,6 +68,7 @@
|
||||
#include <xcb/xcb_icccm.h>
|
||||
#endif
|
||||
|
||||
+#include "dwl-ipc-unstable-v2-protocol.h"
|
||||
#include "util.h"
|
||||
|
||||
/* macros */
|
||||
@@ -144,6 +145,12 @@ typedef struct {
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
+typedef struct {
|
||||
+ struct wl_list link;
|
||||
+ struct wl_resource *resource;
|
||||
+ Monitor *mon;
|
||||
+} DwlIpcOutput;
|
||||
+
|
||||
typedef struct {
|
||||
uint32_t mod;
|
||||
xkb_keysym_t keysym;
|
||||
@@ -189,6 +196,7 @@ typedef struct {
|
||||
|
||||
struct Monitor {
|
||||
struct wl_list link;
|
||||
+ struct wl_list dwl_ipc_outputs;
|
||||
struct wlr_output *wlr_output;
|
||||
struct wlr_scene_output *scene_output;
|
||||
struct wlr_scene_rect *fullscreen_bg; /* See createmon() for info */
|
||||
@@ -286,6 +294,17 @@ static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
+static void dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id);
|
||||
+static void dwl_ipc_manager_destroy(struct wl_resource *resource);
|
||||
+static void dwl_ipc_manager_get_output(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *output);
|
||||
+static void dwl_ipc_manager_release(struct wl_client *client, struct wl_resource *resource);
|
||||
+static void dwl_ipc_output_destroy(struct wl_resource *resource);
|
||||
+static void dwl_ipc_output_printstatus(Monitor *monitor);
|
||||
+static void dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output);
|
||||
+static void dwl_ipc_output_set_client_tags(struct wl_client *client, struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags);
|
||||
+static void dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index);
|
||||
+static void dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset);
|
||||
+static void dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource);
|
||||
static void focusclient(Client *c, int lift);
|
||||
static void focusmon(const Arg *arg);
|
||||
static void focusstack(const Arg *arg);
|
||||
@@ -338,6 +357,7 @@ static void startdrag(struct wl_listener *listener, void *data);
|
||||
static void tag(const Arg *arg);
|
||||
static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
+static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
@@ -411,6 +431,9 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
+static struct zdwl_ipc_manager_v2_interface dwl_manager_implementation = {.release = dwl_ipc_manager_release, .get_output = dwl_ipc_manager_get_output};
|
||||
+static struct zdwl_ipc_output_v2_interface dwl_output_implementation = {.release = dwl_ipc_output_release, .set_tags = dwl_ipc_output_set_tags, .set_layout = dwl_ipc_output_set_layout, .set_client_tags = dwl_ipc_output_set_client_tags};
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -703,6 +726,10 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
LayerSurface *l, *tmp;
|
||||
size_t i;
|
||||
|
||||
+ DwlIpcOutput *ipc_output, *ipc_output_tmp;
|
||||
+ wl_list_for_each_safe(ipc_output, ipc_output_tmp, &m->dwl_ipc_outputs, link)
|
||||
+ wl_resource_destroy(ipc_output->resource);
|
||||
+
|
||||
/* m->layers[i] are intentionally not unlinked */
|
||||
for (i = 0; i < LENGTH(m->layers); i++) {
|
||||
wl_list_for_each_safe(l, tmp, &m->layers[i], link)
|
||||
@@ -983,6 +1010,8 @@ createmon(struct wl_listener *listener, void *data)
|
||||
m = wlr_output->data = ecalloc(1, sizeof(*m));
|
||||
m->wlr_output = wlr_output;
|
||||
|
||||
+ wl_list_init(&m->dwl_ipc_outputs);
|
||||
+
|
||||
for (i = 0; i < LENGTH(m->layers); i++)
|
||||
wl_list_init(&m->layers[i]);
|
||||
|
||||
@@ -1334,6 +1363,192 @@ dirtomon(enum wlr_direction dir)
|
||||
return selmon;
|
||||
}
|
||||
|
||||
+void
|
||||
+dwl_ipc_manager_bind(struct wl_client *client, void *data, uint32_t version, uint32_t id)
|
||||
+{
|
||||
+ struct wl_resource *manager_resource = wl_resource_create(client, &zdwl_ipc_manager_v2_interface, version, id);
|
||||
+ if (!manager_resource) {
|
||||
+ wl_client_post_no_memory(client);
|
||||
+ return;
|
||||
+ }
|
||||
+ wl_resource_set_implementation(manager_resource, &dwl_manager_implementation, NULL, dwl_ipc_manager_destroy);
|
||||
+
|
||||
+ zdwl_ipc_manager_v2_send_tags(manager_resource, TAGCOUNT);
|
||||
+
|
||||
+ for (unsigned int i = 0; i < LENGTH(layouts); i++)
|
||||
+ zdwl_ipc_manager_v2_send_layout(manager_resource, layouts[i].symbol);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_manager_destroy(struct wl_resource *resource)
|
||||
+{
|
||||
+ /* No state to destroy */
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_manager_get_output(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *output)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ Monitor *monitor = wlr_output_from_resource(output)->data;
|
||||
+ struct wl_resource *output_resource = wl_resource_create(client, &zdwl_ipc_output_v2_interface, wl_resource_get_version(resource), id);
|
||||
+ if (!output_resource)
|
||||
+ return;
|
||||
+
|
||||
+ ipc_output = ecalloc(1, sizeof(*ipc_output));
|
||||
+ ipc_output->resource = output_resource;
|
||||
+ ipc_output->mon = monitor;
|
||||
+ wl_resource_set_implementation(output_resource, &dwl_output_implementation, ipc_output, dwl_ipc_output_destroy);
|
||||
+ wl_list_insert(&monitor->dwl_ipc_outputs, &ipc_output->link);
|
||||
+ dwl_ipc_output_printstatus_to(ipc_output);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_manager_release(struct wl_client *client, struct wl_resource *resource)
|
||||
+{
|
||||
+ wl_resource_destroy(resource);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+dwl_ipc_output_destroy(struct wl_resource *resource)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output = wl_resource_get_user_data(resource);
|
||||
+ wl_list_remove(&ipc_output->link);
|
||||
+ free(ipc_output);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_printstatus(Monitor *monitor)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ wl_list_for_each(ipc_output, &monitor->dwl_ipc_outputs, link)
|
||||
+ dwl_ipc_output_printstatus_to(ipc_output);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_printstatus_to(DwlIpcOutput *ipc_output)
|
||||
+{
|
||||
+ Monitor *monitor = ipc_output->mon;
|
||||
+ Client *c, *focused;
|
||||
+ int tagmask, state, numclients, focused_client, tag;
|
||||
+ const char *title, *appid;
|
||||
+ focused = focustop(monitor);
|
||||
+ zdwl_ipc_output_v2_send_active(ipc_output->resource, monitor == selmon);
|
||||
+
|
||||
+ for (tag = 0 ; tag < TAGCOUNT; tag++) {
|
||||
+ numclients = state = focused_client = 0;
|
||||
+ tagmask = 1 << tag;
|
||||
+ if ((tagmask & monitor->tagset[monitor->seltags]) != 0)
|
||||
+ state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_ACTIVE;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (c->mon != monitor)
|
||||
+ continue;
|
||||
+ if (!(c->tags & tagmask))
|
||||
+ continue;
|
||||
+ if (c == focused)
|
||||
+ focused_client = 1;
|
||||
+ if (c->isurgent)
|
||||
+ state |= ZDWL_IPC_OUTPUT_V2_TAG_STATE_URGENT;
|
||||
+
|
||||
+ numclients++;
|
||||
+ }
|
||||
+ zdwl_ipc_output_v2_send_tag(ipc_output->resource, tag, state, numclients, focused_client);
|
||||
+ }
|
||||
+ title = focused ? client_get_title(focused) : "";
|
||||
+ appid = focused ? client_get_appid(focused) : "";
|
||||
+
|
||||
+ zdwl_ipc_output_v2_send_layout(ipc_output->resource, monitor->lt[monitor->sellt] - layouts);
|
||||
+ zdwl_ipc_output_v2_send_title(ipc_output->resource, title);
|
||||
+ zdwl_ipc_output_v2_send_appid(ipc_output->resource, appid);
|
||||
+ zdwl_ipc_output_v2_send_layout_symbol(ipc_output->resource, monitor->ltsymbol);
|
||||
+ if (wl_resource_get_version(ipc_output->resource) >= ZDWL_IPC_OUTPUT_V2_FULLSCREEN_SINCE_VERSION) {
|
||||
+ zdwl_ipc_output_v2_send_fullscreen(ipc_output->resource, focused ? focused->isfullscreen : 0);
|
||||
+ }
|
||||
+ if (wl_resource_get_version(ipc_output->resource) >= ZDWL_IPC_OUTPUT_V2_FLOATING_SINCE_VERSION) {
|
||||
+ zdwl_ipc_output_v2_send_floating(ipc_output->resource, focused ? focused->isfloating : 0);
|
||||
+ }
|
||||
+ zdwl_ipc_output_v2_send_frame(ipc_output->resource);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_set_client_tags(struct wl_client *client, struct wl_resource *resource, uint32_t and_tags, uint32_t xor_tags)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ Monitor *monitor;
|
||||
+ Client *selected_client;
|
||||
+ unsigned int newtags = 0;
|
||||
+
|
||||
+ ipc_output = wl_resource_get_user_data(resource);
|
||||
+ if (!ipc_output)
|
||||
+ return;
|
||||
+
|
||||
+ monitor = ipc_output->mon;
|
||||
+ selected_client = focustop(monitor);
|
||||
+ if (!selected_client)
|
||||
+ return;
|
||||
+
|
||||
+ newtags = (selected_client->tags & and_tags) ^ xor_tags;
|
||||
+ if (!newtags)
|
||||
+ return;
|
||||
+
|
||||
+ selected_client->tags = newtags;
|
||||
+ if (selmon == monitor)
|
||||
+ focusclient(focustop(monitor), 1);
|
||||
+ arrange(selmon);
|
||||
+ printstatus();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ Monitor *monitor;
|
||||
+
|
||||
+ ipc_output = wl_resource_get_user_data(resource);
|
||||
+ if (!ipc_output)
|
||||
+ return;
|
||||
+
|
||||
+ monitor = ipc_output->mon;
|
||||
+ if (index >= LENGTH(layouts))
|
||||
+ return;
|
||||
+ if (index != monitor->lt[monitor->sellt] - layouts)
|
||||
+ monitor->sellt ^= 1;
|
||||
+
|
||||
+ monitor->lt[monitor->sellt] = &layouts[index];
|
||||
+ arrange(monitor);
|
||||
+ printstatus();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset)
|
||||
+{
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ Monitor *monitor;
|
||||
+ unsigned int newtags = tagmask & TAGMASK;
|
||||
+
|
||||
+ ipc_output = wl_resource_get_user_data(resource);
|
||||
+ if (!ipc_output)
|
||||
+ return;
|
||||
+ monitor = ipc_output->mon;
|
||||
+
|
||||
+ if (!newtags || newtags == monitor->tagset[monitor->seltags])
|
||||
+ return;
|
||||
+ if (toggle_tagset)
|
||||
+ monitor->seltags ^= 1;
|
||||
+
|
||||
+ monitor->tagset[monitor->seltags] = newtags;
|
||||
+ if (selmon == monitor)
|
||||
+ focusclient(focustop(monitor), 1);
|
||||
+ arrange(monitor);
|
||||
+ printstatus();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+dwl_ipc_output_release(struct wl_client *client, struct wl_resource *resource)
|
||||
+{
|
||||
+ wl_resource_destroy(resource);
|
||||
+}
|
||||
+
|
||||
void
|
||||
focusclient(Client *c, int lift)
|
||||
{
|
||||
@@ -2033,38 +2248,9 @@ void
|
||||
printstatus(void)
|
||||
{
|
||||
Monitor *m = NULL;
|
||||
- Client *c;
|
||||
- uint32_t occ, urg, sel;
|
||||
|
||||
- wl_list_for_each(m, &mons, link) {
|
||||
- occ = urg = 0;
|
||||
- wl_list_for_each(c, &clients, link) {
|
||||
- if (c->mon != m)
|
||||
- continue;
|
||||
- occ |= c->tags;
|
||||
- if (c->isurgent)
|
||||
- urg |= c->tags;
|
||||
- }
|
||||
- if ((c = focustop(m))) {
|
||||
- printf("%s title %s\n", m->wlr_output->name, client_get_title(c));
|
||||
- printf("%s appid %s\n", m->wlr_output->name, client_get_appid(c));
|
||||
- printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen);
|
||||
- printf("%s floating %d\n", m->wlr_output->name, c->isfloating);
|
||||
- sel = c->tags;
|
||||
- } else {
|
||||
- printf("%s title \n", m->wlr_output->name);
|
||||
- printf("%s appid \n", m->wlr_output->name);
|
||||
- printf("%s fullscreen \n", m->wlr_output->name);
|
||||
- printf("%s floating \n", m->wlr_output->name);
|
||||
- sel = 0;
|
||||
- }
|
||||
-
|
||||
- printf("%s selmon %u\n", m->wlr_output->name, m == selmon);
|
||||
- printf("%s tags %"PRIu32" %"PRIu32" %"PRIu32" %"PRIu32"\n",
|
||||
- m->wlr_output->name, occ, m->tagset[m->seltags], sel, urg);
|
||||
- printf("%s layout %s\n", m->wlr_output->name, m->ltsymbol);
|
||||
- }
|
||||
- fflush(stdout);
|
||||
+ wl_list_for_each(m, &mons, link)
|
||||
+ dwl_ipc_output_printstatus(m);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2584,6 +2770,8 @@ setup(void)
|
||||
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
|
||||
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
|
||||
|
||||
+ wl_global_create(dpy, &zdwl_ipc_manager_v2_interface, 2, NULL, dwl_ipc_manager_bind);
|
||||
+
|
||||
/* Make sure XWayland clients don't connect to the parent X server,
|
||||
* e.g when running in the x11 backend or the wayland backend and the
|
||||
* compositor has Xwayland support */
|
||||
@@ -2681,6 +2869,13 @@ tile(Monitor *m)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+togglebar(const Arg *arg) {
|
||||
+ DwlIpcOutput *ipc_output;
|
||||
+ wl_list_for_each(ipc_output, &selmon->dwl_ipc_outputs, link)
|
||||
+ zdwl_ipc_output_v2_send_toggle_visibility(ipc_output->resource);
|
||||
+}
|
||||
+
|
||||
void
|
||||
togglefloating(const Arg *arg)
|
||||
{
|
||||
diff --git a/protocols/dwl-ipc-unstable-v2.xml b/protocols/dwl-ipc-unstable-v2.xml
|
||||
new file mode 100644
|
||||
index 0000000..0a6e7e5
|
||||
--- /dev/null
|
||||
+++ b/protocols/dwl-ipc-unstable-v2.xml
|
||||
@@ -0,0 +1,181 @@
|
||||
+<?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_v2">
|
||||
+ <description summary="inter-proccess-communication about dwl's state">
|
||||
+ This protocol allows clients to update and get updates from dwl.
|
||||
+
|
||||
+ 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_v2" version="2">
|
||||
+ <description summary="manage dwl state">
|
||||
+ This interface is exposed as a global in wl_registry.
|
||||
+
|
||||
+ Clients can use this interface to get a dwl_ipc_output.
|
||||
+ After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
|
||||
+ The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
|
||||
+ </description>
|
||||
+
|
||||
+ <request name="release" type="destructor">
|
||||
+ <description summary="release dwl_ipc_manager">
|
||||
+ Indicates that the client will not the dwl_ipc_manager object anymore.
|
||||
+ Objects created through this instance are not affected.
|
||||
+ </description>
|
||||
+ </request>
|
||||
+
|
||||
+ <request name="get_output">
|
||||
+ <description summary="get a dwl_ipc_outout for a wl_output">
|
||||
+ Get a dwl_ipc_outout for the specified wl_output.
|
||||
+ </description>
|
||||
+ <arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
|
||||
+ <arg name="output" type="object" interface="wl_output"/>
|
||||
+ </request>
|
||||
+
|
||||
+ <event name="tags">
|
||||
+ <description summary="Announces tag amount">
|
||||
+ This event is sent after binding.
|
||||
+ A roundtrip after binding guarantees the client recieved all tags.
|
||||
+ </description>
|
||||
+ <arg name="amount" type="uint"/>
|
||||
+ </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_v2" version="2">
|
||||
+ <description summary="control dwl output">
|
||||
+ Observe and control a dwl output.
|
||||
+
|
||||
+ Events are double-buffered:
|
||||
+ Clients should cache events and redraw when a dwl_ipc_output.frame 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_ipc_outout">
|
||||
+ Indicates to that the client no longer needs this dwl_ipc_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="appid" since="1">
|
||||
+ <description summary="Update the appid.">
|
||||
+ Indicates the appid has changed.
|
||||
+ </description>
|
||||
+ <arg name="appid" type="string" summary="The new appid."/>
|
||||
+ </event>
|
||||
+
|
||||
+ <event name="layout_symbol" since="1">
|
||||
+ <description summary="Update the current layout symbol">
|
||||
+ Indicates the layout has changed. Since layout symbols are dynamic.
|
||||
+ As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
|
||||
+ You can ignore the zdwl_ipc_output.layout event.
|
||||
+ </description>
|
||||
+ <arg name="layout" type="string" summary="The new layout"/>
|
||||
+ </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_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>
|
||||
+
|
||||
+ <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_ipc_manager.layout"/>
|
||||
+ </request>
|
||||
+
|
||||
+ <!-- Version 2 -->
|
||||
+ <event name="fullscreen" since="2">
|
||||
+ <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="2">
|
||||
+ <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>
|
||||
--
|
||||
2.43.0
|
||||
|
97
patches/ipcpertag-20240729.patch
Normal file
97
patches/ipcpertag-20240729.patch
Normal file
@@ -0,0 +1,97 @@
|
||||
From c7d77ff4dec1da5a68b4da8aa42d4ed78dc41a00 Mon Sep 17 00:00:00 2001
|
||||
From: choc <notchoc@proton.me>
|
||||
Date: Thu, 14 Mar 2024 11:18:37 +0800
|
||||
Subject: [PATCH] fix ipc to work with pertag
|
||||
|
||||
---
|
||||
dwl.c | 50 +++++++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 35 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index a1a7809..d86e6e2 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1526,28 +1526,37 @@ void
|
||||
dwl_ipc_output_set_layout(struct wl_client *client, struct wl_resource *resource, uint32_t index)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
- Monitor *monitor;
|
||||
+ Client *c = NULL;
|
||||
+ Monitor *monitor = NULL;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
if (!ipc_output)
|
||||
return;
|
||||
-
|
||||
monitor = ipc_output->mon;
|
||||
+
|
||||
+ if (monitor != selmon)
|
||||
+ c = focustop(selmon);
|
||||
+
|
||||
if (index >= LENGTH(layouts))
|
||||
return;
|
||||
- if (index != monitor->lt[monitor->sellt] - layouts)
|
||||
- monitor->sellt ^= 1;
|
||||
|
||||
- monitor->lt[monitor->sellt] = &layouts[index];
|
||||
- arrange(monitor);
|
||||
- printstatus();
|
||||
+ if (c) {
|
||||
+ monitor = selmon;
|
||||
+ selmon = ipc_output->mon;
|
||||
+ }
|
||||
+ setlayout(&(Arg){.v = &layouts[index]});
|
||||
+ if (c) {
|
||||
+ selmon = monitor;
|
||||
+ focusclient(c, 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource, uint32_t tagmask, uint32_t toggle_tagset)
|
||||
{
|
||||
DwlIpcOutput *ipc_output;
|
||||
- Monitor *monitor;
|
||||
+ Client *c = NULL;
|
||||
+ Monitor *monitor = NULL;
|
||||
unsigned int newtags = tagmask & TAGMASK;
|
||||
|
||||
ipc_output = wl_resource_get_user_data(resource);
|
||||
@@ -1555,16 +1564,27 @@ dwl_ipc_output_set_tags(struct wl_client *client, struct wl_resource *resource,
|
||||
return;
|
||||
monitor = ipc_output->mon;
|
||||
|
||||
- if (!newtags || newtags == monitor->tagset[monitor->seltags])
|
||||
+ if (monitor != selmon)
|
||||
+ c = focustop(selmon);
|
||||
+
|
||||
+ if (!newtags)
|
||||
return;
|
||||
- if (toggle_tagset)
|
||||
+
|
||||
+ /* view toggles seltags for us so we un-toggle it */
|
||||
+ if (!toggle_tagset) {
|
||||
monitor->seltags ^= 1;
|
||||
+ monitor->tagset[monitor->seltags] = 0;
|
||||
+ }
|
||||
|
||||
- monitor->tagset[monitor->seltags] = newtags;
|
||||
- if (selmon == monitor)
|
||||
- focusclient(focustop(monitor), 1);
|
||||
- arrange(monitor);
|
||||
- printstatus();
|
||||
+ if (c) {
|
||||
+ monitor = selmon;
|
||||
+ selmon = ipc_output->mon;
|
||||
+ }
|
||||
+ view(&(Arg){.ui = newtags});
|
||||
+ if (c) {
|
||||
+ selmon = monitor;
|
||||
+ focusclient(c, 0);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.43.0
|
||||
|
27
patches/naturalscrolltrackpad-20240510.patch
Normal file
27
patches/naturalscrolltrackpad-20240510.patch
Normal file
@@ -0,0 +1,27 @@
|
||||
From 8b523453aefdc9d2920c8f9a52de009da251fbb0 Mon Sep 17 00:00:00 2001
|
||||
From: neuromagus <neuromagus@mail.ru>
|
||||
Date: Sun, 7 Jan 2024 05:11:24 +0300
|
||||
Subject: [PATCH] apply patch naturalscrolltrackpad
|
||||
|
||||
---
|
||||
dwl.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 4d19357..26f394b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -974,11 +974,10 @@ createpointer(struct wlr_pointer *pointer)
|
||||
libinput_device_config_tap_set_drag_enabled(device, tap_and_drag);
|
||||
libinput_device_config_tap_set_drag_lock_enabled(device, drag_lock);
|
||||
libinput_device_config_tap_set_button_map(device, button_map);
|
||||
+ if (libinput_device_config_scroll_has_natural_scroll(device))
|
||||
+ libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
|
||||
}
|
||||
|
||||
- if (libinput_device_config_scroll_has_natural_scroll(device))
|
||||
- libinput_device_config_scroll_set_natural_scroll_enabled(device, natural_scrolling);
|
||||
-
|
||||
if (libinput_device_config_dwt_is_available(device))
|
||||
libinput_device_config_dwt_set_enabled(device, disable_while_typing);
|
||||
|
84
patches/numlock-capslock-0.7.patch
Normal file
84
patches/numlock-capslock-0.7.patch
Normal file
@@ -0,0 +1,84 @@
|
||||
From cbacfb5031b91bc6677b0fb7c07dbe79cc2e0177 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@proton.me>
|
||||
Date: Sun, 4 Apr 2021 19:56:09 -0500
|
||||
Subject: [PATCH] add option to enable numlock/capslock
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
|
||||
---
|
||||
config.def.h | 4 ++++
|
||||
dwl.c | 19 +++++++++++++++++++
|
||||
2 files changed, 23 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171d..21dc6201 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -60,6 +60,10 @@ static const struct xkb_rule_names xkb_rules = {
|
||||
.options = NULL,
|
||||
};
|
||||
|
||||
+/* numlock and capslock */
|
||||
+static const int numlock = 1;
|
||||
+static const int capslock = 0;
|
||||
+
|
||||
static const int repeat_rate = 25;
|
||||
static const int repeat_delay = 600;
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index a2711f67..a11f0bcf 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/backend.h>
|
||||
#include <wlr/backend/libinput.h>
|
||||
+#include <wlr/interfaces/wlr_keyboard.h>
|
||||
#include <wlr/render/allocator.h>
|
||||
#include <wlr/render/wlr_renderer.h>
|
||||
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||
@@ -360,6 +361,7 @@ static void zoom(const Arg *arg);
|
||||
static const char broken[] = "broken";
|
||||
static pid_t child_pid = -1;
|
||||
static int locked;
|
||||
+static uint32_t locked_mods = 0;
|
||||
static void *exclusive_focus;
|
||||
static struct wl_display *dpy;
|
||||
static struct wl_event_loop *event_loop;
|
||||
@@ -877,6 +879,8 @@ createkeyboard(struct wlr_keyboard *keyboard)
|
||||
/* Set the keymap to match the group keymap */
|
||||
wlr_keyboard_set_keymap(keyboard, kb_group->wlr_group->keyboard.keymap);
|
||||
|
||||
+ wlr_keyboard_notify_modifiers(keyboard, 0, 0, locked_mods, 0);
|
||||
+
|
||||
/* Add the new keyboard to the group */
|
||||
wlr_keyboard_group_add_keyboard(kb_group->wlr_group, keyboard);
|
||||
}
|
||||
@@ -898,6 +902,21 @@ createkeyboardgroup(void)
|
||||
die("failed to compile keymap");
|
||||
|
||||
wlr_keyboard_set_keymap(&group->wlr_group->keyboard, keymap);
|
||||
+ if (numlock) {
|
||||
+ xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_NUM);
|
||||
+ if (mod_index != XKB_MOD_INVALID)
|
||||
+ locked_mods |= (uint32_t)1 << mod_index;
|
||||
+ }
|
||||
+
|
||||
+ if (capslock) {
|
||||
+ xkb_mod_index_t mod_index = xkb_keymap_mod_get_index(keymap, XKB_MOD_NAME_CAPS);
|
||||
+ if (mod_index != XKB_MOD_INVALID)
|
||||
+ locked_mods |= (uint32_t)1 << mod_index;
|
||||
+ }
|
||||
+
|
||||
+ if (locked_mods)
|
||||
+ wlr_keyboard_notify_modifiers(&group->wlr_group->keyboard, 0, 0, locked_mods, 0);
|
||||
+
|
||||
xkb_keymap_unref(keymap);
|
||||
xkb_context_unref(context);
|
||||
|
||||
--
|
||||
2.46.0
|
||||
|
170
patches/pertag-0.6.patch
Normal file
170
patches/pertag-0.6.patch
Normal file
@@ -0,0 +1,170 @@
|
||||
From d3b551ffe3ec85e16341962e322150b81af6722f Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Wed, 31 Jul 2024 08:27:26 -0500
|
||||
Subject: [PATCH] makes layout, mwfact and nmaster individual for every tag
|
||||
|
||||
inspiration: https://github.com/djpohly/dwl/wiki/pertag
|
||||
---
|
||||
dwl.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
1 file changed, 70 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 145fd01..2f364bc 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -102,6 +102,7 @@ typedef struct {
|
||||
const Arg arg;
|
||||
} Button;
|
||||
|
||||
+typedef struct Pertag Pertag;
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
@@ -199,6 +200,7 @@ struct Monitor {
|
||||
struct wlr_box w; /* window area, layout-relative */
|
||||
struct wl_list layers[4]; /* LayerSurface.link */
|
||||
const Layout *lt[2];
|
||||
+ Pertag *pertag;
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
uint32_t tagset[2];
|
||||
@@ -427,6 +429,14 @@ static xcb_atom_t netatom[NetLast];
|
||||
/* attempt to encapsulate suck into one file */
|
||||
#include "client.h"
|
||||
|
||||
+struct Pertag {
|
||||
+ unsigned int curtag, prevtag; /* current and previous tag */
|
||||
+ int nmasters[TAGCOUNT + 1]; /* number of windows in master area */
|
||||
+ float mfacts[TAGCOUNT + 1]; /* mfacts per tag */
|
||||
+ unsigned int sellts[TAGCOUNT + 1]; /* selected layouts */
|
||||
+ const Layout *ltidxs[TAGCOUNT + 1][2]; /* matrix of tags and layouts indexes */
|
||||
+};
|
||||
+
|
||||
/* function implementations */
|
||||
void
|
||||
applybounds(Client *c, struct wlr_box *bbox)
|
||||
@@ -712,6 +722,7 @@ cleanupmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_remove(output_layout, m->wlr_output);
|
||||
wlr_scene_output_destroy(m->scene_output);
|
||||
|
||||
+ free(m->pertag);
|
||||
closemon(m);
|
||||
wlr_scene_node_destroy(&m->fullscreen_bg->node);
|
||||
free(m);
|
||||
@@ -983,6 +994,18 @@ createmon(struct wl_listener *listener, void *data)
|
||||
wl_list_insert(&mons, &m->link);
|
||||
printstatus();
|
||||
|
||||
+ m->pertag = calloc(1, sizeof(Pertag));
|
||||
+ m->pertag->curtag = m->pertag->prevtag = 1;
|
||||
+
|
||||
+ for (i = 0; i <= TAGCOUNT; i++) {
|
||||
+ m->pertag->nmasters[i] = m->nmaster;
|
||||
+ m->pertag->mfacts[i] = m->mfact;
|
||||
+
|
||||
+ m->pertag->ltidxs[i][0] = m->lt[0];
|
||||
+ m->pertag->ltidxs[i][1] = m->lt[1];
|
||||
+ m->pertag->sellts[i] = m->sellt;
|
||||
+ }
|
||||
+
|
||||
/* The xdg-protocol specifies:
|
||||
*
|
||||
* If the fullscreened surface is not opaque, the compositor must make
|
||||
@@ -1472,7 +1495,7 @@ incnmaster(const Arg *arg)
|
||||
{
|
||||
if (!arg || !selmon)
|
||||
return;
|
||||
- selmon->nmaster = MAX(selmon->nmaster + arg->i, 0);
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MAX(selmon->nmaster + arg->i, 0);
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -2305,9 +2328,9 @@ setlayout(const Arg *arg)
|
||||
if (!selmon)
|
||||
return;
|
||||
if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
|
||||
- selmon->sellt ^= 1;
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
|
||||
if (arg && arg->v)
|
||||
- selmon->lt[selmon->sellt] = (Layout *)arg->v;
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
|
||||
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, LENGTH(selmon->ltsymbol));
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
@@ -2324,7 +2347,7 @@ setmfact(const Arg *arg)
|
||||
f = arg->f < 1.0f ? arg->f + selmon->mfact : arg->f - 1.0f;
|
||||
if (f < 0.1 || f > 0.9)
|
||||
return;
|
||||
- selmon->mfact = f;
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag] = f;
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
@@ -2701,9 +2724,29 @@ void
|
||||
toggleview(const Arg *arg)
|
||||
{
|
||||
uint32_t newtagset;
|
||||
+ size_t i;
|
||||
if (!(newtagset = selmon ? selmon->tagset[selmon->seltags] ^ (arg->ui & TAGMASK) : 0))
|
||||
return;
|
||||
|
||||
+ if (newtagset == (uint32_t)~0) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ }
|
||||
+
|
||||
+ /* test if the user did not select the same tag */
|
||||
+ if (!(newtagset & 1 << (selmon->pertag->curtag - 1))) {
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ for (i = 0; !(newtagset & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+
|
||||
+ /* apply settings for this view */
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
selmon->tagset[selmon->seltags] = newtagset;
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
@@ -2892,11 +2935,33 @@ urgent(struct wl_listener *listener, void *data)
|
||||
void
|
||||
view(const Arg *arg)
|
||||
{
|
||||
+ size_t i, tmptag;
|
||||
+
|
||||
if (!selmon || (arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
|
||||
return;
|
||||
selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
- if (arg->ui & TAGMASK)
|
||||
+ if (arg->ui & ~0) {
|
||||
selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+
|
||||
+ if (arg->ui == TAGMASK)
|
||||
+ selmon->pertag->curtag = 0;
|
||||
+ else {
|
||||
+ for (i = 0; !(arg->ui & 1 << i); i++) ;
|
||||
+ selmon->pertag->curtag = i + 1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ tmptag = selmon->pertag->prevtag;
|
||||
+ selmon->pertag->prevtag = selmon->pertag->curtag;
|
||||
+ selmon->pertag->curtag = tmptag;
|
||||
+ }
|
||||
+
|
||||
+ selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||
+ selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||
+ selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||
+ selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||
+
|
||||
focusclient(focustop(selmon), 1);
|
||||
arrange(selmon);
|
||||
printstatus();
|
||||
--
|
||||
2.45.2
|
||||
|
54
patches/setupenv-20240326.patch
Normal file
54
patches/setupenv-20240326.patch
Normal file
@@ -0,0 +1,54 @@
|
||||
From 11ee2fc23ef5728d1e132f338c08a7805c6109b2 Mon Sep 17 00:00:00 2001
|
||||
From: choc <notchoc@proton.me>
|
||||
Date: Tue, 26 Mar 2024 21:02:16 +0800
|
||||
Subject: [PATCH] implement setupenv
|
||||
|
||||
---
|
||||
config.def.h | 5 +++++
|
||||
dwl.c | 7 +++++++
|
||||
2 files changed, 12 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..b16189a 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -20,6 +20,11 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
+static const Env envs[] = {
|
||||
+ /* variable value */
|
||||
+ { "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
+};
|
||||
+
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
/* examples:
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 5867b0c..b7d522b 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -230,6 +230,11 @@ typedef struct {
|
||||
int monitor;
|
||||
} Rule;
|
||||
|
||||
+typedef struct {
|
||||
+ const char *variable;
|
||||
+ const char *value;
|
||||
+} Env;
|
||||
+
|
||||
typedef struct {
|
||||
struct wlr_scene_tree *scene;
|
||||
|
||||
@@ -2066,6 +2071,8 @@ run(char *startup_cmd)
|
||||
if (!socket)
|
||||
die("startup: display_add_socket_auto");
|
||||
setenv("WAYLAND_DISPLAY", socket, 1);
|
||||
+ for (size_t i = 0; i < LENGTH(envs); i++)
|
||||
+ setenv(envs[i].variable, envs[i].value, 1);
|
||||
|
||||
/* Start the backend. This will enumerate outputs and inputs, become the DRM
|
||||
* master, etc */
|
||||
--
|
||||
2.44.0
|
||||
|
181
protocols/dwl-ipc-unstable-v2.xml
Normal file
181
protocols/dwl-ipc-unstable-v2.xml
Normal file
@@ -0,0 +1,181 @@
|
||||
<?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_v2">
|
||||
<description summary="inter-proccess-communication about dwl's state">
|
||||
This protocol allows clients to update and get updates from dwl.
|
||||
|
||||
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_v2" version="2">
|
||||
<description summary="manage dwl state">
|
||||
This interface is exposed as a global in wl_registry.
|
||||
|
||||
Clients can use this interface to get a dwl_ipc_output.
|
||||
After binding the client will recieve the dwl_ipc_manager.tags and dwl_ipc_manager.layout events.
|
||||
The dwl_ipc_manager.tags and dwl_ipc_manager.layout events expose tags and layouts to the client.
|
||||
</description>
|
||||
|
||||
<request name="release" type="destructor">
|
||||
<description summary="release dwl_ipc_manager">
|
||||
Indicates that the client will not the dwl_ipc_manager object anymore.
|
||||
Objects created through this instance are not affected.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="get_output">
|
||||
<description summary="get a dwl_ipc_outout for a wl_output">
|
||||
Get a dwl_ipc_outout for the specified wl_output.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zdwl_ipc_output_v2"/>
|
||||
<arg name="output" type="object" interface="wl_output"/>
|
||||
</request>
|
||||
|
||||
<event name="tags">
|
||||
<description summary="Announces tag amount">
|
||||
This event is sent after binding.
|
||||
A roundtrip after binding guarantees the client recieved all tags.
|
||||
</description>
|
||||
<arg name="amount" type="uint"/>
|
||||
</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_v2" version="2">
|
||||
<description summary="control dwl output">
|
||||
Observe and control a dwl output.
|
||||
|
||||
Events are double-buffered:
|
||||
Clients should cache events and redraw when a dwl_ipc_output.frame 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_ipc_outout">
|
||||
Indicates to that the client no longer needs this dwl_ipc_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="appid" since="1">
|
||||
<description summary="Update the appid.">
|
||||
Indicates the appid has changed.
|
||||
</description>
|
||||
<arg name="appid" type="string" summary="The new appid."/>
|
||||
</event>
|
||||
|
||||
<event name="layout_symbol" since="1">
|
||||
<description summary="Update the current layout symbol">
|
||||
Indicates the layout has changed. Since layout symbols are dynamic.
|
||||
As opposed to the zdwl_ipc_manager.layout event, this should take precendence when displaying.
|
||||
You can ignore the zdwl_ipc_output.layout event.
|
||||
</description>
|
||||
<arg name="layout" type="string" summary="The new layout"/>
|
||||
</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_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>
|
||||
|
||||
<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_ipc_manager.layout"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 2 -->
|
||||
<event name="fullscreen" since="2">
|
||||
<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="2">
|
||||
<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>
|
270
protocols/wlr-foreign-toplevel-management-unstable-v1.xml
Normal file
270
protocols/wlr-foreign-toplevel-management-unstable-v1.xml
Normal file
@@ -0,0 +1,270 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_foreign_toplevel_management_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2018 Ilia Bozhinov
|
||||
|
||||
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.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_foreign_toplevel_manager_v1" version="3">
|
||||
<description summary="list and control opened apps">
|
||||
The purpose of this protocol is to enable the creation of taskbars
|
||||
and docks by providing them with a list of opened applications and
|
||||
letting them request certain actions on them, like maximizing, etc.
|
||||
|
||||
After a client binds the zwlr_foreign_toplevel_manager_v1, each opened
|
||||
toplevel window will be sent via the toplevel event
|
||||
</description>
|
||||
|
||||
<event name="toplevel">
|
||||
<description summary="a toplevel has been created">
|
||||
This event is emitted whenever a new toplevel window is created. It
|
||||
is emitted for all toplevels, regardless of the app that has created
|
||||
them.
|
||||
|
||||
All initial details of the toplevel(title, app_id, states, etc.) will
|
||||
be sent immediately after this event via the corresponding events in
|
||||
zwlr_foreign_toplevel_handle_v1.
|
||||
</description>
|
||||
<arg name="toplevel" type="new_id" interface="zwlr_foreign_toplevel_handle_v1"/>
|
||||
</event>
|
||||
|
||||
<request name="stop">
|
||||
<description summary="stop sending events">
|
||||
Indicates the client no longer wishes to receive events for new toplevels.
|
||||
However the compositor may emit further toplevel_created events, until
|
||||
the finished event is emitted.
|
||||
|
||||
The client must not send any more requests after this one.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="finished" type="destructor">
|
||||
<description summary="the compositor has finished with the toplevel manager">
|
||||
This event indicates that the compositor is done sending events to the
|
||||
zwlr_foreign_toplevel_manager_v1. The server will destroy the object
|
||||
immediately after sending this request, so it will become invalid and
|
||||
the client should free any resources associated with it.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_foreign_toplevel_handle_v1" version="3">
|
||||
<description summary="an opened toplevel">
|
||||
A zwlr_foreign_toplevel_handle_v1 object represents an opened toplevel
|
||||
window. Each app may have multiple opened toplevels.
|
||||
|
||||
Each toplevel has a list of outputs it is visible on, conveyed to the
|
||||
client with the output_enter and output_leave events.
|
||||
</description>
|
||||
|
||||
<event name="title">
|
||||
<description summary="title change">
|
||||
This event is emitted whenever the title of the toplevel changes.
|
||||
</description>
|
||||
<arg name="title" type="string"/>
|
||||
</event>
|
||||
|
||||
<event name="app_id">
|
||||
<description summary="app-id change">
|
||||
This event is emitted whenever the app-id of the toplevel changes.
|
||||
</description>
|
||||
<arg name="app_id" type="string"/>
|
||||
</event>
|
||||
|
||||
<event name="output_enter">
|
||||
<description summary="toplevel entered an output">
|
||||
This event is emitted whenever the toplevel becomes visible on
|
||||
the given output. A toplevel may be visible on multiple outputs.
|
||||
</description>
|
||||
<arg name="output" type="object" interface="wl_output"/>
|
||||
</event>
|
||||
|
||||
<event name="output_leave">
|
||||
<description summary="toplevel left an output">
|
||||
This event is emitted whenever the toplevel stops being visible on
|
||||
the given output. It is guaranteed that an entered-output event
|
||||
with the same output has been emitted before this event.
|
||||
</description>
|
||||
<arg name="output" type="object" interface="wl_output"/>
|
||||
</event>
|
||||
|
||||
<request name="set_maximized">
|
||||
<description summary="requests that the toplevel be maximized">
|
||||
Requests that the toplevel be maximized. If the maximized state actually
|
||||
changes, this will be indicated by the state event.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="unset_maximized">
|
||||
<description summary="requests that the toplevel be unmaximized">
|
||||
Requests that the toplevel be unmaximized. If the maximized state actually
|
||||
changes, this will be indicated by the state event.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_minimized">
|
||||
<description summary="requests that the toplevel be minimized">
|
||||
Requests that the toplevel be minimized. If the minimized state actually
|
||||
changes, this will be indicated by the state event.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="unset_minimized">
|
||||
<description summary="requests that the toplevel be unminimized">
|
||||
Requests that the toplevel be unminimized. If the minimized state actually
|
||||
changes, this will be indicated by the state event.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="activate">
|
||||
<description summary="activate the toplevel">
|
||||
Request that this toplevel be activated on the given seat.
|
||||
There is no guarantee the toplevel will be actually activated.
|
||||
</description>
|
||||
<arg name="seat" type="object" interface="wl_seat"/>
|
||||
</request>
|
||||
|
||||
<enum name="state">
|
||||
<description summary="types of states on the toplevel">
|
||||
The different states that a toplevel can have. These have the same meaning
|
||||
as the states with the same names defined in xdg-toplevel
|
||||
</description>
|
||||
|
||||
<entry name="maximized" value="0" summary="the toplevel is maximized"/>
|
||||
<entry name="minimized" value="1" summary="the toplevel is minimized"/>
|
||||
<entry name="activated" value="2" summary="the toplevel is active"/>
|
||||
<entry name="fullscreen" value="3" summary="the toplevel is fullscreen" since="2"/>
|
||||
</enum>
|
||||
|
||||
<event name="state">
|
||||
<description summary="the toplevel state changed">
|
||||
This event is emitted immediately after the zlw_foreign_toplevel_handle_v1
|
||||
is created and each time the toplevel state changes, either because of a
|
||||
compositor action or because of a request in this protocol.
|
||||
</description>
|
||||
|
||||
<arg name="state" type="array"/>
|
||||
</event>
|
||||
|
||||
<event name="done">
|
||||
<description summary="all information about the toplevel has been sent">
|
||||
This event is sent after all changes in the toplevel state have been
|
||||
sent.
|
||||
|
||||
This allows changes to the zwlr_foreign_toplevel_handle_v1 properties
|
||||
to be seen as atomic, even if they happen via multiple events.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="close">
|
||||
<description summary="request that the toplevel be closed">
|
||||
Send a request to the toplevel to close itself. The compositor would
|
||||
typically use a shell-specific method to carry out this request, for
|
||||
example by sending the xdg_toplevel.close event. However, this gives
|
||||
no guarantees the toplevel will actually be destroyed. If and when
|
||||
this happens, the zwlr_foreign_toplevel_handle_v1.closed event will
|
||||
be emitted.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<request name="set_rectangle">
|
||||
<description summary="the rectangle which represents the toplevel">
|
||||
The rectangle of the surface specified in this request corresponds to
|
||||
the place where the app using this protocol represents the given toplevel.
|
||||
It can be used by the compositor as a hint for some operations, e.g
|
||||
minimizing. The client is however not required to set this, in which
|
||||
case the compositor is free to decide some default value.
|
||||
|
||||
If the client specifies more than one rectangle, only the last one is
|
||||
considered.
|
||||
|
||||
The dimensions are given in surface-local coordinates.
|
||||
Setting width=height=0 removes the already-set rectangle.
|
||||
</description>
|
||||
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
<arg name="x" type="int"/>
|
||||
<arg name="y" type="int"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
</request>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_rectangle" value="0"
|
||||
summary="the provided rectangle is invalid"/>
|
||||
</enum>
|
||||
|
||||
<event name="closed">
|
||||
<description summary="this toplevel has been destroyed">
|
||||
This event means the toplevel has been destroyed. It is guaranteed there
|
||||
won't be any more events for this zwlr_foreign_toplevel_handle_v1. The
|
||||
toplevel itself becomes inert so any requests will be ignored except the
|
||||
destroy request.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy the zwlr_foreign_toplevel_handle_v1 object">
|
||||
Destroys the zwlr_foreign_toplevel_handle_v1 object.
|
||||
|
||||
This request should be called either when the client does not want to
|
||||
use the toplevel anymore or after the closed event to finalize the
|
||||
destruction of the object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<request name="set_fullscreen" since="2">
|
||||
<description summary="request that the toplevel be fullscreened">
|
||||
Requests that the toplevel be fullscreened on the given output. If the
|
||||
fullscreen state and/or the outputs the toplevel is visible on actually
|
||||
change, this will be indicated by the state and output_enter/leave
|
||||
events.
|
||||
|
||||
The output parameter is only a hint to the compositor. Also, if output
|
||||
is NULL, the compositor should decide which output the toplevel will be
|
||||
fullscreened on, if at all.
|
||||
</description>
|
||||
<arg name="output" type="object" interface="wl_output" allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<request name="unset_fullscreen" since="2">
|
||||
<description summary="request that the toplevel be unfullscreened">
|
||||
Requests that the toplevel be unfullscreened. If the fullscreen state
|
||||
actually changes, this will be indicated by the state event.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<!-- Version 3 additions -->
|
||||
|
||||
<event name="parent" since="3">
|
||||
<description summary="parent change">
|
||||
This event is emitted whenever the parent of the toplevel changes.
|
||||
|
||||
No event is emitted when the parent handle is destroyed by the client.
|
||||
</description>
|
||||
<arg name="parent" type="object" interface="zwlr_foreign_toplevel_handle_v1" allow-null="true"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
Reference in New Issue
Block a user