This commit is contained in:
korei999 2023-12-31 17:48:27 +02:00
parent 8eee19f93c
commit cb86dd01f1
4 changed files with 413 additions and 544 deletions

View file

@ -5,21 +5,22 @@ include config.mk
# flags for compiling
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L -DVERSION=\"$(VERSION)\" $(XWAYLAND)
DWLDEVCFLAGS = -g3 -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement -Wno-unused-parameter -Wno-sign-compare -Wshadow -Wunused-macros\
-Werror=strict-prototypes -Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types
# CFLAGS / LDFLAGS
CC = gcc -flto=auto
CFLAGS = -O2 -march=native
PKGS = wlroots wayland-server xkbcommon libinput pixman-1 $(XLIBS)
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(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 $(LDLIBS) $(LDFLAGS) $(DWLCFLAGS) -o $@
dwl.o: dwl.c config.mk config.def.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h wlr-output-power-management-unstable-v1-protocol.h dwl-ipc-unstable-v2-protocol.h pointer-constraints-unstable-v1-protocol.h
dwl.o: dwl.c config.mk config.def.h client.h cursor-shape-v1-protocol.h xdg-shell-protocol.h wlr-layer-shell-unstable-v1-protocol.h dwl-ipc-unstable-v2-protocol.h wlr-output-power-management-unstable-v1-protocol.h pointer-constraints-unstable-v1-protocol.h
util.o: util.c util.h
dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h
# wayland-scanner is a tool which generates C headers and rigging for Wayland
@ -28,27 +29,27 @@ dwl-ipc-unstable-v2-protocol.o: dwl-ipc-unstable-v2-protocol.h
WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-layer-shell-unstable-v1.xml $@
cursor-shape-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
wlr-output-power-management-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-output-power-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 $@
wlr-output-power-management-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-output-power-management-unstable-v1.xml $@
pointer-constraints-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
wlr-layer-shell-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-layer-shell-unstable-v1.xml $@
clean:
rm -f dwl *.o *-protocol.h

View file

@ -10,7 +10,7 @@ static inline int
client_is_x11(Client *c)
{
#ifdef XWAYLAND
return c->type == X11Managed || c->type == X11Unmanaged;
return c->type == X11;
#endif
return 0;
}
@ -270,7 +270,8 @@ static inline int
client_is_unmanaged(Client *c)
{
#ifdef XWAYLAND
return c->type == X11Unmanaged;
if (client_is_x11(c))
return c->surface.xwayland->override_redirect;
#endif
return 0;
}
@ -351,7 +352,7 @@ client_set_tiled(Client *c, uint32_t edges)
if (client_is_x11(c))
return;
#endif
if (wl_resource_get_version(c->surface.xdg->resource)
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
>= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
wlr_xdg_toplevel_set_tiled(c->surface.xdg->toplevel, edges);
} else {

View file

@ -5,29 +5,19 @@
(hex & 0xFF) / 255.0f }
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 1; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const int numlock = 1;
static const int capslock = 0;
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 smartborders = 1;
static const unsigned int borderpx = 3; /* border pixel of windows */
static const float rootcolor[] = COLOR(0x222222ff);
static const float bordercolor[] = COLOR(0x00000000);
static const float focuscolor[] = COLOR(0x7aa6daff);
static const float urgentcolor[] = COLOR(0xd54e53ff);
static const float stickycolor[] = COLOR(0x8abeb7ff);
static const float mixedcolor[] = COLOR(0xb5bd68ff);
/* 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, 0.0};
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
static const int center_relative_to_monitor = 1; /* 0 means center floating relative to the window area */
static const char *const autostart[] = {
"/home/korei/.config/dwl/dwlinit.sh", NULL,
NULL /* terminate */
};
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (10)
static int log_level = WLR_ERROR;
typedef enum {
VIEW_L = -1,
VIEW_R = 1,
@ -35,24 +25,32 @@ typedef enum {
SHIFT_R = 2,
} RotateTags;
/* keyboard layout change notification for status bar */
static const char kblayout_file[] = "/tmp/dwl-keymap";
static const char *kblayout_cmd[] = {"pkill", "-RTMIN+1", "someblocks", NULL};
static const int kblayout_perclient = 0;
/* Autostart */
static const char *const autostart[] = {
"/home/korei/.config/dwl/dwlinit.sh", NULL,
NULL /* terminate */
};
/* keyboard layout change notification for status bar */
/* example using someblocks:
static const char kblayout_file[] = "/tmp/dwl-keymap";
static const char *kblayout_cmd[] = {"pkill", "-RTMIN+1", "someblocks", NULL};
*/
/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (10)
/* logging */
static int log_level = WLR_ERROR;
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
/* examples:
{ "Gimp", NULL, 0, 1, -1 },
*/
{ "corectrl", NULL, 1 << 5, 0, -1 },
{ NULL, "Save File", 0, 1, -1 },
{"corectrl", NULL, 1 << 5, 0, -1},
{ NULL, "Save File", 0, 1, -1},
{ NULL, "Confirm to replace files", 0, 1, -1},
{ NULL, "File Operation Progress", 0, 1, -1},
{ NULL, "Seer Console", 0, 1, -1},
};
/* layout(s) */
@ -64,9 +62,8 @@ static const Layout layouts[] = {
{ "><>", NULL } /* no layout function means floating behavior */
};
/* monitors
* The order in which monitors are defined determines their position.
* Non-configured monitors are always added to the left. */
/* monitors */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
/* name mfact nmaster scale layout rotate/reflect x y */
/* example of a HiDPI laptop monitor:
@ -76,7 +73,6 @@ static const MonitorRule monrules[] = {
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
};
/* keyboard */
static const struct xkb_rule_names xkb_rules = {
/* can specify fields: rules, model, layout, variant, options */
@ -127,11 +123,8 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
static const double accel_speed = -0.5;
static const int cursor_timeout = 2;
/* separate variables for trackpad */
static const enum libinput_config_accel_profile accel_profile_trackpad = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
static const double accel_speed_trackpad = -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
@ -155,7 +148,7 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
/* commands */
static const char* Term[] = { "footclient", NULL };
static const char* TermAlt[] = { "foot", NULL };
static const char* TermAlt[] = { "foot", "--maximized", NULL };
static const char* Menu[] = { "fuzzel", NULL };
static const char* PowerMenu[] = { "powermenu.sh", NULL };
static const char* AudioUpdate[] = { "pkill", "-RTMIN+12", "someblocks", NULL };
@ -260,7 +253,7 @@ static const Key keys[] = {
TAGKEYS(Key_8, 7),
TAGKEYS(Key_9, 8),
TAGKEYS(Key_0, 9),
{ SUPER | ALT, Key_q, quit, { 0 } },
{ SUPER | CTRL, 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(KEY, n) \

816
dwl.c

File diff suppressed because it is too large Load diff