apply ipc patch

This commit is contained in:
Dmitry Zakharchenko 2023-01-28 11:01:18 +02:00
parent 8653b27692
commit c5d2d95e3b
7 changed files with 1101 additions and 232 deletions

View File

@ -14,9 +14,9 @@ DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CF
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 xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h
dwl: dwl.o util.o net-tapesoftware-dwl-wm-unstable-v1-protocol.o
$(CC) dwl.o util.o net-tapesoftware-dwl-wm-unstable-v1-protocol.o $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
dwl.o: dwl.c config.mk config.h client.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h net-tapesoftware-dwl-wm-unstable-v1-protocol.h
util.o: util.c util.h
# wayland-scanner is a tool which generates C headers and rigging for Wayland
@ -32,6 +32,16 @@ wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-layer-shell-unstable-v1.xml $@
net-tapesoftware-dwl-wm-unstable-v1-protocol.h: protocols/net-tapesoftware-dwl-wm-unstable-v1.xml
$(WAYLAND_SCANNER) server-header \
protocols/net-tapesoftware-dwl-wm-unstable-v1.xml $@
net-tapesoftware-dwl-wm-unstable-v1-protocol.c: protocols/net-tapesoftware-dwl-wm-unstable-v1.xml
$(WAYLAND_SCANNER) private-code \
protocols/net-tapesoftware-dwl-wm-unstable-v1.xml $@
net-tapesoftware-dwl-wm-unstable-v1-protocol.o: net-tapesoftware-dwl-wm-unstable-v1-protocol.h
config.h:
cp config.def.h $@
clean:

View File

