| 1 |
/* Taken from https://github.com/djpohly/dwl/issues/466 */
|
| 2 |
#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
|
| 3 |
((hex >> 16) & 0xFF) / 255.0f, \
|
| 4 |
((hex >> 8) & 0xFF) / 255.0f, \
|
| 5 |
(hex & 0xFF) / 255.0f }
|
| 6 |
/* appearance */
|
| 7 |
static const int sloppyfocus = 1; /* focus follows mouse */
|
| 8 |
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
|
| 9 |
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
| 10 |
static int gaps = 1; /* 1 means gaps between windows are added */
|
| 11 |
static const unsigned int gappx = 3; /* gap pixel between windows */
|
| 12 |
static const unsigned int borderpx = 0; /* border pixel of windows */
|
| 13 |
static const int showbar = 1; /* 0 means no bar */
|
| 14 |
static const int topbar = 1; /* 0 means bottom bar */
|
| 15 |
static const char *fonts[] = {"JetBrainsMono Nerd Font Mono:style=Bold:size=16"};
|
| 16 |
static const float rootcolor[] = COLOR(0x000000ff);
|
| 17 |
|
| 18 |
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
| 19 |
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
| 20 |
|
| 21 |
/* Base grays/cyan */
|
| 22 |
static const uint32_t col_gray1 = 0x000000ff;
|
| 23 |
static const uint32_t col_gray2 = 0x444444ff;
|
| 24 |
static const uint32_t col_gray3 = 0xbbbbbbff;
|
| 25 |
static const uint32_t col_gray4 = 0xeeeeeeff;
|
| 26 |
static const uint32_t col_cyan = 0x4d6a8eff;
|
| 27 |
|
| 28 |
/* TokyoNight colors (0xRRGGBBAA) */
|
| 29 |
static const uint32_t col_bg = 0x1a1b26ff; /* background */
|
| 30 |
static const uint32_t col_fg = 0xa9b1d6ff; /* foreground */
|
| 31 |
static const uint32_t col_blk = 0x32344aff; /* black (normal) */
|
| 32 |
static const uint32_t col_red = 0xf7768eff; /* red */
|
| 33 |
static const uint32_t col_grn = 0x9ece6aff; /* green */
|
| 34 |
static const uint32_t col_ylw = 0xe0af68ff; /* yellow */
|
| 35 |
static const uint32_t col_blu = 0x7aa2f7ff; /* blue */
|
| 36 |
static const uint32_t col_mag = 0xad8ee6ff; /* magenta */
|
| 37 |
static const uint32_t col_cyn = 0x0db9d7ff; /* cyan (highlight) */
|
| 38 |
static const uint32_t col_brblk = 0x444b6aff; /* bright black */
|
| 39 |
|
| 40 |
// ANSI 16-color table for SGR (0..7 normal, 8..15 bright)
|
| 41 |
static const uint32_t barcolors[16] = {
|
| 42 |
col_bg, // 0: black
|
| 43 |
col_red, // 1: red
|
| 44 |
col_grn, // 2: green
|
| 45 |
col_ylw, // 3: yellow
|
| 46 |
col_blu, // 4: blue
|
| 47 |
col_mag, // 5: magenta
|
| 48 |
col_cyn, // 6: cyan
|
| 49 |
col_fg, // 7: white (normal foreground)
|
| 50 |
col_brblk, // 8: bright black (gray)
|
| 51 |
col_red, // 9: bright red
|
| 52 |
col_grn, // 10: bright green
|
| 53 |
col_ylw, // 11: bright yellow
|
| 54 |
col_blu, // 12: bright blue
|
| 55 |
col_mag, // 13: bright magenta
|
| 56 |
col_cyn, // 14: bright cyan
|
| 57 |
0xffffffff // 15: bright white (fallback)
|
| 58 |
};
|
| 59 |
|
| 60 |
|
| 61 |
static uint32_t colors[][3] = {
|
| 62 |
/* fg bg border */
|
| 63 |
[SchemeNorm] = { col_fg, col_bg, col_brblk }, // vacant tags
|
| 64 |
[SchemeSel] = { col_cyn, col_bg, col_mag }, // selected tag
|
| 65 |
[SchemeOcc] = { col_cyn, col_bg, col_cyn }, // occupied tags
|
| 66 |
[SchemeUrg] = { 0, 0, 0x770000ff },
|
| 67 |
[SchemeUnder] = { col_mag, col_bg, col_mag }, // underline color
|
| 68 |
[SchemeBg] = { col_bg, col_bg, col_bg }, // underline color
|
| 69 |
};
|
| 70 |
|
| 71 |
static char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
| 72 |
|
| 73 |
/* logging */
|
| 74 |
static int log_level = WLR_ERROR;
|
| 75 |
|
| 76 |
/* NOTE: ALWAYS keep a rule declared even if you don't use rules (e.g leave at least one example) */
|
| 77 |
static const Rule rules[] = {
|
| 78 |
/* app_id title tags mask isfloating monitor */
|
| 79 |
/* examples: */
|
| 80 |
{ "Gimp_EXAMPLE", NULL, 0, 1, -1 }, /* Start on currently visible tags floating, not tiled */
|
| 81 |
{ "firefox_EXAMPLE", NULL, 1 << 8, 0, -1 }, /* Start on ONLY tag "9" */
|
| 82 |
};
|
| 83 |
|
| 84 |
/* layout(s) */
|
| 85 |
static const Layout layouts[] = {
|
| 86 |
/* symbol arrange function */
|
| 87 |
{ "[]=", tile },
|
| 88 |
{ "><>", NULL }, /* no layout function means floating behavior */
|
| 89 |
{ "[M]", monocle },
|
| 90 |
};
|
| 91 |
|
| 92 |
/* monitors */
|
| 93 |
/* (x=-1, y=-1) is reserved as an "autoconfigure" monitor position indicator
|
| 94 |
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients
|
| 95 |
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899
|
| 96 |
*/
|
| 97 |
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
|
| 98 |
static const MonitorRule monrules[] = {
|
| 99 |
/* name mfact nmaster scale layout rotate/reflect x y */
|
| 100 |
/* example of a HiDPI laptop monitor:
|
| 101 |
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
| 102 |
*/
|
| 103 |
/* defaults */
|
| 104 |
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
| 105 |
};
|
| 106 |
|
| 107 |
/* keyboard */
|
| 108 |
static const struct xkb_rule_names xkb_rules = {
|
| 109 |
/* can specify fields: rules, model, layout, variant, options */
|
| 110 |
/* example:
|
| 111 |
.options = "ctrl:nocaps",
|
| 112 |
*/
|
| 113 |
.options = NULL,
|
| 114 |
};
|
| 115 |
|
| 116 |
static const int repeat_rate = 35;
|
| 117 |
static const int repeat_delay = 200;
|
| 118 |
|
| 119 |
/* Trackpad */
|
| 120 |
static const int tap_to_click = 1;
|
| 121 |
static const int tap_and_drag = 1;
|
| 122 |
static const int drag_lock = 1;
|
| 123 |
static const int natural_scrolling = 0;
|
| 124 |
static const int disable_while_typing = 1;
|
| 125 |
static const int left_handed = 0;
|
| 126 |
static const int middle_button_emulation = 0;
|
| 127 |
/* You can choose between:
|
| 128 |
LIBINPUT_CONFIG_SCROLL_NO_SCROLL
|
| 129 |
LIBINPUT_CONFIG_SCROLL_2FG
|
| 130 |
LIBINPUT_CONFIG_SCROLL_EDGE
|
| 131 |
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN
|
| 132 |
*/
|
| 133 |
static const enum libinput_config_scroll_method scroll_method = LIBINPUT_CONFIG_SCROLL_2FG;
|
| 134 |
|
| 135 |
/* You can choose between:
|
| 136 |
LIBINPUT_CONFIG_CLICK_METHOD_NONE
|
| 137 |
LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS
|
| 138 |
LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER
|
| 139 |
*/
|
| 140 |
static const enum libinput_config_click_method click_method = LIBINPUT_CONFIG_CLICK_METHOD_BUTTON_AREAS;
|
| 141 |
|
| 142 |
/* You can choose between:
|
| 143 |
LIBINPUT_CONFIG_SEND_EVENTS_ENABLED
|
| 144 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED
|
| 145 |
LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE
|
| 146 |
*/
|
| 147 |
static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
|
| 148 |
|
| 149 |
/* You can choose between:
|
| 150 |
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
|
| 151 |
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
| 152 |
*/
|
| 153 |
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
| 154 |
static const double accel_speed = 0.0;
|
| 155 |
|
| 156 |
/* You can choose between:
|
| 157 |
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
|
| 158 |
LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
| 159 |
*/
|
| 160 |
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
| 161 |
|
| 162 |
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
| 163 |
#define MODKEY WLR_MODIFIER_LOGO
|
| 164 |
|
| 165 |
#define TAGKEYS(KEY,SKEY,TAG) \
|
| 166 |
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
| 167 |
{ MODKEY|WLR_MODIFIER_CTRL, KEY, toggleview, {.ui = 1 << TAG} }, \
|
| 168 |
{ MODKEY|WLR_MODIFIER_SHIFT, SKEY, tag, {.ui = 1 << TAG} }, \
|
| 169 |
{ MODKEY|WLR_MODIFIER_CTRL|WLR_MODIFIER_SHIFT,SKEY,toggletag, {.ui = 1 << TAG} }
|
| 170 |
|
| 171 |
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
| 172 |
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
| 173 |
|
| 174 |
/* commands */
|
| 175 |
static const char *termcmd[] = { "foot", NULL };
|
| 176 |
static const char *menucmd[] = { "wmenu-run", NULL };
|
| 177 |
static const char *screenshotcmd[] = {"/run/current-system/sw/bin/snip", NULL };
|
| 178 |
static const char *snip[] = {"$HOME/scripts/snip.sh", NULL };
|
| 179 |
static const char *bemenucmd[] = {
|
| 180 |
"bemenu-run",
|
| 181 |
"--fn", "JetBrainsMono Nerd Font 22",
|
| 182 |
"-l", "10",
|
| 183 |
NULL
|
| 184 |
};
|
| 185 |
static const char *wmenucmd[] = {
|
| 186 |
"wmenu-run",
|
| 187 |
"-f", "JetBrainsMono Nerd Font 18",
|
| 188 |
"-l", "10",
|
| 189 |
NULL
|
| 190 |
};
|
| 191 |
|
| 192 |
static const Key keys[] = {
|
| 193 |
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
| 194 |
/* modifier key function argument */
|
| 195 |
// { MODKEY, XKB_KEY_d, spawn, {.v = bemenucmd} },
|
| 196 |
{ MODKEY, XKB_KEY_d, spawn, {.v = wmenucmd} },
|
| 197 |
{ MODKEY, XKB_KEY_Return, spawn, {.v = termcmd} },
|
| 198 |
{ WLR_MODIFIER_CTRL, XKB_KEY_F12, spawn, {.v = snip} },
|
| 199 |
{ MODKEY, XKB_KEY_s, spawn, SHCMD("/home/tony/scripts/snip.sh") },
|
| 200 |
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
| 201 |
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
| 202 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_S, spawn, SHCMD("geom=\"$(slurp -f '%x,%y %wx%h')\"; grim -l 0 -g \"$geom\" - | wl-copy") },
|
| 203 |
{ MODKEY, XKB_KEY_b, togglebar, {0} },
|
| 204 |
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
| 205 |
{ MODKEY, XKB_KEY_p, incnmaster, {.i = -1} },
|
| 206 |
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05f} },
|
| 207 |
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05f} },
|
| 208 |
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
| 209 |
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
| 210 |
{ MODKEY, XKB_KEY_a, togglegaps, {0} },
|
| 211 |
{ MODKEY, XKB_KEY_q, killclient, {0} },
|
| 212 |
{ MODKEY, XKB_KEY_t, setlayout, {.v = &layouts[0]} },
|
| 213 |
{ MODKEY, XKB_KEY_f, setlayout, {.v = &layouts[1]} },
|
| 214 |
{ MODKEY, XKB_KEY_m, setlayout, {.v = &layouts[2]} },
|
| 215 |
{ MODKEY, XKB_KEY_space, setlayout, {0} },
|
| 216 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_space, togglefloating, {0} },
|
| 217 |
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
| 218 |
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
| 219 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
| 220 |
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
| 221 |
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
| 222 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
| 223 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
| 224 |
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
| 225 |
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
| 226 |
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
| 227 |
TAGKEYS( XKB_KEY_4, XKB_KEY_dollar, 3),
|
| 228 |
TAGKEYS( XKB_KEY_5, XKB_KEY_percent, 4),
|
| 229 |
TAGKEYS( XKB_KEY_6, XKB_KEY_asciicircum, 5),
|
| 230 |
TAGKEYS( XKB_KEY_7, XKB_KEY_ampersand, 6),
|
| 231 |
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
| 232 |
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
| 233 |
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
|
| 234 |
|
| 235 |
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
|
| 236 |
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
| 237 |
/* Ctrl-Alt-Fx is used to switch to another VT, if you don't know what a VT is
|
| 238 |
* do not remove them.
|
| 239 |
*/
|
| 240 |
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
| 241 |
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
| 242 |
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
|
| 243 |
};
|
| 244 |
|
| 245 |
static const Button buttons[] = {
|
| 246 |
{ ClkLtSymbol, 0, BTN_LEFT, setlayout, {.v = &layouts[0]} },
|
| 247 |
{ ClkLtSymbol, 0, BTN_RIGHT, setlayout, {.v = &layouts[2]} },
|
| 248 |
{ ClkTitle, 0, BTN_MIDDLE, zoom, {0} },
|
| 249 |
{ ClkStatus, 0, BTN_MIDDLE, spawn, {.v = termcmd} },
|
| 250 |
{ ClkClient, MODKEY, BTN_LEFT, moveresize, {.ui = CurMove} },
|
| 251 |
{ ClkClient, MODKEY, BTN_MIDDLE, togglefloating, {0} },
|
| 252 |
{ ClkClient, MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
|
| 253 |
{ ClkTagBar, 0, BTN_LEFT, view, {0} },
|
| 254 |
{ ClkTagBar, 0, BTN_RIGHT, toggleview, {0} },
|
| 255 |
{ ClkTagBar, MODKEY, BTN_LEFT, tag, {0} },
|
| 256 |
{ ClkTagBar, MODKEY, BTN_RIGHT, toggletag, {0} },
|
| 257 |
};
|