Compare commits
8 Commits
main
...
46529b1cf3
Author | SHA1 | Date | |
---|---|---|---|
|
46529b1cf3 | ||
|
1c66f4ca52 | ||
|
39c5f25405 | ||
|
8857c9c85b | ||
|
de482a613a | ||
|
3ce535f05c | ||
|
87b6cfbfe2 | ||
|
7cac496290 |
5
.envrc
5
.envrc
@@ -1,5 +0,0 @@
|
||||
export DIRENV_WARN_TIMEOUT=20s
|
||||
|
||||
eval "$(devenv direnvrc)"
|
||||
|
||||
use devenv
|
11
.gitignore
vendored
11
.gitignore
vendored
@@ -3,14 +3,3 @@ dwl
|
||||
*-protocol.c
|
||||
*-protocol.h
|
||||
.ccls-cache
|
||||
patches.h
|
||||
|
||||
# Devenv
|
||||
.devenv*
|
||||
devenv.local.nix
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
# pre-commit
|
||||
.pre-commit-config.yaml
|
||||
|
24
Makefile
24
Makefile
@@ -17,15 +17,12 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
|
||||
|
||||
all: dwl
|
||||
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 \
|
||||
dwl: dwl.o util.o
|
||||
$(CC) dwl.o util.o $(DWLCFLAGS) $(LDFLAGS) $(LDLIBS) -o $@
|
||||
dwl.o: dwl.c client.h config.h config.mk cursor-shape-v1-protocol.h \
|
||||
pointer-constraints-unstable-v1-protocol.h wlr-layer-shell-unstable-v1-protocol.h \
|
||||
wlr-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
|
||||
wlr-output-power-management-unstable-v1-protocol.h xdg-shell-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
|
||||
@@ -48,23 +45,11 @@ 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 $@
|
||||
patches.h:
|
||||
cp patches.def.h $@
|
||||
clean:
|
||||
rm -f dwl *.o *-protocol.h
|
||||
rm -f patches.h
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwl-$(VERSION)
|
||||
@@ -76,7 +61,6 @@ dist: clean
|
||||
|
||||
install: dwl
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
cp -f dwl $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
||||
|
1179
README.org
1179
README.org
File diff suppressed because it is too large
Load Diff
88
config.def.h
88
config.def.h
@@ -1,29 +1,16 @@
|
||||
/* Taken from https://github.com/djpohly/dwl/issues/466 */
|
||||
#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
|
||||
((hex >> 16) & 0xFF) / 255.0f, \
|
||||
((hex >> 8) & 0xFF) / 255.0f, \
|
||||
(hex & 0xFF) / 255.0f }
|
||||
((hex >> 16) & 0xFF) / 255.0f, \
|
||||
((hex >> 8) & 0xFF) / 255.0f, \
|
||||
(hex & 0xFF) / 255.0f }
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
#if VANITYGAPS_PATCH
|
||||
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
|
||||
#endif // VANITYGAPS_PATCH
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
#if VANITYGAPS_PATCH
|
||||
static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||
static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
#endif // VANITYGAPS_PATCH
|
||||
static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
#if FLOAT_UNFOCUSED_BORDER_COLOR_PATCH
|
||||
static const float floatcolor[] = COLOR(0xff0000ff);
|
||||
#endif // FLOAT_UNFOCUSED_BORDER_COLOR_PATCH
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
|
||||
@@ -33,28 +20,12 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
#if MENU_PATCH
|
||||
static const Menu menus[] = {
|
||||
/* command feed function action function */
|
||||
{ "rofi -dmenu -i", menuwinfeed, menuwinaction },
|
||||
{ "rofi -dmenu -i", menulayoutfeed, menulayoutaction },
|
||||
};
|
||||
#endif // MENU_PATCH
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
/* Autostart */
|
||||
#if AUTOSTART_PATCH
|
||||
static const char *const autostart[] = {
|
||||
"wbg", "/path/to/your/image", NULL,
|
||||
NULL /* terminate */
|
||||
"wbg", "/path/to/your/image", NULL,
|
||||
NULL /* terminate */
|
||||
};
|
||||
#endif // AUTOSTART_PATCH
|
||||
|
||||
|
||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||
static const Rule rules[] = {
|
||||
@@ -70,9 +41,6 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
#if GAPLESSGRID_PATCH
|
||||
{ "###", gaplessgrid },
|
||||
#endif // GAPLESSGRID_PATCH
|
||||
};
|
||||
|
||||
/* monitors */
|
||||
@@ -99,12 +67,6 @@ 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;
|
||||
|
||||
@@ -116,9 +78,6 @@ static const int natural_scrolling = 0;
|
||||
static const int disable_while_typing = 1;
|
||||
static const int left_handed = 0;
|
||||
static const int middle_button_emulation = 0;
|
||||
#if UNCLUTTER_PATCH
|
||||
static const int cursor_timeout = 5;
|
||||
#endif // UNCLUTTER_PATCH
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
||||
LIBINPUT_CONFIG_SCROLL_2FG
|
||||
@@ -175,56 +134,21 @@ 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} },
|
||||
#if MOVESTACK_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, movestack, {.i = +1} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, movestack, {.i = -1} },
|
||||
#endif // MOVESTACK_PATCH
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||
#if VANITYGAPS_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
|
||||
{ MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
|
||||
{ MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
|
||||
#endif // VANITYGAPS_PATCH
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
#if GAPLESSGRID_PATCH
|
||||
{ MODKEY, XKB_KEY_g, setlayout, {.v = &layouts[3]} },
|
||||
#endif // GAPLESSGRID_PATCH
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
#if MENU_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT|WLR_MODIFIER_CTRL, XKB_KEY_p, menu, {.v = &menus[0]} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_P, menu, {.v = &menus[1]} },
|
||||
#endif // MENU_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
#if FAKE_FULLSCREEN_CLIENT_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, togglefakefullscreen, {0} },
|
||||
#endif // FAKE_FULLSCREEN_CLIENT_PATCH
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
|
121
config.h
121
config.h
@@ -5,24 +5,11 @@
|
||||
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
#if VANITYGAPS_PATCH
|
||||
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
|
||||
#endif // VANITYGAPS_PATCH
|
||||
static const unsigned int borderpx = 2; /* border pixel of windows */
|
||||
#if VANITYGAPS_PATCH
|
||||
static const unsigned int gappih = 20; /* horiz inner gap between windows */
|
||||
static const unsigned int gappiv = 20; /* vert inner gap between windows */
|
||||
static const unsigned int gappoh = 30; /* horiz outer gap between windows and screen edge */
|
||||
static const unsigned int gappov = 30; /* vert outer gap between windows and screen edge */
|
||||
#endif // VANITYGAPS_PATCH
|
||||
static const float rootcolor[] = COLOR(0x282a36ff);
|
||||
static const float bordercolor[] = COLOR(0x4d4d4dff);
|
||||
static const float focuscolor[] = COLOR(0xbd93f9ff);
|
||||
static const float urgentcolor[] = COLOR(0xff5555ff);
|
||||
#if FLOAT_UNFOCUSED_BORDER_COLOR_PATCH
|
||||
static const float floatcolor[] = COLOR(0xff79c6ff);
|
||||
#endif // FLOAT_UNFOCUSED_BORDER_COLOR_PATCH
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
|
||||
@@ -31,47 +18,27 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
#if MENU_PATCH
|
||||
static const Menu menus[] = {
|
||||
/* command feed function action function */
|
||||
{ "rofi -dmenu -i", menuwinfeed, menuwinaction },
|
||||
{ "rofi -dmenu -i", menulayoutfeed, menulayoutaction },
|
||||
};
|
||||
#endif // MENU_PATCH
|
||||
|
||||
#if SETUPENV_PATCH
|
||||
static const Env envs[] = {
|
||||
/* variable value */
|
||||
{ "XDG_CURRENT_DESKTOP", "wlroots" },
|
||||
};
|
||||
#endif // SETUPENV_PATCH
|
||||
|
||||
#if AUTOSTART_PATCH
|
||||
static const char *const autostart[] = {
|
||||
"wbg", "/path/to/your/image", NULL,
|
||||
NULL /* terminate */
|
||||
"/usr/bin/shikane", NULL,
|
||||
"/usr/bin/bash", "/home/sravan/.azotebg", NULL,
|
||||
"/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/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
|
||||
|
||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
{ "thunderbird-esr", NULL, 1 << 0, 0, -1 }, /* Start on ONLY tag "1" */
|
||||
{ "Beeper", NULL, 1 << 1, 0, -1 }, /* Start on ONLY tag "2" */
|
||||
{ "zoom", NULL, 1 << 1, 0, -1 }, /* Start on ONLY tag "2" */
|
||||
{ "Signal", NULL, 1 << 1, 0, -1 }, /* Start on ONLY tag "2" */
|
||||
{ "discord", NULL, 1 << 1, 0, -1 }, /* Start on ONLY tag "2" */
|
||||
{ "obsidian", NULL, 1 << 2, 0, -1 }, /* Start on ONLY tag "3" */
|
||||
{ "pocket-casts-linux", NULL, 1 << 3, 0, -1 }, /* Start on ONLY tag "4" */
|
||||
{ "Spotify", NULL, 1 << 3, 0, -1 }, /* Start on ONLY tag "4" */
|
||||
{ "Vivaldi-stable", NULL, 1 << 4, 0, -1 }, /* Start on ONLY tag "5" */
|
||||
{ "foot", NULL, 1 << 5, 0, -1 }, /* Start on ONLY tag "6" */
|
||||
{ "Emacs", NULL, 1 << 6, 0, -1 }, /* Start on ONLY tag "7" */
|
||||
{ "steam", NULL, 1 << 7, 0, -1 }, /* Start on ONLY tag "8" */
|
||||
{ "lutris", NULL, 1 << 7, 0, -1 }, /* Start on ONLY tag "8" */
|
||||
{ "net.davidotek.pupgui2", NULL, 1 << 7, 0, -1 }, /* Start on ONLY tag "8" */
|
||||
{ "gamescope", NULL, 1 << 7, 0, -1 }, /* Start on ONLY tag "8" */
|
||||
{ "syncthing-gtk", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||
{ "openrgb", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
/* examples: */
|
||||
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
||||
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
||||
};
|
||||
|
||||
static const Layout layouts[] = {
|
||||
@@ -79,9 +46,6 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
#if GAPLESSGRID_PATCH
|
||||
{ "###", gaplessgrid },
|
||||
#endif // GAPLESSGRID_PATCH
|
||||
};
|
||||
|
||||
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
|
||||
@@ -106,26 +70,16 @@ 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 = 1;
|
||||
static const int natural_scrolling = 0;
|
||||
static const int disable_while_typing = 1;
|
||||
static const int left_handed = 0;
|
||||
static const int middle_button_emulation = 0;
|
||||
#if UNCLUTTER_PATCH
|
||||
static const int cursor_timeout = 5;
|
||||
#endif // UNCLUTTER_PATCH
|
||||
|
||||
/* You can choose between:
|
||||
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
||||
LIBINPUT_CONFIG_SCROLL_2FG
|
||||
@@ -173,64 +127,29 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||
|
||||
static const char *termcmd[] = { "foot", NULL };
|
||||
static const char *menucmd[] = { "rofi", "-show", "combi", NULL };
|
||||
static const char *termcmd[] = { "kitty", NULL };
|
||||
static const char *menucmd[] = { "fuzzel", 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} },
|
||||
#if MOVESTACK_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, movestack, {.i = +1} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, movestack, {.i = -1} },
|
||||
#endif // MOVESTACK_PATCH
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||
#if VANITYGAPS_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_ALT, XKB_KEY_h, incgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT, XKB_KEY_l, incgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT, XKB_KEY_0, togglegaps, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_ALT|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
|
||||
{ MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
|
||||
{ MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT, XKB_KEY_y, incohgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_ALT, XKB_KEY_o, incohgaps, {.i = -1 } },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
|
||||
#endif // VANITYGAPS_PATCH
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
#if GAPLESSGRID_PATCH
|
||||
{ MODKEY, XKB_KEY_g, setlayout, {.v = &layouts[3]} },
|
||||
#endif // GAPLESSGRID_PATCH
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
#if MENU_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT|WLR_MODIFIER_CTRL, XKB_KEY_p, menu, {.v = &menus[0]} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_P, menu, {.v = &menus[1]} },
|
||||
#endif // MENU_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
#if FAKE_FULLSCREEN_CLIENT_PATCH
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, togglefakefullscreen, {0} },
|
||||
#endif // FAKE_FULLSCREEN_CLIENT_PATCH
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
|
103
devenv.lock
103
devenv.lock
@@ -1,103 +0,0 @@
|
||||
{
|
||||
"nodes": {
|
||||
"devenv": {
|
||||
"locked": {
|
||||
"dir": "src/modules",
|
||||
"lastModified": 1745604263,
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"rev": "36807c727e743e7a00999922e7f737a0cc4e05ac",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "src/modules",
|
||||
"owner": "cachix",
|
||||
"repo": "devenv",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1733328505,
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"git-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1742649964,
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"rev": "dcf5072734cb576d2b0c59b2ac44f5050b5eac82",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"repo": "git-hooks.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"gitignore": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"git-hooks",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709087332,
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "gitignore.nix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1733477122,
|
||||
"owner": "cachix",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "cachix",
|
||||
"ref": "rolling",
|
||||
"repo": "devenv-nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"devenv": "devenv",
|
||||
"git-hooks": "git-hooks",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"pre-commit-hooks": [
|
||||
"git-hooks"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
19
devenv.nix
19
devenv.nix
@@ -1,19 +0,0 @@
|
||||
{ pkgs, lib, config, inputs, ... }:
|
||||
|
||||
{
|
||||
# https://devenv.sh/packages/
|
||||
packages = [
|
||||
pkgs.git
|
||||
pkgs.yaml-language-server
|
||||
pkgs.gdb
|
||||
];
|
||||
|
||||
# https://devenv.sh/languages/
|
||||
languages.c = {
|
||||
enable = true;
|
||||
debugger = pkgs.gdb;
|
||||
};
|
||||
languages.cplusplus = {
|
||||
enable = true;
|
||||
};
|
||||
}
|
15
devenv.yaml
15
devenv.yaml
@@ -1,15 +0,0 @@
|
||||
# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json
|
||||
inputs:
|
||||
nixpkgs:
|
||||
url: github:cachix/devenv-nixpkgs/rolling
|
||||
|
||||
# If you're using non-OSS software, you can set allowUnfree to true.
|
||||
# allowUnfree: true
|
||||
|
||||
# If you're willing to use a package that's vulnerable
|
||||
# permittedInsecurePackages:
|
||||
# - "openssl-1.1.1w"
|
||||
|
||||
# If you have more than one devenv you can merge them
|
||||
#imports:
|
||||
# - ./backend
|
4
justfile
4
justfile
@@ -7,7 +7,3 @@ default:
|
||||
# Rebuild project
|
||||
dwl-rebuild:
|
||||
sudo make clean all
|
||||
|
||||
# Run waybar with dwl configuration
|
||||
dwl-launch-waybar:
|
||||
./waybar/launch.sh
|
||||
|
@@ -1,35 +0,0 @@
|
||||
#define ALWAYSCENTER_PATCH 1
|
||||
|
||||
#define ATTACHTOP_PATCH 1
|
||||
|
||||
#define AUTOSTART_PATCH 0
|
||||
|
||||
#define FAKE_FULLSCREEN_CLIENT_PATCH 1
|
||||
|
||||
#define FLOAT_UNFOCUSED_BORDER_COLOR_PATCH 1
|
||||
|
||||
#define FOREIGN_TOPLEVEL_MANAGEMENT_PATCH 1
|
||||
|
||||
#define GAPLESSGRID_PATCH 1
|
||||
|
||||
#define IPC_PATCH 1
|
||||
|
||||
#define MENU_PATCH 1
|
||||
|
||||
#define MOVESTACK_PATCH 1
|
||||
|
||||
#define NATURALSCROLLTRACKPAD_PATCH 1
|
||||
|
||||
#define NUMLOCK_CAPSLOCK_PATCH 1
|
||||
|
||||
#define PERTAG_PATCH 1
|
||||
|
||||
#define RESTORE_MONITOR_PATCH 1
|
||||
|
||||
#define SETUPENV_PATCH 0
|
||||
|
||||
#define UNCLUTTER_PATCH 1
|
||||
|
||||
#define VANITYGAPS_PATCH 1
|
||||
|
||||
#define WARPCURSOR_PATCH 1
|
@@ -1,38 +0,0 @@
|
||||
From 6616470ef135019ef4c767003a66df76df45f53e Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Wed, 5 Jun 2024 12:05:16 +0200
|
||||
Subject: [PATCH] center floating windows
|
||||
|
||||
---
|
||||
dwl.c | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 6f041a0..79ace52 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -472,6 +472,10 @@ applyrules(Client *c)
|
||||
}
|
||||
}
|
||||
}
|
||||
+ if (mon) {
|
||||
+ c->geom.x = (mon->w.width - c->geom.width) / 2 + mon->m.x;
|
||||
+ c->geom.y = (mon->w.height - c->geom.height) / 2 + mon->m.y;
|
||||
+ }
|
||||
setmon(c, mon, newtags);
|
||||
}
|
||||
|
||||
@@ -1677,6 +1681,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
* try to apply rules for them */
|
||||
if ((p = client_get_parent(c))) {
|
||||
c->isfloating = 1;
|
||||
+ if (p->mon) {
|
||||
+ c->geom.x = (p->mon->w.width - c->geom.width) / 2 + p->mon->m.x;
|
||||
+ c->geom.y = (p->mon->w.height - c->geom.height) / 2 + p->mon->m.y;
|
||||
+ }
|
||||
setmon(c, p->mon, p->tags);
|
||||
} else {
|
||||
applyrules(c);
|
||||
--
|
||||
2.45.1
|
||||
|
@@ -1,36 +0,0 @@
|
||||
From 42a66d6e06c38e913766ce625f049fdbc3dd0d12 Mon Sep 17 00:00:00 2001
|
||||
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||
Date: Sun, 7 Apr 2024 21:10:17 +0200
|
||||
Subject: [PATCH] New client are attached on top of the stack
|
||||
|
||||
---
|
||||
dwl.c | 13 ++++++++++++-
|
||||
1 file changed, 12 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..c0a3d74 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1605,7 +1605,18 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
c->geom.height += 2 * c->bw;
|
||||
|
||||
/* Insert this client into client lists. */
|
||||
- wl_list_insert(&clients, &c->link);
|
||||
+ i = 0;
|
||||
+ wl_list_for_each(w, &clients, link) {
|
||||
+ if (!VISIBLEON(w, selmon) || c->isfloating)
|
||||
+ continue;
|
||||
+ p = w;
|
||||
+ if (++i >= selmon->nmaster)
|
||||
+ break;
|
||||
+ }
|
||||
+ if (i > 0)
|
||||
+ wl_list_insert(&p->link, &c->link);
|
||||
+ else
|
||||
+ wl_list_insert(&clients, &c->link);
|
||||
wl_list_insert(&fstack, &c->flink);
|
||||
|
||||
/* Set initial monitor, tags, floating status, and focus:
|
||||
--
|
||||
2.44.0
|
||||
|
@@ -1,87 +0,0 @@
|
||||
From 2ec6d0c668b4daee601337f8da45ccfa3a7d5fc6 Mon Sep 17 00:00:00 2001
|
||||
From: choc <notchoc@proton.me>
|
||||
Date: Fri, 29 Mar 2024 22:50:00 +0800
|
||||
Subject: [PATCH] implement fakefullscreenclient
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 23 ++++++++++++++++++++++-
|
||||
2 files changed, 23 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 9009517..8c220eb 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -137,6 +137,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_E, togglefakefullscreen, {0} },
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 5867b0c..1e78491 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -137,7 +137,7 @@ typedef struct {
|
||||
#endif
|
||||
unsigned int bw;
|
||||
uint32_t tags;
|
||||
- int isfloating, isurgent, isfullscreen;
|
||||
+ int isfloating, isurgent, isfullscreen, isfakefullscreen;
|
||||
uint32_t resize; /* configure serial of a pending resize */
|
||||
} Client;
|
||||
|
||||
@@ -318,6 +318,7 @@ static void setcursor(struct wl_listener *listener, void *data);
|
||||
static void setcursorshape(struct wl_listener *listener, void *data);
|
||||
static void setfloating(Client *c, int floating);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
+static void setfakefullscreen(Client *c, int fullscreen);
|
||||
static void setgamma(struct wl_listener *listener, void *data);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
@@ -332,6 +333,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
+static void togglefakefullscreen(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -2181,6 +2183,17 @@ setfullscreen(Client *c, int fullscreen)
|
||||
printstatus();
|
||||
}
|
||||
|
||||
+void
|
||||
+setfakefullscreen(Client *c, int fullscreen)
|
||||
+{
|
||||
+ c->isfakefullscreen = fullscreen;
|
||||
+ if (!c->mon)
|
||||
+ return;
|
||||
+ if (c->isfullscreen)
|
||||
+ setfullscreen(c, 0);
|
||||
+ client_set_fullscreen(c, fullscreen);
|
||||
+}
|
||||
+
|
||||
void
|
||||
setgamma(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -2620,6 +2633,14 @@ togglefullscreen(const Arg *arg)
|
||||
setfullscreen(sel, !sel->isfullscreen);
|
||||
}
|
||||
|
||||
+void
|
||||
+togglefakefullscreen(const Arg *arg)
|
||||
+{
|
||||
+ Client *sel = focustop(selmon);
|
||||
+ if (sel)
|
||||
+ setfakefullscreen(sel, !sel->isfakefullscreen);
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.44.0
|
||||
|
@@ -1,60 +0,0 @@
|
||||
From 591c031a4d8e62acfef4ef41816c1fbbb8b1473a Mon Sep 17 00:00:00 2001
|
||||
From: yuki <yukiat@proton.me>
|
||||
Date: Fri, 7 Jun 2024 11:44:37 +0800
|
||||
Subject: [PATCH] Added float-unfocused-border-color patch.
|
||||
|
||||
---
|
||||
config.def.h | 1 +
|
||||
dwl.c | 11 ++++++++---
|
||||
2 files changed, 9 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a784eb4..8131af5 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -11,6 +11,7 @@ static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||
+static const float floatcolor[] = COLOR(0xff0000ff);
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You can also use glsl colors */
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 6f041a0..777c0e1 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -632,6 +632,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
+ grabc = NULL;
|
||||
return;
|
||||
} else {
|
||||
cursor_mode = CurNormal;
|
||||
@@ -1348,9 +1349,8 @@ focusclient(Client *c, int lift)
|
||||
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
|
||||
* and probably other clients */
|
||||
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
|
||||
- client_set_border_color(old_c, bordercolor);
|
||||
-
|
||||
- client_activate_surface(old, 0);
|
||||
+ client_set_border_color(old_c, old_c->isfloating ? floatcolor : bordercolor);
|
||||
+ client_activate_surface(old, 0);
|
||||
}
|
||||
}
|
||||
printstatus();
|
||||
@@ -2218,6 +2218,11 @@ setfloating(Client *c, int floating)
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||
(p && p->isfullscreen) ? LyrFS
|
||||
: c->isfloating ? LyrFloat : LyrTile]);
|
||||
+ if (!grabc && floating)
|
||||
+ for (int i = 0; i < 4; i++) {
|
||||
+ wlr_scene_rect_set_color(c->border[i], floatcolor);
|
||||
+ wlr_scene_node_lower_to_bottom(&c->border[i]->node);
|
||||
+ }
|
||||
arrange(c->mon);
|
||||
printstatus();
|
||||
}
|
||||
--
|
||||
2.45.2
|
@@ -1,507 +0,0 @@
|
||||
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
|
||||
|
@@ -1,89 +0,0 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..014a909 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -34,6 +34,7 @@ static const Layout layouts[] = {
|
||||
{ "[]=", tile },
|
||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||
{ "[M]", monocle },
|
||||
+ { "###", gaplessgrid },
|
||||
};
|
||||
|
||||
/* monitors */
|
||||
@@ -139,6 +140,7 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
+ { MODKEY, XKB_KEY_g, setlayout, {.v = &layouts[3]} },
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index dc0c861..875d8cd 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -292,6 +292,7 @@ static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
+static void gaplessgrid(Monitor *m);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
@@ -1510,6 +1511,56 @@ handlesig(int signo)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+gaplessgrid(Monitor *m)
|
||||
+{
|
||||
+ unsigned int n = 0, i = 0, ch, cw, cn, rn, rows, cols;
|
||||
+ Client *c;
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link)
|
||||
+ if (VISIBLEON(c, m) && !c->isfloating)
|
||||
+ n++;
|
||||
+ if (n == 0)
|
||||
+ return;
|
||||
+
|
||||
+ /* grid dimensions */
|
||||
+ for (cols = 0; cols <= (n / 2); cols++)
|
||||
+ if ((cols * cols) >= n)
|
||||
+ break;
|
||||
+
|
||||
+ if (n == 5) /* set layout against the general calculation: not 1:2:2, but 2:3 */
|
||||
+ cols = 2;
|
||||
+
|
||||
+ /* widescreen is better if 3 columns */
|
||||
+ if (n >= 3 && n <= 6 && (m->w.width / m->w.height) > 1)
|
||||
+ cols = 3;
|
||||
+
|
||||
+ rows = n / cols;
|
||||
+
|
||||
+ /* window geometries */
|
||||
+ cw = cols ? m->w.width / cols : m->w.width;
|
||||
+ cn = 0; /* current column number */
|
||||
+ rn = 0; /* current row number */
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ unsigned int cx, cy;
|
||||
+ if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
+ continue;
|
||||
+
|
||||
+ if ((i / rows + 1) > (cols - n % cols))
|
||||
+ rows = n / cols + 1;
|
||||
+ ch = rows ? m->w.height / rows : m->w.height;
|
||||
+ cx = m->w.x + cn * cw;
|
||||
+ cy = m->w.y + rn * ch;
|
||||
+ resize(c, (struct wlr_box) { cx, cy, cw, ch}, 0);
|
||||
+ rn++;
|
||||
+ if (rn >= rows) {
|
||||
+ rn = 0;
|
||||
+ cn++;
|
||||
+ }
|
||||
+ i++;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
@@ -1,597 +0,0 @@
|
||||
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
|
||||
|
@@ -1,97 +0,0 @@
|
||||
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
|
||||
|
@@ -1,230 +0,0 @@
|
||||
commit 2d7e19dc948aec61746fd858394a9c80d34a3216
|
||||
Author: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
|
||||
Date: Sat Jul 13 01:05:20 2024 +0200
|
||||
|
||||
Add menu command
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..ecd2c67 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -20,6 +20,12 @@ static const float fullscreen_bg[] = {0.1f, 0.1f, 0.1f, 1.0f}; /* You ca
|
||||
/* logging */
|
||||
static int log_level = WLR_ERROR;
|
||||
|
||||
+static const Menu menus[] = {
|
||||
+ /* command feed function action function */
|
||||
+ { "wmenu -i -l 5 -p Windows", menuwinfeed, menuwinaction },
|
||||
+ { "wmenu -i -p Layouts", menulayoutfeed, menulayoutaction },
|
||||
+};
|
||||
+
|
||||
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
||||
static const Rule rules[] = {
|
||||
/* app_id title tags mask isfloating monitor */
|
||||
@@ -140,6 +146,8 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
||||
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
||||
+ { MODKEY, XKB_KEY_o, menu, {.v = &menus[0]} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, menu, {.v = &menus[1]} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index dc0437e..90bb09a 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -241,6 +241,12 @@ typedef struct {
|
||||
struct wl_listener destroy;
|
||||
} SessionLock;
|
||||
|
||||
+typedef struct {
|
||||
+ const char *cmd; /* command to run a menu */
|
||||
+ void (*feed)(FILE *f); /* feed input to menu */
|
||||
+ void (*action)(char *line); /* do action based on menu output */
|
||||
+} Menu;
|
||||
+
|
||||
/* function declarations */
|
||||
static void applybounds(Client *c, struct wlr_box *bbox);
|
||||
static void applyrules(Client *c);
|
||||
@@ -298,6 +304,12 @@ static void killclient(const Arg *arg);
|
||||
static void locksession(struct wl_listener *listener, void *data);
|
||||
static void mapnotify(struct wl_listener *listener, void *data);
|
||||
static void maximizenotify(struct wl_listener *listener, void *data);
|
||||
+static void menu(const Arg *arg);
|
||||
+static int menuloop(void *data);
|
||||
+static void menuwinfeed(FILE *f);
|
||||
+static void menuwinaction(char *line);
|
||||
+static void menulayoutfeed(FILE *f);
|
||||
+static void menulayoutaction(char *line);
|
||||
static void monocle(Monitor *m);
|
||||
static void motionabsolute(struct wl_listener *listener, void *data);
|
||||
static void motionnotify(uint32_t time, struct wlr_input_device *device, double sx,
|
||||
@@ -408,6 +420,11 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
+static struct wl_event_source *menu_source;
|
||||
+static pid_t menu_pid;
|
||||
+static int menu_fd;
|
||||
+static const Menu *menu_current;
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -675,6 +692,7 @@ cleanup(void)
|
||||
wlr_xwayland_destroy(xwayland);
|
||||
xwayland = NULL;
|
||||
#endif
|
||||
+ wl_event_source_remove(menu_source);
|
||||
wl_display_destroy_clients(dpy);
|
||||
if (child_pid > 0) {
|
||||
kill(-child_pid, SIGTERM);
|
||||
@@ -1717,6 +1735,136 @@ maximizenotify(struct wl_listener *listener, void *data)
|
||||
wlr_xdg_surface_schedule_configure(c->surface.xdg);
|
||||
}
|
||||
|
||||
+void
|
||||
+menu(const Arg *arg)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ pid_t pid;
|
||||
+ int fd_right[2], fd_left[2];
|
||||
+
|
||||
+ if (!selmon || menu_pid != 0)
|
||||
+ return;
|
||||
+
|
||||
+ menu_current = arg->v;
|
||||
+
|
||||
+ if (pipe(fd_right) == -1 || pipe(fd_left) == -1)
|
||||
+ return;
|
||||
+ if ((pid = fork()) == -1)
|
||||
+ return;
|
||||
+ if (pid == 0) {
|
||||
+ close(fd_right[1]);
|
||||
+ close(fd_left[0]);
|
||||
+ dup2(fd_right[0], STDIN_FILENO);
|
||||
+ close(fd_right[0]);
|
||||
+ dup2(fd_left[1], STDOUT_FILENO);
|
||||
+ close(fd_left[1]);
|
||||
+
|
||||
+ execl("/bin/sh", "/bin/sh", "-c", menu_current->cmd, NULL);
|
||||
+ die("dwl: execl %s failed:", "/bin/sh");
|
||||
+ }
|
||||
+
|
||||
+ close(fd_right[0]);
|
||||
+ close(fd_left[1]);
|
||||
+
|
||||
+ if (!(f = fdopen(fd_right[1], "w")))
|
||||
+ return;
|
||||
+ menu_current->feed(f);
|
||||
+ fclose(f);
|
||||
+
|
||||
+ menu_pid = pid;
|
||||
+ menu_fd = fd_left[0];
|
||||
+ wl_event_source_timer_update(menu_source, 10);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+menuloop(void *data)
|
||||
+{
|
||||
+ FILE *f;
|
||||
+ pid_t pid;
|
||||
+ char line[256], *s;
|
||||
+
|
||||
+ /* If process is still running, wait for another 50 ms */
|
||||
+ if ((pid = waitpid(menu_pid, NULL, WNOHANG)) == 0) {
|
||||
+ wl_event_source_timer_update(menu_source, 10);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ menu_pid = 0;
|
||||
+
|
||||
+ if (!(f = fdopen(menu_fd, "r")))
|
||||
+ return 0;
|
||||
+ if (fgets(line, sizeof(line), f)) {
|
||||
+ if ((s = strchr(line, '\n')))
|
||||
+ *s = '\0';
|
||||
+ menu_current->action(line);
|
||||
+ }
|
||||
+ fclose(f);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+menuwinfeed(FILE *f)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ const char *title;
|
||||
+
|
||||
+ wl_list_for_each(c, &fstack, flink) {
|
||||
+ if (!(title = client_get_title(c)))
|
||||
+ continue;
|
||||
+ fprintf(f, "%s\n", title);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+menuwinaction(char *line)
|
||||
+{
|
||||
+ Client *c;
|
||||
+ Monitor *prevm = selmon;
|
||||
+ const char *title;
|
||||
+
|
||||
+ if (!selmon)
|
||||
+ return;
|
||||
+
|
||||
+ wl_list_for_each(c, &fstack, flink) {
|
||||
+ if (!(title = client_get_title(c)))
|
||||
+ continue;
|
||||
+ if (strcmp(line, title) == 0)
|
||||
+ goto found;
|
||||
+ }
|
||||
+ return;
|
||||
+
|
||||
+found:
|
||||
+ focusclient(c, 1);
|
||||
+ wlr_cursor_move(cursor, NULL, selmon->m.x - prevm->m.x , 0);
|
||||
+ selmon->seltags ^= 1; /* toggle sel tagset */
|
||||
+ selmon->tagset[selmon->seltags] = c->tags;
|
||||
+ arrange(selmon);
|
||||
+ printstatus();
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+menulayoutfeed(FILE *f)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ for (i = 0; i < LENGTH(layouts); i++)
|
||||
+ fprintf(f, "%s\n", layouts[i].symbol);
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+menulayoutaction(char *line)
|
||||
+{
|
||||
+ unsigned int i;
|
||||
+ Arg a;
|
||||
+ for (i = 0; i < LENGTH(layouts); i++)
|
||||
+ if (strcmp(line, layouts[i].symbol) == 0)
|
||||
+ goto found;
|
||||
+ return;
|
||||
+
|
||||
+found:
|
||||
+ a.v = &layouts[i];
|
||||
+ setlayout(&a);
|
||||
+}
|
||||
+
|
||||
void
|
||||
monocle(Monitor *m)
|
||||
{
|
||||
@@ -2576,6 +2724,10 @@ setup(void)
|
||||
* e.g when running in the x11 backend or the wayland backend and the
|
||||
* compositor has Xwayland support */
|
||||
unsetenv("DISPLAY");
|
||||
+
|
||||
+ menu_source = wl_event_loop_add_timer(
|
||||
+ wl_display_get_event_loop(dpy), menuloop, NULL);
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
/*
|
||||
* Initialise the XWayland X server.
|
@@ -1,79 +0,0 @@
|
||||
From b051f50233033b399db324b29ab24227257ac141 Mon Sep 17 00:00:00 2001
|
||||
From: wochap <gean.marroquin@gmail.com>
|
||||
Date: Tue, 5 Mar 2024 23:31:51 -0500
|
||||
Subject: [PATCH] apply NikitaIvanovV movestack patch
|
||||
|
||||
source: https://github.com/djpohly/dwl/wiki/movestack
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
2 files changed, 37 insertions(+)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index db0babc..778a0dc 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -122,6 +122,8 @@ static const Key keys[] = {
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_J, movestack, {.i = +1} },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_K, movestack, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index ef27a1d..69b9756 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -279,6 +279,7 @@ static void maplayersurfacenotify(struct wl_listener *listener, void *data);
|
||||
static void mapnotify(struct wl_listener *listener, void *data);
|
||||
static void maximizenotify(struct wl_listener *listener, void *data);
|
||||
static void monocle(Monitor *m);
|
||||
+static void movestack(const Arg *arg);
|
||||
static void motionabsolute(struct wl_listener *listener, void *data);
|
||||
static void motionnotify(uint32_t time);
|
||||
static void motionrelative(struct wl_listener *listener, void *data);
|
||||
@@ -1603,6 +1604,40 @@ monocle(Monitor *m)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
}
|
||||
|
||||
+void
|
||||
+movestack(const Arg *arg)
|
||||
+{
|
||||
+ Client *c, *sel = focustop(selmon);
|
||||
+
|
||||
+ if (!sel) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (wl_list_length(&clients) <= 1) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (arg->i > 0) {
|
||||
+ wl_list_for_each(c, &sel->link, link) {
|
||||
+ if (VISIBLEON(c, selmon) || &c->link == &clients) {
|
||||
+ break; /* found it */
|
||||
+ }
|
||||
+ }
|
||||
+ } else {
|
||||
+ wl_list_for_each_reverse(c, &sel->link, link) {
|
||||
+ if (VISIBLEON(c, selmon) || &c->link == &clients) {
|
||||
+ break; /* found it */
|
||||
+ }
|
||||
+ }
|
||||
+ /* backup one client */
|
||||
+ c = wl_container_of(c->link.prev, c, link);
|
||||
+ }
|
||||
+
|
||||
+ wl_list_remove(&sel->link);
|
||||
+ wl_list_insert(&c->link, &sel->link);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
motionabsolute(struct wl_listener *listener, void *data)
|
||||
{
|
||||
--
|
||||
2.42.0
|
@@ -1,27 +0,0 @@
|
||||
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);
|
||||
|
@@ -1,84 +0,0 @@
|
||||
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
|
||||
|
@@ -1,170 +0,0 @@
|
||||
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
|
||||
|
@@ -1,82 +0,0 @@
|
||||
From e42ca1c539437d3098d80983cfe2ad6f938d7a08 Mon Sep 17 00:00:00 2001
|
||||
From: Eldar Yusupov <eyusupov@gmail.com>
|
||||
Date: Sun, 17 Mar 2024 19:12:29 +0300
|
||||
Subject: [PATCH] Restore correct montior for client when it is reattached
|
||||
|
||||
---
|
||||
dwl.c | 24 ++++++++++++++++++++++--
|
||||
1 file changed, 22 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index bf763df..d8d8139 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -107,6 +107,7 @@ typedef struct {
|
||||
unsigned int type; /* XDGShell or X11* */
|
||||
struct wlr_box geom; /* layout-relative, includes border */
|
||||
Monitor *mon;
|
||||
+ char *output;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
@@ -869,6 +870,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
size_t i;
|
||||
struct wlr_output_state state;
|
||||
Monitor *m;
|
||||
+ Client *c;
|
||||
|
||||
if (!wlr_output_init_render(wlr_output, alloc, drw))
|
||||
return;
|
||||
@@ -938,6 +940,13 @@ createmon(struct wl_listener *listener, void *data)
|
||||
wlr_output_layout_add_auto(output_layout, wlr_output);
|
||||
else
|
||||
wlr_output_layout_add(output_layout, wlr_output, m->m.x, m->m.y);
|
||||
+
|
||||
+ wl_list_for_each(c, &clients, link) {
|
||||
+ if (strcmp(wlr_output->name, c->output) == 0) {
|
||||
+ c->mon = m;
|
||||
+ }
|
||||
+ }
|
||||
+ updatemons(NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1186,6 +1195,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
||||
wl_list_remove(&c->map.link);
|
||||
wl_list_remove(&c->unmap.link);
|
||||
}
|
||||
+ free(c->output);
|
||||
free(c);
|
||||
}
|
||||
|
||||
@@ -1618,6 +1628,10 @@ mapnotify(struct wl_listener *listener, void *data)
|
||||
} else {
|
||||
applyrules(c);
|
||||
}
|
||||
+ c->output = strdup(c->mon->wlr_output->name);
|
||||
+ if (c->output == NULL) {
|
||||
+ die("oom");
|
||||
+ }
|
||||
printstatus();
|
||||
|
||||
unset_fullscreen:
|
||||
@@ -2565,8 +2579,14 @@ void
|
||||
tagmon(const Arg *arg)
|
||||
{
|
||||
Client *sel = focustop(selmon);
|
||||
- if (sel)
|
||||
- setmon(sel, dirtomon(arg->i), 0);
|
||||
+ if (!sel)
|
||||
+ return;
|
||||
+ setmon(sel, dirtomon(arg->i), 0);
|
||||
+ free(sel->output);
|
||||
+ sel->output = strdup(sel->mon->wlr_output->name);
|
||||
+ if (sel->output == NULL) {
|
||||
+ die("oom");
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
--
|
||||
2.44.0
|
||||
|
@@ -1,54 +0,0 @@
|
||||
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
|
||||
|
@@ -1,188 +0,0 @@
|
||||
From 52d5a05a6b4ca9555c072e103c2db454d2b35021 Mon Sep 17 00:00:00 2001
|
||||
From: Guido Cella <guido@guidocella.xyz>
|
||||
Date: Thu, 25 Jul 2024 17:59:05 +0200
|
||||
Subject: [PATCH] =?UTF-8?q?hide=20the=20mouse=20cursor=20if=20it=20isn?=
|
||||
=?UTF-8?q?=E2=80=99t=20being=20used?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
---
|
||||
config.def.h | 2 ++
|
||||
dwl.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++------
|
||||
2 files changed, 65 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171..790c73d 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -106,6 +106,8 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||
*/
|
||||
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||
|
||||
+static const int cursor_timeout = 5;
|
||||
+
|
||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
||||
#define MODKEY WLR_MODIFIER_ALT
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 72892d9..4090d73 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -292,6 +292,8 @@ static void focusstack(const Arg *arg);
|
||||
static Client *focustop(Monitor *m);
|
||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
+static void handlecursoractivity(void);
|
||||
+static int hidecursor(void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
@@ -396,6 +398,14 @@ static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||
|
||||
static struct wlr_cursor *cursor;
|
||||
static struct wlr_xcursor_manager *cursor_mgr;
|
||||
+static struct wl_event_source *hide_source;
|
||||
+static bool cursor_hidden = false;
|
||||
+static struct {
|
||||
+ enum wp_cursor_shape_device_v1_shape shape;
|
||||
+ struct wlr_surface *surface;
|
||||
+ int hotspot_x;
|
||||
+ int hotspot_y;
|
||||
+} last_cursor;
|
||||
|
||||
static struct wlr_scene_rect *root_bg;
|
||||
static struct wlr_session_lock_manager_v1 *session_lock_mgr;
|
||||
@@ -588,6 +598,7 @@ axisnotify(struct wl_listener *listener, void *data)
|
||||
* for example when you move the scroll wheel. */
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
/* TODO: allow usage of scroll whell for mousebindings, it can be implemented
|
||||
* checking the event's orientation and the delta of the event */
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
@@ -606,6 +617,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
const Button *b;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
|
||||
switch (event->state) {
|
||||
case WL_POINTER_BUTTON_STATE_PRESSED:
|
||||
@@ -1517,6 +1529,32 @@ handlesig(int signo)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+handlecursoractivity(void)
|
||||
+{
|
||||
+ wl_event_source_timer_update(hide_source, cursor_timeout * 1000);
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ return;
|
||||
+
|
||||
+ cursor_hidden = false;
|
||||
+
|
||||
+ if (last_cursor.shape)
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
+ wlr_cursor_shape_v1_name(last_cursor.shape));
|
||||
+ else
|
||||
+ wlr_cursor_set_surface(cursor, last_cursor.surface,
|
||||
+ last_cursor.hotspot_x, last_cursor.hotspot_y);
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+hidecursor(void *data)
|
||||
+{
|
||||
+ wlr_cursor_unset_image(cursor);
|
||||
+ cursor_hidden = true;
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
void
|
||||
incnmaster(const Arg *arg)
|
||||
{
|
||||
@@ -1856,6 +1894,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
|
||||
wlr_cursor_move(cursor, device, dx, dy);
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
+ handlecursoractivity();
|
||||
|
||||
/* Update selmon (even while dragging a window) */
|
||||
if (sloppyfocus)
|
||||
@@ -1880,7 +1919,7 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
||||
/* If there's no client surface under the cursor, set the cursor image to a
|
||||
* default. This is what makes the cursor image appear when you move it
|
||||
* off of a client or over its border. */
|
||||
- if (!surface && !seat->drag)
|
||||
+ if (!surface && !seat->drag && !cursor_hidden)
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
|
||||
pointerfocus(c, surface, sx, sy, time);
|
||||
@@ -2263,6 +2302,7 @@ run(char *startup_cmd)
|
||||
* monitor when displayed here */
|
||||
wlr_cursor_warp_closest(cursor, NULL, cursor->x, cursor->y);
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
+ handlecursoractivity();
|
||||
|
||||
/* Run the Wayland event loop. This does not return until you exit the
|
||||
* compositor. Starting the backend rigged up all of the necessary event
|
||||
@@ -2286,9 +2326,16 @@ setcursor(struct wl_listener *listener, void *data)
|
||||
* use the provided surface as the cursor image. It will set the
|
||||
* hardware cursor on the output that it's currently on and continue to
|
||||
* do so as the cursor moves between outputs. */
|
||||
- if (event->seat_client == seat->pointer_state.focused_client)
|
||||
- wlr_cursor_set_surface(cursor, event->surface,
|
||||
- event->hotspot_x, event->hotspot_y);
|
||||
+ if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
+ last_cursor.shape = 0;
|
||||
+ last_cursor.surface = event->surface;
|
||||
+ last_cursor.hotspot_x = event->hotspot_x;
|
||||
+ last_cursor.hotspot_y = event->hotspot_y;
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ wlr_cursor_set_surface(cursor, event->surface,
|
||||
+ event->hotspot_x, event->hotspot_y);
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2300,9 +2347,14 @@ setcursorshape(struct wl_listener *listener, void *data)
|
||||
/* This can be sent by any client, so we check to make sure this one is
|
||||
* actually has pointer focus first. If so, we can tell the cursor to
|
||||
* use the provided cursor shape. */
|
||||
- if (event->seat_client == seat->pointer_state.focused_client)
|
||||
- wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
- wlr_cursor_shape_v1_name(event->shape));
|
||||
+ if (event->seat_client == seat->pointer_state.focused_client) {
|
||||
+ last_cursor.shape = event->shape;
|
||||
+ last_cursor.surface = NULL;
|
||||
+
|
||||
+ if (!cursor_hidden)
|
||||
+ wlr_cursor_set_xcursor(cursor, cursor_mgr,
|
||||
+ wlr_cursor_shape_v1_name(event->shape));
|
||||
+ }
|
||||
}
|
||||
|
||||
void
|
||||
@@ -2604,6 +2656,9 @@ setup(void)
|
||||
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
|
||||
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
|
||||
|
||||
+ hide_source = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
|
||||
+ hidecursor, cursor);
|
||||
+
|
||||
/*
|
||||
* Configures a seat, which is a single "seat" at which a user sits and
|
||||
* operates the computer. This conceptually includes up to one keyboard,
|
||||
@@ -2986,6 +3041,7 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||
wlr_cursor_attach_input_device(cursor, device);
|
||||
if (event->suggested_output)
|
||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||
+ handlecursoractivity();
|
||||
}
|
||||
|
||||
Monitor *
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,358 +0,0 @@
|
||||
From 3c95b58bc2b87ebd9b8481b3b16e49d99883f0a7 Mon Sep 17 00:00:00 2001
|
||||
From: Bonicgamer <44382222+Bonicgamer@users.noreply.github.com>
|
||||
Date: Mon, 17 Aug 2020 14:48:24 -0400
|
||||
Subject: [PATCH 1/2] Implement vanitygaps
|
||||
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 | 21 ++++++++
|
||||
dwl.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++----
|
||||
2 files changed, 161 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 22d2171d..39e528b1 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -6,7 +6,12 @@
|
||||
/* appearance */
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
+static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
||||
+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
||||
static const float rootcolor[] = COLOR(0x222222ff);
|
||||
static const float bordercolor[] = COLOR(0x444444ff);
|
||||
static const float focuscolor[] = COLOR(0x005577ff);
|
||||
@@ -133,6 +138,22 @@ static const Key keys[] = {
|
||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
|
||||
+ { MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
|
||||
+ { MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
|
||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
|
||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index a2711f67..d749728a 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -200,6 +200,10 @@ struct Monitor {
|
||||
struct wlr_box w; /* window area, layout-relative */
|
||||
struct wl_list layers[4]; /* LayerSurface.link */
|
||||
const Layout *lt[2];
|
||||
+ int gappih; /* horizontal gap between windows */
|
||||
+ int gappiv; /* vertical gap between windows */
|
||||
+ int gappoh; /* horizontal outer gaps */
|
||||
+ int gappov; /* vertical outer gaps */
|
||||
unsigned int seltags;
|
||||
unsigned int sellt;
|
||||
uint32_t tagset[2];
|
||||
@@ -273,6 +277,7 @@ static void createpopup(struct wl_listener *listener, void *data);
|
||||
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||
static void cursorframe(struct wl_listener *listener, void *data);
|
||||
static void cursorwarptohint(void);
|
||||
+static void defaultgaps(const Arg *arg);
|
||||
static void destroydecoration(struct wl_listener *listener, void *data);
|
||||
static void destroydragicon(struct wl_listener *listener, void *data);
|
||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
||||
@@ -293,6 +298,13 @@ static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||
static void gpureset(struct wl_listener *listener, void *data);
|
||||
static void handlesig(int signo);
|
||||
static void incnmaster(const Arg *arg);
|
||||
+static void incgaps(const Arg *arg);
|
||||
+static void incigaps(const Arg *arg);
|
||||
+static void incihgaps(const Arg *arg);
|
||||
+static void incivgaps(const Arg *arg);
|
||||
+static void incogaps(const Arg *arg);
|
||||
+static void incohgaps(const Arg *arg);
|
||||
+static void incovgaps(const Arg *arg);
|
||||
static void inputdevice(struct wl_listener *listener, void *data);
|
||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||
static void keypress(struct wl_listener *listener, void *data);
|
||||
@@ -327,6 +339,7 @@ static void setcursorshape(struct wl_listener *listener, void *data);
|
||||
static void setfloating(Client *c, int floating);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void setgamma(struct wl_listener *listener, void *data);
|
||||
+static void setgaps(int oh, int ov, int ih, int iv);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||
@@ -340,6 +353,7 @@ static void tagmon(const Arg *arg);
|
||||
static void tile(Monitor *m);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void togglefullscreen(const Arg *arg);
|
||||
+static void togglegaps(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
static void toggleview(const Arg *arg);
|
||||
static void unlocksession(struct wl_listener *listener, void *data);
|
||||
@@ -413,6 +427,8 @@ static struct wlr_box sgeom;
|
||||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
+static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
||||
+
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
@@ -989,6 +1005,11 @@ createmon(struct wl_listener *listener, void *data)
|
||||
for (i = 0; i < LENGTH(m->layers); i++)
|
||||
wl_list_init(&m->layers[i]);
|
||||
|
||||
+ m->gappih = gappih;
|
||||
+ m->gappiv = gappiv;
|
||||
+ m->gappoh = gappoh;
|
||||
+ m->gappov = gappov;
|
||||
+
|
||||
wlr_output_state_init(&state);
|
||||
/* Initialize monitor state using configured rules */
|
||||
m->tagset[0] = m->tagset[1] = 1;
|
||||
@@ -1171,6 +1192,12 @@ cursorwarptohint(void)
|
||||
}
|
||||
}
|
||||
|
||||
+void
|
||||
+defaultgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(gappoh, gappov, gappih, gappiv);
|
||||
+}
|
||||
+
|
||||
void
|
||||
destroydecoration(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -1524,6 +1551,83 @@ incnmaster(const Arg *arg)
|
||||
arrange(selmon);
|
||||
}
|
||||
|
||||
+void
|
||||
+incgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh + arg->i,
|
||||
+ selmon->gappov + arg->i,
|
||||
+ selmon->gappih + arg->i,
|
||||
+ selmon->gappiv + arg->i
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incigaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh,
|
||||
+ selmon->gappov,
|
||||
+ selmon->gappih + arg->i,
|
||||
+ selmon->gappiv + arg->i
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incihgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh,
|
||||
+ selmon->gappov,
|
||||
+ selmon->gappih + arg->i,
|
||||
+ selmon->gappiv
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incivgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh,
|
||||
+ selmon->gappov,
|
||||
+ selmon->gappih,
|
||||
+ selmon->gappiv + arg->i
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incogaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh + arg->i,
|
||||
+ selmon->gappov + arg->i,
|
||||
+ selmon->gappih,
|
||||
+ selmon->gappiv
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incohgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh + arg->i,
|
||||
+ selmon->gappov,
|
||||
+ selmon->gappih,
|
||||
+ selmon->gappiv
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
+void
|
||||
+incovgaps(const Arg *arg)
|
||||
+{
|
||||
+ setgaps(
|
||||
+ selmon->gappoh,
|
||||
+ selmon->gappov + arg->i,
|
||||
+ selmon->gappih,
|
||||
+ selmon->gappiv
|
||||
+ );
|
||||
+}
|
||||
+
|
||||
void
|
||||
inputdevice(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -2352,6 +2456,16 @@ setgamma(struct wl_listener *listener, void *data)
|
||||
wlr_output_schedule_frame(m->wlr_output);
|
||||
}
|
||||
|
||||
+void
|
||||
+setgaps(int oh, int ov, int ih, int iv)
|
||||
+{
|
||||
+ selmon->gappoh = MAX(oh, 0);
|
||||
+ selmon->gappov = MAX(ov, 0);
|
||||
+ selmon->gappih = MAX(ih, 0);
|
||||
+ selmon->gappiv = MAX(iv, 0);
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
@@ -2691,7 +2805,7 @@ tagmon(const Arg *arg)
|
||||
void
|
||||
tile(Monitor *m)
|
||||
{
|
||||
- unsigned int mw, my, ty;
|
||||
+ unsigned int mw, my, ty, h, r, oe = enablegaps, ie = enablegaps;
|
||||
int i, n = 0;
|
||||
Client *c;
|
||||
|
||||
@@ -2701,22 +2815,31 @@ tile(Monitor *m)
|
||||
if (n == 0)
|
||||
return;
|
||||
|
||||
+ if (smartgaps == n) {
|
||||
+ oe = 0; // outer gaps disabled
|
||||
+ }
|
||||
+
|
||||
if (n > m->nmaster)
|
||||
- mw = m->nmaster ? (int)roundf(m->w.width * m->mfact) : 0;
|
||||
+ mw = m->nmaster ? (int)roundf((m->w.width + m->gappiv*ie) * m->mfact) : 0;
|
||||
else
|
||||
- mw = m->w.width;
|
||||
- i = my = ty = 0;
|
||||
+ mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie;
|
||||
+ i = 0;
|
||||
+ my = ty = m->gappoh*oe;
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
if (i < m->nmaster) {
|
||||
- resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||
- .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||
- my += c->geom.height;
|
||||
+ r = MIN(n, m->nmaster) - i;
|
||||
+ h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my,
|
||||
+ .width = mw - m->gappiv*ie, .height = h}, 0);
|
||||
+ my += c->geom.height + m->gappih*ie;
|
||||
} else {
|
||||
- resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
||||
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
|
||||
- ty += c->geom.height;
|
||||
+ r = n - i;
|
||||
+ h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty,
|
||||
+ .width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0);
|
||||
+ ty += c->geom.height + m->gappih*ie;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
@@ -2739,6 +2862,13 @@ togglefullscreen(const Arg *arg)
|
||||
setfullscreen(sel, !sel->isfullscreen);
|
||||
}
|
||||
|
||||
+void
|
||||
+togglegaps(const Arg *arg)
|
||||
+{
|
||||
+ enablegaps = !enablegaps;
|
||||
+ arrange(selmon);
|
||||
+}
|
||||
+
|
||||
void
|
||||
toggletag(const Arg *arg)
|
||||
{
|
||||
--
|
||||
2.46.0
|
||||
|
||||
|
||||
From 8b9db986eddeade22d92fb15a8c836912869be29 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
||||
<leohdz172@protonmail.com>
|
||||
Date: Wed, 20 Jul 2022 00:15:32 -0500
|
||||
Subject: [PATCH 2/2] allow gaps in monocle layout if requested
|
||||
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 | 1 +
|
||||
dwl.c | 6 +++++-
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 39e528b1..f4d4095d 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -7,6 +7,7 @@
|
||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
||||
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||
+static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
|
||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
||||
static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index d749728a..dbc66ef8 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -1879,8 +1879,12 @@ monocle(Monitor *m)
|
||||
wl_list_for_each(c, &clients, link) {
|
||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||
continue;
|
||||
- resize(c, m->w, 0);
|
||||
n++;
|
||||
+ if (!monoclegaps)
|
||||
+ resize(c, m->w, 0);
|
||||
+ else
|
||||
+ resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov,
|
||||
+ .width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0);
|
||||
}
|
||||
if (n)
|
||||
snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n);
|
||||
--
|
||||
2.46.0
|
||||
|
@@ -1,71 +0,0 @@
|
||||
From 4951ccc89dac2b557994b2f6c3aacb2398e2d1b1 Mon Sep 17 00:00:00 2001
|
||||
From: Ben Collerson <benc@benc.cc>
|
||||
Date: Thu, 4 Jan 2024 20:30:01 +1000
|
||||
Subject: [PATCH] warpcursor
|
||||
|
||||
---
|
||||
dwl.c | 27 +++++++++++++++++++++++++++
|
||||
1 file changed, 27 insertions(+)
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 145fd018..f7ad6c13 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -347,6 +347,7 @@ static void urgent(struct wl_listener *listener, void *data);
|
||||
static void view(const Arg *arg);
|
||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
||||
static void virtualpointer(struct wl_listener *listener, void *data);
|
||||
+static void warpcursor(const Client *c);
|
||||
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);
|
||||
@@ -514,6 +515,7 @@ arrange(Monitor *m)
|
||||
m->lt[m->sellt]->arrange(m);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
checkidleinhibitor(NULL);
|
||||
+ warpcursor(focustop(selmon));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1323,6 +1325,10 @@ focusclient(Client *c, int lift)
|
||||
if (locked)
|
||||
return;
|
||||
|
||||
+ /* Warp cursor to center of client if it is outside */
|
||||
+ if (lift)
|
||||
+ warpcursor(c);
|
||||
+
|
||||
/* Raise client in stacking order if requested */
|
||||
if (c && lift)
|
||||
wlr_scene_node_raise_to_top(&c->scene->node);
|
||||
@@ -2927,6 +2933,27 @@ virtualpointer(struct wl_listener *listener, void *data)
|
||||
wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
|
||||
}
|
||||
|
||||
+void
|
||||
+warpcursor(const Client *c) {
|
||||
+ if (cursor_mode != CurNormal) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (!c && selmon) {
|
||||
+ wlr_cursor_warp_closest(cursor,
|
||||
+ NULL,
|
||||
+ selmon->w.x + selmon->w.width / 2.0 ,
|
||||
+ selmon->w.y + selmon->w.height / 2.0);
|
||||
+ }
|
||||
+ else if ( c && (cursor->x < c->geom.x ||
|
||||
+ cursor->x > c->geom.x + c->geom.width ||
|
||||
+ cursor->y < c->geom.y ||
|
||||
+ cursor->y > c->geom.y + c->geom.height))
|
||||
+ wlr_cursor_warp_closest(cursor,
|
||||
+ NULL,
|
||||
+ c->geom.x + c->geom.width / 2.0,
|
||||
+ c->geom.y + c->geom.height / 2.0);
|
||||
+}
|
||||
+
|
||||
Monitor *
|
||||
xytomon(double x, double y)
|
||||
{
|
||||
--
|
||||
2.45.2
|
||||
|
@@ -1,181 +0,0 @@
|
||||
<?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>
|
@@ -1,270 +0,0 @@
|
||||
<?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>
|
10
util.c
10
util.c
@@ -38,14 +38,14 @@ ecalloc(size_t nmemb, size_t size)
|
||||
int
|
||||
fd_set_nonblock(int fd) {
|
||||
int flags = fcntl(fd, F_GETFL);
|
||||
if (flags < 0) {
|
||||
if (flags < 0) {
|
||||
perror("fcntl(F_GETFL):");
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
perror("fcntl(F_SETFL):");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -1,290 +0,0 @@
|
||||
// -*- mode: jsonc -*-
|
||||
{
|
||||
|
||||
"layer": "top", // Waybar at top layer
|
||||
// "output": "",
|
||||
"position": "top", // Waybar position (top|bottom|left|right)
|
||||
// "height": 25, // Waybar height (to be removed for auto height)
|
||||
// "width": 1280, // Waybar width
|
||||
"spacing": 4, // Gaps between modules (4px)
|
||||
"mode": "dock",
|
||||
"start_hidden": false,
|
||||
"fixed-center": true,
|
||||
"reload_style_on_change": true,
|
||||
"modules-left": [
|
||||
"group/power-menu",
|
||||
"dwl/tags",
|
||||
"dwl/window#title",
|
||||
"dwl/window#layout",
|
||||
],
|
||||
"modules-center": [
|
||||
"tray",
|
||||
],
|
||||
"modules-right": [
|
||||
"group/media-playing",
|
||||
"pulseaudio",
|
||||
"idle_inhibitor",
|
||||
"custom/system76-power",
|
||||
"cpu",
|
||||
"memory",
|
||||
"disk",
|
||||
"battery",
|
||||
"clock",
|
||||
"group/dunst",
|
||||
],
|
||||
"group/power-menu": {
|
||||
"orientation": "inherit",
|
||||
"modules": [
|
||||
"custom/power-menu-launcher",
|
||||
"custom/power-menu-shutdown",
|
||||
"custom/power-menu-reboot",
|
||||
"custom/power-menu-sleep",
|
||||
"custom/power-menu-lock",
|
||||
"custom/power-menu-logout",
|
||||
],
|
||||
"drawer": {
|
||||
"transition-duration": 500,
|
||||
"transition-left-to-right": true,
|
||||
"click-to-reveal": false,
|
||||
},
|
||||
},
|
||||
"group/media-playing": {
|
||||
"orientation": "inherit",
|
||||
"modules": [
|
||||
"custom/media-playing-source",
|
||||
"custom/media-playing-prev",
|
||||
"custom/media-playing-play-pause",
|
||||
"custom/media-playing-next",
|
||||
],
|
||||
},
|
||||
"group/dunst": {
|
||||
"orientation": "inherit",
|
||||
"modules": [
|
||||
"custom/dunst-status",
|
||||
"custom/dunst-history-view",
|
||||
"custom/dunst-clear",
|
||||
"custom/dunst-history-clear",
|
||||
],
|
||||
"drawer": {
|
||||
"transition-duration": 500,
|
||||
"transition-left-to-right": true,
|
||||
"click-to-reveal": false,
|
||||
},
|
||||
},
|
||||
|
||||
"battery": {
|
||||
"interval": 60,
|
||||
"format": "{icon} {capacity}%",
|
||||
"format-icons": ["", "", "", "", "", "", "", "", "", "", ""],
|
||||
"tooltip": true,
|
||||
"tooltip-format": "\t{timeTo}\n\t{power} W\n\t{cycles}\n\t{health}%",
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
"interval": 5,
|
||||
"format": " {usage}%",
|
||||
"tooltip": true,
|
||||
"on-click-right": "foot btop",
|
||||
},
|
||||
|
||||
"clock": {
|
||||
"interval": 60,
|
||||
"format": " {:%I:%M %p}",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "<tt><small>{calendar}</small></tt>",
|
||||
"calendar": {
|
||||
"mode" : "month",
|
||||
"mode-mon-col" : 3,
|
||||
"weeks-pos" : "left",
|
||||
"on-scroll" : 1,
|
||||
"format": {
|
||||
"months": "<span color='#50fa7b'><b>{}</b></span>",
|
||||
"days": "<span color='#f8f8f2'><b>{}</b></span>",
|
||||
"weeks": "<span color='#8be9fd'><b>W{}</b></span>",
|
||||
"weekdays": "<span color='#f1fa8c'><b>{}</b></span>",
|
||||
"today": "<span color='#bd93f9'><b><u>{}</u></b></span>"
|
||||
},
|
||||
},
|
||||
"actions": {
|
||||
"on-click": "mode",
|
||||
"on-click-right": "shift_reset",
|
||||
"on-scroll-up": "shift_up",
|
||||
"on-scroll-down": "shift_down",
|
||||
},
|
||||
},
|
||||
|
||||
"custom/dunst-status": {
|
||||
"exec": "~/.config/dwl/waybar/scripts/dunst.sh",
|
||||
"restart-interval": 1,
|
||||
"on-click": "~/.scripts/dunst.sh --dnd",
|
||||
"on-click-right": "~/.scripts/dunst.sh --rofi",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Toggle Do Not Disturb",
|
||||
},
|
||||
"custom/dunst-clear": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/dunst.sh --close-all",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Close Open Notifications",
|
||||
},
|
||||
"custom/dunst-history-view": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/dunst.sh --history",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "View Notification History",
|
||||
},
|
||||
"custom/dunst-history-clear": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/dunst.sh --history-clear",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Clear Notification History",
|
||||
},
|
||||
|
||||
"dwl/tags": {
|
||||
"num-tags": 9,
|
||||
"tag-labels": [ " ₁", " ₂", " ₃", " ₄", " ₅", " ₆", " ₇", " ₈", " ₉" ],
|
||||
"disable-click": false
|
||||
},
|
||||
"dwl/window#title": {
|
||||
"format": "{title}",
|
||||
"all-outputs": false,
|
||||
"icon": true,
|
||||
"icon-size": 21,
|
||||
"tooltip": true,
|
||||
"max-length": 30,
|
||||
},
|
||||
"dwl/window#layout": {
|
||||
"format": "{layout}",
|
||||
"tooltip": false,
|
||||
"all-outputs": false,
|
||||
"icon": false,
|
||||
},
|
||||
|
||||
"disk": {
|
||||
"interval": 60,
|
||||
"format": " {percentage_used}%",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Used: {used} ({percentage_used}%)\nFree: {free} ({percentage_free}%)\nTotal: {total}",
|
||||
"on-click-right": "qdirstat",
|
||||
},
|
||||
|
||||
"idle_inhibitor": {
|
||||
"format": "{icon}",
|
||||
"format-icons": {
|
||||
"activated": " on",
|
||||
"deactivated": " off",
|
||||
},
|
||||
"tooltip": true,
|
||||
"tooltip-format-activated": "Idle Inhibitor: {status}",
|
||||
"tooltip-format-deactivated": "Idle Inhibitor: {status}",
|
||||
"start-activated": true,
|
||||
},
|
||||
|
||||
"memory": {
|
||||
"interval": 5,
|
||||
"format": " {percentage}%",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "RAM:\n\tUsed: {used} GiB ({percentage}%)\n\tFree: {avail} GiB\n\tTotal: {total} GiB\nSwap:\n\tUsed: {swapUsed} GiB ({swapPercentage}%)\n\tFree: {swapAvail} GiB\n\tTotal: {swapTotal} GiB",
|
||||
"on-click-right": "foot btop",
|
||||
},
|
||||
|
||||
"custom/media-playing-source": {
|
||||
"exec": "~/.config/dwl/waybar/scripts/get-media-playing.sh",
|
||||
"return-type": "json",
|
||||
"restart-interval": 1,
|
||||
"on-click": "~/.scripts/playerctl.sh --change",
|
||||
"tooltip": true,
|
||||
},
|
||||
"custom/media-playing-prev": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/playerctl.sh --prev",
|
||||
"tooltip": false,
|
||||
},
|
||||
"custom/media-playing-play-pause": {
|
||||
"exec": "~/.config/dwl/waybar/scripts/get-media-status-icon.sh",
|
||||
"restart-interval": 1,
|
||||
"on-click": "~/.scripts/playerctl.sh --play-pause",
|
||||
"tooltip": false,
|
||||
},
|
||||
"custom/media-playing-next": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/playerctl.sh --next",
|
||||
"tooltip": false,
|
||||
},
|
||||
|
||||
"custom/power-menu-launcher": {
|
||||
"format": "",
|
||||
"on-click": "rofi -show combi",
|
||||
"on-click-right": "~/.scripts/control-center.sh --rofi",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Application Launcher",
|
||||
},
|
||||
"custom/power-menu-shutdown": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/session.sh --shutdown",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Shutdown",
|
||||
},
|
||||
"custom/power-menu-reboot": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/session.sh --reboot",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Reboot",
|
||||
},
|
||||
"custom/power-menu-sleep": {
|
||||
"format": "⏾",
|
||||
"on-click": "~/.scripts/session.sh --sleep",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Sleep",
|
||||
},
|
||||
"custom/power-menu-lock": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/session.sh --lock",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Lock",
|
||||
},
|
||||
"custom/power-menu-logout": {
|
||||
"format": "",
|
||||
"on-click": "~/.scripts/session.sh --logout",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "Logout",
|
||||
},
|
||||
|
||||
"pulseaudio": {
|
||||
"interval": 5,
|
||||
"format": "{icon} {volume}%",
|
||||
"format-bluetooth": "{icon} {volume}%",
|
||||
"format-muted": " muted",
|
||||
"format-icons": {
|
||||
"hdmi": "",
|
||||
"headset": "",
|
||||
"speaker": "",
|
||||
"headphone": "",
|
||||
"car": "",
|
||||
"hifi": "",
|
||||
"default": "",
|
||||
},
|
||||
"scroll-step": 5,
|
||||
"on-click": "~/.scripts/pactl.sh --mute",
|
||||
"on-click-right": "~/.scripts/pactl.sh --mixer",
|
||||
"tooltip": true,
|
||||
"tooltip-format": "{desc}",
|
||||
"scroll-step": 0.25,
|
||||
},
|
||||
|
||||
"custom/system76-power": {
|
||||
"exec": "~/.config/dwl/waybar/scripts/system76-power.sh",
|
||||
"return-type": "json",
|
||||
"restart-interval": 60,
|
||||
"on-click-right": "~/.scripts/cpu-gpu.sh --rofi",
|
||||
"tooltip": true,
|
||||
},
|
||||
|
||||
"tray": {
|
||||
"icon-size": 21,
|
||||
"show-passive-items": true,
|
||||
"spacing": 4,
|
||||
"reverse-direction": false,
|
||||
},
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
killall waybar || true
|
||||
|
||||
until /usr/bin/waybar \
|
||||
--config $HOME/.config/dwl/waybar/config.jsonc \
|
||||
--style $HOME/.config/dwl/waybar/style.css;
|
||||
do
|
||||
if [ $? -ne 143 ]; then
|
||||
echo "Dwl Waybar stopped with exit code $?. Respawning..." >&2;
|
||||
sleep 1;
|
||||
else
|
||||
echo "Dwl Waybar manually killed with SIGTERM";
|
||||
break;
|
||||
fi
|
||||
done
|
@@ -1,9 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
isPaused=$(dunstctl is-paused)
|
||||
notificationCount=$(dunstctl count history)
|
||||
|
||||
if [[ "$isPaused" == "true" ]]; then
|
||||
echo " $notificationCount"
|
||||
else
|
||||
echo " $notificationCount"
|
||||
fi
|
@@ -1,33 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
mediaSourceIcon=$(`dirname $0`/get-media-source-icon.sh)
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
artist="N/A"
|
||||
title="N/A"
|
||||
album="N/A"
|
||||
status="N/A"
|
||||
else
|
||||
artist=$(playerctl --player=playerctld metadata --format '{{ xesam:artist }}')
|
||||
title=$(playerctl --player=playerctld metadata --format '{{ xesam:title }}')
|
||||
album=$(playerctl --player=playerctld metadata --format '{{ xesam:album }}')
|
||||
status=$(playerctl --player=playerctld metadata --format '{{ status }}')
|
||||
|
||||
if [[ $artist == "" ]]; then
|
||||
artist="N/A"
|
||||
fi
|
||||
|
||||
if [[ $title == "" ]]; then
|
||||
title="N/A"
|
||||
fi
|
||||
|
||||
if [[ $album == "" ]]; then
|
||||
album="N/A"
|
||||
fi
|
||||
|
||||
if [[ $status == "" ]]; then
|
||||
status="N/A"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo '{"text":"'$mediaSourceIcon'","tooltip":"\t'${title//'"'/'\"'}'\r\t'${artist//'"'/'\"'}'\r\t'${album//'"'/'\"'}'\r\t'${status//'"'/'\"'}'"}'
|
@@ -1,27 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo ""
|
||||
else
|
||||
trackid=$(playerctl --player=playerctld metadata --format '{{ mpris:trackid }}')
|
||||
title=$(playerctl --player=playerctld metadata --format '{{ xesam:title }}')
|
||||
|
||||
if grep -q -i "netflix" <<< "$title"; then
|
||||
echo ""
|
||||
elif grep -q -i "hulu" <<< "$title"; then
|
||||
echo ""
|
||||
elif grep -q -i "prime video" <<< "$title"; then
|
||||
echo ""
|
||||
elif grep -q -i "youtube tv" <<< "$title"; then
|
||||
echo ""
|
||||
elif grep -q -i "chromium" <<< "$trackid"; then
|
||||
echo ""
|
||||
elif grep -q -i "vlc" <<< "$trackid"; then
|
||||
echo ""
|
||||
elif grep -q -i "spotify" <<< "$trackid"; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
fi
|
@@ -1,12 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
mediaStatus=$(`dirname $0`/get-media-status.sh)
|
||||
|
||||
if [[ "$mediaStatus" == "N/A" ]]; then
|
||||
echo ""
|
||||
else
|
||||
if [[ "$mediaStatus" == "Playing" ]]; then
|
||||
echo ""
|
||||
elif [[ "$mediaStatus" == "Paused" ]]; then
|
||||
echo ""
|
||||
fi
|
||||
fi
|
@@ -1,10 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo "N/A"
|
||||
else
|
||||
status=$(playerctl --player=playerctld metadata --format '{{ status }}')
|
||||
|
||||
echo $status
|
||||
fi
|
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
profile="$(sudo system76-power profile | sed -z '$ s/\n$//' | tr '\n' '\r')"
|
||||
graphics="$(sudo system76-power graphics)"
|
||||
graphicsPower="$(sudo system76-power graphics power)"
|
||||
chargeThresholds="$(sudo system76-power charge-thresholds | sed -z '$ s/\n$//' | tr '\n' '\r')"
|
||||
|
||||
echo '{"text":" '$graphics'","tooltip":"\t'$graphics'\r\t'$graphicsPower'\r\r Profile\r'$profile'\r\r Charge Thresholds\r'$chargeThresholds'"}'
|
190
waybar/style.css
190
waybar/style.css
@@ -1,190 +0,0 @@
|
||||
window#waybar {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
#window {
|
||||
padding: 0px 0px;
|
||||
color: transparent;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
widget {
|
||||
background: #282a36;
|
||||
border-radius: 25px;
|
||||
}
|
||||
|
||||
label.module {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius: 0px;
|
||||
padding: 0px 0px;
|
||||
}
|
||||
|
||||
.module,button {
|
||||
font-size: 15px;
|
||||
font-family: Ubuntu Nerd Font;
|
||||
}
|
||||
|
||||
#battery {
|
||||
background: transparent;
|
||||
color: #ff79c6;
|
||||
}
|
||||
|
||||
#cpu {
|
||||
background: transparent;
|
||||
color: #ffb86c;
|
||||
}
|
||||
|
||||
#clock {
|
||||
background: transparent;
|
||||
color: #bd93f9;
|
||||
}
|
||||
|
||||
box#dunst {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
#custom-dunst-status {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-dunst-clear {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-dunst-history-view {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-dunst-history-clear {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
#tags {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
#tags button {
|
||||
background: transparent;
|
||||
color: #44475a;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#tags button.occupied {
|
||||
background: transparent;
|
||||
color: #f1fa8c;
|
||||
}
|
||||
#tags button.focused {
|
||||
background: transparent;
|
||||
box-shadow: inset 0 -3px #bd93f9;
|
||||
}
|
||||
#tags button.urgent {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
}
|
||||
#window.title {
|
||||
background: transparent;
|
||||
color: #f8f8f2;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
#window.layout {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 10px;
|
||||
}
|
||||
|
||||
#disk {
|
||||
background: transparent;
|
||||
color: #f1fa8c;
|
||||
}
|
||||
|
||||
#idle_inhibitor.activated {
|
||||
background: transparent;
|
||||
color: #f1fa8c;
|
||||
}
|
||||
#idle_inhibitor.deactivated {
|
||||
background: transparent;
|
||||
color: #44475a;
|
||||
}
|
||||
|
||||
#memory {
|
||||
background: transparent;
|
||||
color: #8be9fd;
|
||||
}
|
||||
|
||||
box#media-playing {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
#custom-media-playing-source {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-media-playing-prev {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-media-playing-play-pause {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-media-playing-next {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
box#power-menu {
|
||||
padding: 0px 10px;
|
||||
}
|
||||
#custom-power-menu-launcher {
|
||||
background: transparent;
|
||||
color: #8be9fd;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-power-menu-shutdown {
|
||||
background: transparent;
|
||||
color: #ff5555;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-power-menu-reboot {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-power-menu-sleep {
|
||||
background: transparent;
|
||||
color: #f1fa8c;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-power-menu-lock {
|
||||
background: transparent;
|
||||
color: #ff79c6;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
#custom-power-menu-logout {
|
||||
background: transparent;
|
||||
color: #ffb86c;
|
||||
padding: 0px 5px;
|
||||
}
|
||||
|
||||
#pulseaudio {
|
||||
background: transparent;
|
||||
color: #ff79c6;
|
||||
}
|
||||
|
||||
#custom-system76-power {
|
||||
background: transparent;
|
||||
color: #50fa7b;
|
||||
}
|
||||
|
||||
#tray {
|
||||
background: transparent;
|
||||
padding: 0px 10px;
|
||||
}
|
Reference in New Issue
Block a user