@ -1,158 +0,0 @@
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
/* examples:
{ "Gimp", NULL, 0, 1, -1 },
*/
{ "firefox", NULL, 1 << 8, 0, -1 },
};
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
{ "[M]", monocle },
};
/* monitors */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect */
/* example of a HiDPI laptop monitor:
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
*/
/* defaults */
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
/* example:
.options = "ctrl:nocaps",
*/
.options = NULL,
};
static const int repeat_rate = 25;
static const int repeat_delay = 600;
/* Trackpad */
static const int tap_to_click = 1;
static const int tap_and_drag = 1;
static const int drag_lock = 1;
static const int natural_scrolling = 0;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 0;
/* You can choose between:
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
LIBINPUT_CONFIG_SCROLL_2FG
LIBINPUT_CONFIG_SCROLL_EDGE
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
*/
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
/* You can choose between:
LIBINPUT_CONFIG_CLICK_METHOD_NONE
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
*/
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
/* You can choose between:
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
*/
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
/* You can choose between:
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed = 0.0;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
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;
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_ALT
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static const char *termcmd[] = { "foot", NULL };
static const char *menucmd[] = { "bemenu-run", 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} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ 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]} },
{ MODKEY, XKB_KEY_space, setlayout, {0} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_e, togglefullscreen, {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} },
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};

196
config.h Normal file
View File

@ -0,0 +1,196 @@
static const int sloppyfocus = 1;
static const int lockfullscreen = 1;
static const int smartgaps = 1;
static const int bypass_surface_visibility = 1;
static const unsigned int borderpx = 3;
static const unsigned int gappih = 15;
static const unsigned int gappiv = 15;
static const unsigned int gappoh = 15;
static const unsigned int gappov = 15;
static const float rootcolor[] = {0.13, 0.13, 0.13, 1.0};
static const float bordercolor[] = {0.26, 0.26, 0.26, 1.0};
static const float focuscolor[] = {0.0, 0.33, 0.46, 1.0};
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* app_id title mask scrkey isflt isterm noswl mon*/
{ "foot", NULL, 0, 0, 0, 1, 0, -1 },
{ NULL, "ncm", 0, 0, 1, 1, 0, -1 },
{ NULL, "pmr", 0, 0, 1, 1, 0, -1 },
{ NULL, "scr", 0, 's', 1, 1, 0, -1 },
{ NULL, "clc", 0, 'c', 1, 1, 0, -1 },
};
#include "vanitygaps.c"
/* layout(s) */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[T]=", tile },
{ "[M]", monocle },
{ "[F]", NULL },
};
/* monitors */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect */
{ NULL, 0.50, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
.layout = "us,ua",
.options = "grp:ctrl_shift_toggle,altwin:menu_win"
};
static const int repeat_rate = 50;
static const int repeat_delay = 300;
/* Trackpad */
static const int tap_to_click = 1;
static const int tap_and_drag = 1;
static const int drag_lock = 1;
static const int natural_scrolling = 0;
static const int cursor_timeout = 5;
static const int disable_while_typing = 1;
static const int left_handed = 0;
static const int middle_button_emulation = 0;
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed = 0.0;
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */
#define MODKEY WLR_MODIFIER_LOGO
#define ALTKEY WLR_MODIFIER_ALT
#define SHIFT WLR_MODIFIER_SHIFT
#define CTRL WLR_MODIFIER_CTRL
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|CTRL|SHIFT,SKEY, toggletag, {.ui = 1 << TAG} }
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* Autostart */
static const char *const autostart[] = {
"sh", "-c", "mpd", NULL,
"sh", "-c", "gpg-agent --daemon", NULL,
"sh", "-c", "pipewire", NULL,
"wbg", "/home/dmitz/.config/wall.png", NULL,
"someblocks", NULL,
NULL /* terminate */
};
/* named scratchpads - First arg only serves to match against key in rules*/
static const char *spcmd1[] = {"s", "foot", "-T", "scr", NULL };
static const char *spcmd2[] = {"c", "foot", "-T", "clc", "bc", "-q", NULL };
#include "shiftview.c"
static const Key keys[] = {
TAGKEYS(XKB_KEY_1, XKB_KEY_1, 0),
TAGKEYS(XKB_KEY_2, XKB_KEY_2, 1),
TAGKEYS(XKB_KEY_3, XKB_KEY_3, 2),
TAGKEYS(XKB_KEY_4, XKB_KEY_4, 3),
TAGKEYS(XKB_KEY_5, XKB_KEY_5, 4),
TAGKEYS(XKB_KEY_6, XKB_KEY_6, 5),
TAGKEYS(XKB_KEY_7, XKB_KEY_7, 6),
TAGKEYS(XKB_KEY_8, XKB_KEY_8, 7),
TAGKEYS(XKB_KEY_9, XKB_KEY_9, 8),
{ MODKEY, XKB_KEY_Return, spawn, SHCMD("foot") },
{ MODKEY|SHIFT, XKB_KEY_Return, togglescratch, {.v = spcmd1} },
{ MODKEY, XKB_KEY_d, spawn, SHCMD("tofi-run") },
{ MODKEY|SHIFT, XKB_KEY_d, spawn, SHCMD("passmenu") },
{ MODKEY, XKB_KEY_w, spawn, SHCMD("$BROWSER") },
{ MODKEY|SHIFT, XKB_KEY_w, spawn, SHCMD("$BROWSER --temp-basedir -s content.private_browsing true") },
{ MODKEY, XKB_KEY_e, spawn, SHCMD("foot neomutt") },
{ MODKEY, XKB_KEY_r, spawn, SHCMD("foot vifm") },
{ MODKEY|SHIFT, XKB_KEY_r, spawn, SHCMD("foot btm") },
{ MODKEY, XKB_KEY_m, spawn, SHCMD("foot -T=ncm ncmpcpp") },
{ MODKEY|SHIFT, XKB_KEY_m, spawn, SHCMD("foot -T=pmr pulsemixer") },
{ MODKEY, XKB_KEY_c, spawn, SHCMD("foot pipe-viewer") },
{ MODKEY, XKB_KEY_n, spawn, SHCMD("foot newsboat") },
{ MODKEY, XKB_KEY_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -45 $(pidof someblocks)") },
{ MODKEY|SHIFT, XKB_KEY_minus, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%-; kill -45 $(pidof someblocks)") },
{ MODKEY, XKB_KEY_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -45 $(pidof someblocks)") },
{ MODKEY|SHIFT, XKB_KEY_equal, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 15%+; kill -45 $(pidof someblocks)") },
{ MODKEY, XKB_KEY_BackSpace, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -45 $(pidof someblocks)") },
{ MODKEY, XKB_KEY_comma, spawn, SHCMD("mpc prev") },
{ MODKEY|SHIFT, XKB_KEY_comma, spawn, SHCMD("mpc seek 0%") },
{ MODKEY, XKB_KEY_period, spawn, SHCMD("mpc next") },
{ MODKEY|SHIFT, XKB_KEY_period, spawn, SHCMD("mpc repeat") },
{ MODKEY, XKB_KEY_p, spawn, SHCMD("mpc toggle; kill -46 $(pidof someblocks)") },
{ SHIFT, XKB_KEY_Print, spawn, SHCMD("grimpick") },
{ MODKEY|SHIFT, XKB_KEY_Print, spawn, SHCMD("record") },
{ 0, XKB_KEY_Print, spawn, SHCMD("grim pic-full-$(date '+%y%m%d-%H%M-%S').png") },
{ ALTKEY, XKB_KEY_1, spawn, SHCMD("wlfreerdp $XDG_DATA_HOME/rdp/aws.rdp /dynamic-resolution") },
{ ALTKEY|SHIFT, XKB_KEY_1, spawn, SHCMD("wlfreerdp $XDG_DATA_HOME/rdp/aws2.rdp /dynamic-resolution") },
{ ALTKEY, XKB_KEY_2, spawn, SHCMD("sysact lock") },
{ MODKEY|SHIFT, XKB_KEY_x, spawn, SHCMD("sysact shut") },
{ MODKEY|SHIFT, XKB_KEY_q, spawn, SHCMD("sysact rest") },
{ MODKEY|SHIFT, XKB_KEY_BackSpace, spawn, SHCMD("sysact reb") },
{ ALTKEY, XKB_KEY_3, spawn, SHCMD("torwrap open") },
{ ALTKEY|SHIFT, XKB_KEY_3, spawn, SHCMD("torwrap toggle") },
{ ALTKEY, XKB_KEY_4, spawn, SHCMD("wm-mount") },
{ ALTKEY|SHIFT, XKB_KEY_4, spawn, SHCMD("wm-umount") },
{ 0, XKB_KEY_XF86AudioMute, spawn, SHCMD("wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle; kill -45 $(pidof someblocks)") },
{ 0, XKB_KEY_XF86AudioRaiseVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+; kill -45 $(pidof someblocks)") },
{ 0, XKB_KEY_XF86AudioLowerVolume, spawn, SHCMD("wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-; kill -45 $(pidof someblocks)") },
{ 0, XKB_KEY_XF86AudioMicMute, spawn, SHCMD("wpctl set-mute @DEFAULT_SOURCE@ toggle") },
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
{ MODKEY|SHIFT, XKB_KEY_t, setlayout, {.v = &layouts[1]} },
{ MODKEY, XKB_KEY_y, setlayout, {.v = &layouts[2]} },
{ MODKEY|SHIFT, XKB_KEY_y, setlayout, {.v = &layouts[3]} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY|SHIFT, XKB_KEY_j, movestack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
{ MODKEY|SHIFT, XKB_KEY_k, movestack, {.i = -1} },
{ MODKEY, XKB_KEY_v, focusmaster, {0} },
{ MODKEY, XKB_KEY_o, incnmaster, {.i = +1 } },
{ MODKEY|SHIFT, XKB_KEY_o, incnmaster, {.i = -1 } },
{ MODKEY, XKB_KEY_0, view, {.ui = ~0 } },
{ MODKEY, XKB_KEY_q, killclient, {0} },
{ MODKEY, XKB_KEY_a, togglegaps, {0} },
{ MODKEY|SHIFT, XKB_KEY_a, defaultgaps, {0} },
{ MODKEY, XKB_KEY_x, incgaps, {.i = +3} },
{ MODKEY, XKB_KEY_z, incgaps, {.i = -3} },
{ MODKEY, XKB_KEY_g, shiftview, {.i = -1} },
{ MODKEY, XKB_KEY_semicolon, shiftview, {.i = 1} },
{ MODKEY, XKB_KEY_Tab, view, {0} },
{ MODKEY, XKB_KEY_space, zoom, {0} },
{ MODKEY|SHIFT, XKB_KEY_space, togglefloating, {0} },
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
{ MODKEY, XKB_KEY_s, togglesticky, {0} },
{ MODKEY, XKB_KEY_f, togglefullscreen, {0} },
{ MODKEY, XKB_KEY_apostrophe, togglescratch, {.v = spcmd2} },
{ MODKEY, XKB_KEY_b, spawn, SHCMD("somebar -c toggle all") },
{ MODKEY|SHIFT, XKB_KEY_b, spawn, SHCMD("bluetooth") },
{ MODKEY, XKB_KEY_Left, focusmon, {.i = -1 } },
{ MODKEY|SHIFT, XKB_KEY_Left, tagmon, {.i = -1 } },
{ MODKEY, XKB_KEY_Right, focusmon, {.i = +1 } },
{ MODKEY|SHIFT, XKB_KEY_Right, tagmon, {.i = +1 } },
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
{ CTRL|ALTKEY,XKB_KEY_Terminate_Server, quit, {0} },
#define CHVT(n) { CTRL|ALTKEY,XKB_KEY_F##n, chvt, {.ui = (n)} }
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
};
static const Button buttons[] = {
{ MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
};

681
dwl.c

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="net_tapesoftware_dwl_wm_unstable_v1">
<copyright>
Copyright (c) 2021 Raphael Robatsch
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice (including the
next paragraph) shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="znet_tapesoftware_dwl_wm_v1" version="1">
<description summary="control the dwl state">
This interface is exposed as a global in the wl_registry.
Clients can use this protocol to receive updates of the window manager
state (active tags, active layout, and focused window).
Clients can also control this state.
After binding, the client will receive the available tags and layouts
with the 'tag' and 'layout' events. These can be used in subsequent
dwl_wm_monitor_v1.set_tags/set_layout requests, and to interpret the
dwl_wm_monitor_v1.layout/tag events.
</description>
<request name="release" type="destructor">
<description summary="release dwl_wm">
This request indicates that the client will not use the dwl_wm
object any more. Objects that have been created through this instance
are not affected.
</description>
</request>
<request name="get_monitor">
<description summary="gets a dwl monitor from an output">
Gets a dwl monitor for the specified output. The window manager
state on the output can be controlled using the monitor.
</description>
<arg name="id" type="new_id" interface="znet_tapesoftware_dwl_wm_monitor_v1" />
<arg name="output" type="object" interface="wl_output" />
</request>
<event name="tag">
<description summary="announces the presence of a tag">
This event is sent immediately after binding.
A roundtrip after binding guarantees that the client has received all tags.
</description>
<arg name="name" type="string"/>
</event>
<event name="layout">
<description summary="announces the presence of a layout">
This event is sent immediately after binding.
A roundtrip after binding guarantees that the client has received all layouts.
</description>
<arg name="name" type="string"/>
</event>
</interface>
<interface name="znet_tapesoftware_dwl_wm_monitor_v1" version="1">
<description summary="control one monitor">
Observes and controls one monitor.
Events are double-buffered: Clients should cache all events and only
redraw themselves once the 'frame' event is sent.
Requests are not double-buffered: The compositor will update itself
immediately.
</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_monitor">
This request indicates that the client is done with this dwl_monitor.
All further requests are ignored.
</description>
</request>
<event name="selected">
<description summary="updates the selected state of the monitor">
If 'selected' is nonzero, this monitor is the currently selected one.
</description>
<arg name="selected" type="uint"/>
</event>
<event name="tag">
<description summary="updates the state of one tag">
Announces the update of a tag. num_clients and focused_client can be
used to draw client indicators.
</description>
<arg name="tag" type="uint" summary="index of a tag received by the dwl_wm_v1.tag event." />
<arg name="state" type="uint" enum="tag_state"/>
<arg name="num_clients" type="uint" summary="number of clients on this tag"/>
<arg name="focused_client" type="int" summary="out of num_clients. -1 if there is no focused client"/>
</event>
<event name="layout">
<description summary="updates the selected layout">
Announces the update of the selected layout.
</description>
<arg name="layout" type="uint" summary="index of a layout received by the dwl_wm_v1.layout event."/>
</event>
<event name="title">
<description summary="updates the focused client">
Announces the update of the selected client.
</description>
<arg name="title" type="string"/>
</event>
<event name="frame">
<description summary="end of status update sequence">
Sent after all other events belonging to the status update has been sent.
Clients should redraw themselves now.
</description>
</event>
<request name="set_tags">
<description summary="sets the active tags on this monitor.">
Changes are applied immediately.
</description>
<arg name="tagmask" type="uint" summary="bitmask of the tags that should be set."/>
<arg name="toggle_tagset" type="uint"/>
</request>
<request name="set_client_tags">
<description summary="updates the tags of the focused client.">
tags are updated as follows:
new_tags = (current_tags AND and_tags) XOR xor_tags
Changes are applied immediately.
</description>
<arg name="and_tags" type="uint"/>
<arg name="xor_tags" type="uint"/>
</request>
<request name="set_layout">
<description summary="sets the active layout on this monitor.">
Changes are applied immediately.
</description>
<arg name="layout" type="uint" summary="index of a layout received by the dwl_wm_v1.layout event."/>
</request>
</interface>
</protocol>

35
shiftview.c Normal file
View File

@ -0,0 +1,35 @@
// "arg->i" stores the number of tags to shift right (positive value)
// or left (negative value)
void
shiftview(const Arg *arg)
{
Arg a;
Client *c;
size_t ntags = LENGTH(tags);
bool visible = false;
int i = arg->i;
int count = 0;
int nextseltags, curseltags = selmon->tagset[selmon->seltags];
do {
if (i > 0) // left circular shift
nextseltags = (curseltags << i) | (curseltags >> (ntags - i));
else // right circular shift
nextseltags = curseltags >> (- i) | (curseltags << (ntags + i));
// Check if the tag is visible
wl_list_for_each(c, &clients, link) {
if (c->mon == selmon && nextseltags & c->tags) {
visible = true;
break;
}
}
i += arg->i;
} while (!visible && ++count <= ntags);
if (count <= ntags) {
a.i = nextseltags;
view(&a);
}
}

83
vanitygaps.c Normal file
View File

@ -0,0 +1,83 @@
static void tile(Monitor *m);
static void incgaps(const Arg *arg);
static void setgaps(int oh, int ov, int ih, int iv);
static void togglegaps(const Arg *arg);
static void defaultgaps(const Arg *arg);
static int enablegaps = 1; /* enables gaps, used by togglegaps */
void
incgaps(const Arg *arg)
{
setgaps(
selmon->gappoh + arg->i,
selmon->gappov + arg->i,
selmon->gappih + arg->i,
selmon->gappiv + arg->i
);
}
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
togglegaps(const Arg *arg)
{
enablegaps = !enablegaps;
arrange(selmon);
}
void
defaultgaps(const Arg *arg)
{
setgaps(gappoh, gappov, gappih, gappiv);
}
void
tile(Monitor *m)
{
unsigned int i, n = 0, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
Client *c;
wl_list_for_each(c, &clients, link)
if (VISIBLEON(c, m) && !c->isfloating && !c->isfullscreen)
n++;
if (n == 0)
return;
if (smartgaps == n) {
oe = 0; // outer gaps disabled
}
if (n > m->nmaster)
mw = m->nmaster ? (m->w.width + m->gappiv*ie) * m->mfact : 0;
else
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) {
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 {
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++;
}
}