diff options
-rw-r--r-- | config.def.h | 109 | ||||
-rw-r--r-- | dwl.c | 35 |
2 files changed, 92 insertions, 52 deletions
diff --git a/config.def.h b/config.def.h index 1677f6f..f505aa7 100644 --- a/config.def.h +++ b/config.def.h @@ -1,11 +1,13 @@ /* 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 bordercolor[] = {0.5, 0.5, 0.5, 1.0}; -static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0}; +static const unsigned int borderpx = 2; /* border pixel of windows */ +static const int monoclegaps = 1; /* 1 means gaps in monocle layout */ +static const unsigned int gap = 10; /* gap size */ +static const float bordercolor[] = {0.27, 0.27, 0.27, 1.0}; +static const float focuscolor[] = {0.0, 0.33, 0.47, 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}; +static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* tagging - tagcount must be no greater than 31 */ #define TAGCOUNT (9) @@ -92,7 +94,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} }, \ @@ -105,44 +107,70 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA /* commands */ static const char *termcmd[] = { "foot", NULL }; -static const char *menucmd[] = { "bemenu-run", NULL }; +static const char *menucmd[] = { "menu_run", NULL }; +static const char *nnnfm[] = { "foot", "nnn", "-decC", NULL }; +static const char *www[] = { "firefox", NULL }; +static const char *damb[] = { "damb", NULL }; +static const char *dbook[] = { "dbook", NULL }; +static const char *scrshot[] = { "freezshot", NULL }; + +/* control */ +static const char *scrlock[] = { "swaylock", NULL }; +static const char *upbri[] = { "wobload", "brightnessctl", "set", "+1%", NULL }; +static const char *downbri[] = { "wobload", "brightnessctl", "set", "1%-", NULL }; +static const char *upvol[] = { "wobload", "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%+", NULL }; +static const char *downvol[] = { "wobload", "wpctl", "set-volume", "@DEFAULT_AUDIO_SINK@", "5%-", NULL }; +static const char *voltogl[] = { "wobload", "wpctl", "set-mute", "@DEFAULT_AUDIO_SINK@", "toggle", NULL }; +static const char *mutemic[] = { "audio_mutemic", 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} }, + /* modifier key function argument */ + { MODKEY, XKB_KEY_p, spawn, {.v = menucmd} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} }, + { MODKEY, XKB_KEY_n, spawn, {.v = nnnfm} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_W, spawn, {.v = www} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_A, spawn, {.v = damb} }, + { MODKEY, XKB_KEY_x, spawn, {.v = scrlock} }, + { MODKEY, XKB_KEY_b, spawn, {.v = dbook} }, + { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_S, spawn, {.v = scrshot} }, + { 0, XKB_KEY_XF86MonBrightnessDown, spawn, {.v = downbri} }, + { 0, XKB_KEY_XF86MonBrightnessUp, spawn, {.v = upbri} }, + { 0, XKB_KEY_XF86AudioMute, spawn, {.v = voltogl} }, + { 0, XKB_KEY_XF86AudioLowerVolume, spawn, {.v = downvol} }, + { 0, XKB_KEY_XF86AudioRaiseVolume, spawn, {.v = upvol} }, + { 0, XKB_KEY_XF86AudioMicMute, spawn, {.v = mutemic} }, + { 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} }, @@ -156,3 +184,4 @@ static const Button buttons[] = { { MODKEY, BTN_MIDDLE, togglefloating, {0} }, { MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} }, }; + @@ -907,6 +907,7 @@ createmon(struct wl_listener *listener, void *data) /* Initialize monitor state using configured rules */ for (i = 0; i < LENGTH(m->layers); i++) wl_list_init(&m->layers[i]); + m->tagset[0] = m->tagset[1] = 1; for (r = monrules; r < END(monrules); r++) { if (!r->name || strstr(wlr_output->name, r->name)) { @@ -1042,7 +1043,7 @@ createpointer(struct wlr_pointer *pointer) if (libinput_device_config_scroll_get_methods(libinput_device) != LIBINPUT_CONFIG_SCROLL_NO_SCROLL) libinput_device_config_scroll_set_method (libinput_device, scroll_method); - + if (libinput_device_config_click_get_methods(libinput_device) != LIBINPUT_CONFIG_CLICK_METHOD_NONE) libinput_device_config_click_set_method (libinput_device, click_method); @@ -1624,8 +1625,13 @@ 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 + gap, .y = m->w.y + gap, + .width = m->w.width - 2 * gap, .height = m->w.height - 2 * gap}, 0); } if (n) snprintf(m->ltsymbol, LENGTH(m->ltsymbol), "[%d]", n); @@ -2358,7 +2364,7 @@ tagmon(const Arg *arg) void tile(Monitor *m) { - unsigned int i, n = 0, mw, my, ty; + unsigned int i, n = 0, h, r, mw, my, ty; Client *c; wl_list_for_each(c, &clients, link) @@ -2368,21 +2374,26 @@ tile(Monitor *m) return; if (n > m->nmaster) - mw = m->nmaster ? m->w.width * m->mfact : 0; + mw = m->nmaster ? (m->w.width + gap) * m->mfact : 0; else - mw = m->w.width; - i = my = ty = 0; + mw = m->w.width - gap; + i = 0; + my = ty = gap; 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 - gap - gap * (r - 1)) / r; + resize(c, (struct wlr_box){.x = m->w.x + gap, .y = m->w.y + my, + .width = mw - gap, .height = h}, 0); + my += c->geom.height + gap; } 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 - gap - gap * (r - 1)) / r; + resize(c, (struct wlr_box){.x = m->w.x + mw + gap, .y = m->w.y + ty, + .width = m->w.width - mw - 2*gap, .height = h}, 0); + ty += c->geom.height + gap; } i++; } |