From f087e7711353836df6208c2aa898e85b3dd42c46 Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Thu, 5 Dec 2024 09:03:15 +0000 Subject: [PATCH] Tweak default config to match dwm --- config.def.h | 116 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 44 deletions(-) diff --git a/config.def.h b/config.def.h index a676cdf..d9befe4 100644 --- a/config.def.h +++ b/config.def.h @@ -8,32 +8,23 @@ 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 smartborders = 1; static const unsigned int borderpx = 1; /* border pixel of windows */ -static const float rootcolor[] = COLOR(0x222222ff); -static const float bordercolor[] = COLOR(0x444444ff); -static const float focuscolor[] = COLOR(0x005577ff); +static const float rootcolor[] = COLOR(0x000000ff); +static const float bordercolor[] = COLOR(0xC3B495ff); +static const float focuscolor[] = COLOR(0xCC838Cff); static const float urgentcolor[] = 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 */ +static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */ /* tagging - TAGCOUNT must be no greater than 31 */ -#define TAGCOUNT (9) +#define TAGCOUNT (6) /* logging */ static int log_level = WLR_ERROR; -/* Autostart */ -static const char *const autostart[] = { - "wbg", "/path/to/your/image", NULL, - NULL /* terminate */ -}; - - /* 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 */ - /* 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" */ + { NULL, NULL, 0, 0, -1 }, }; /* layout(s) */ @@ -42,7 +33,7 @@ static const Layout layouts[] = { { "[]=", tile }, { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, - { "###", gaplessgrid }, + { "-|_", gaplessgrid }, { "|M|", centeredmaster }, { "TTT", bstack }, { "===", bstackhoriz }, @@ -65,11 +56,8 @@ static const MonitorRule monrules[] = { /* keyboard */ static const struct xkb_rule_names xkb_rules = { - /* can specify fields: rules, model, layout, variant, options */ - /* example: - .options = "ctrl:nocaps", - */ - .options = NULL, + .layout = "us,de", + .options = "grp:alt_shift_toggle", }; static const int repeat_rate = 25; @@ -109,7 +97,7 @@ static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED; 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 enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT; static const double accel_speed = 0.0; /* You can choose between: @@ -119,7 +107,7 @@ 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 MODKEY WLR_MODIFIER_LOGO #define TAGKEYS(KEY,SKEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ @@ -128,17 +116,65 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA { 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 } } +#define SHWRAP(cmd) (const char*[]){ "/bin/sh", "-c", cmd, NULL } +#define TERMWRAP(cmd) (const char*[]){ "foot", cmd, NULL } +#define MPVSOCK(cmd) SHWRAP("echo '" cmd "' | socat -u - ~/.mpvsock") +#define LOCKER "swaylock", "-f", "-F", "-c", "000000" /* commands */ static const char *termcmd[] = { "foot", NULL }; -static const char *menucmd[] = { "wmenu-run", NULL }; +static const char *menucmd[] = { + "bemenu-run", + "-p", "spawn", + "--list", "30", + "-W", "0.7", + "--scrollbar", "autohide", + "-c", + "--tb", "#CC838C", + "--tf", "#000000", + "--nb", "#000000", + "--nf", "#CC838C", + "--hb", "#CC838C", + "--hf", "#000000", + "--ab", "#101010", + "--af", "#CC838C", + "--scb", "#000000", + "--scf", "#CC838C", + NULL +}; +static const char *lock[] = { LOCKER }; +static const char *screenshot[] = SHWRAP("wayshot -s $(slurp) --file /tmp/out.png"); +static const char *audiomixer[] = TERMWRAP("pulsemixer"); + +/* Autostart */ +// NOTE: While this is a ugly hack, unfortunately it is not yet possible to pass the desired IPC socket path + WAYLAND_DISPLAY as a parameter, but it would be highly appreciated +// Once associating/grouping services by a well-known path is easily possible without passing env via alternative ways, this should go away +static const char *const autostart[] = { + "waybar", NULL, + "swayidle", "-w", + "timeout", "300", LOCKER, + "timeout", "600", "swaymsg \"output * power off\"", + "resume", "swaymsg \"output * power on\"", + "before-sleep", LOCKER, NULL, + NULL /* terminate */ +}; 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} }, + + /* software */ + { MODKEY, XKB_KEY_space, spawn, {.v = menucmd} }, + { MODKEY, XKB_KEY_c, spawn, {.v = termcmd} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_l, spawn, {.v = lock} }, + { 0, XKB_KEY_Print, spawn, {.v = screenshot} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_v, spawn, {.v = audiomixer} }, + + /* mpv controls */ + { 0, XKB_KEY_XF86AudioPlay, spawn, {.v = MPVSOCK("keypress space") }, + { 0, XKB_KEY_XF86AudioPrev, spawn, {.v = MPVSOCK("playlist-prev") }, + { 0, XKB_KEY_XF86AudioPlay, spawn, {.v = MPVSOCK("playlist-next") }, + + /* window management */ { MODKEY, XKB_KEY_b, togglebar, {0} }, { MODKEY, XKB_KEY_j, focusstack, {.i = +1} }, { MODKEY, XKB_KEY_k, focusstack, {.i = -1} }, @@ -149,16 +185,15 @@ static const Key keys[] = { { 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_g, setlayout, {.v = &layouts[3]} }, - { MODKEY, XKB_KEY_c, setlayout, {.v = &layouts[4]} }, - { MODKEY, XKB_KEY_u, setlayout, {.v = &layouts[5]} }, - { MODKEY, XKB_KEY_o, setlayout, {.v = &layouts[6]} }, - { MODKEY, XKB_KEY_space, setlayout, {0} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_T, setlayout, {.v = &layouts[0]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_F, setlayout, {.v = &layouts[1]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_M, setlayout, {.v = &layouts[2]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_G, setlayout, {.v = &layouts[3]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, setlayout, {.v = &layouts[4]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_U, setlayout, {.v = &layouts[5]} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, setlayout, {.v = &layouts[6]} }, { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} }, - { MODKEY, XKB_KEY_e, togglefullscreen, {0} }, + { MODKEY|WLR_MODIFIER_SHIFT, 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} }, @@ -172,15 +207,8 @@ static const Key keys[] = { 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} }, - /* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is - * do not remove them. - */ #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),