dwm

personal fork of dwm (rnpnr branch)
git clone anongit@rnpnr.xyz:dwm.git
Log | Files | Refs | Feed | README | LICENSE

config.h (12965B)


      1 /* See LICENSE file for copyright and license details. */
      2 
      3 /* Allow use of special keys */
      4 #include <X11/XF86keysym.h>
      5 
      6 /* appearance */
      7 static const unsigned int borderpx  = 2;        /* border pixel of windows */
      8 static const unsigned int snap      = 32;       /* snap pixel */
      9 static const int padbar             = 8;        /* adjusts the bars padding */
     10 static const int showbar            = 1;        /* 0 means no bar */
     11 static const int topbar             = 1;        /* 0 means bottom bar */
     12 static const unsigned int gappih    = 10;       /* horiz inner gap between windows */
     13 static const unsigned int gappiv    = 10;       /* vert inner gap between windows */
     14 static const unsigned int gappoh    = 10;       /* horiz outer gap between windows and screen edge */
     15 static const unsigned int gappov    = 10;       /* vert outer gap between windows and screen edge */
     16 static       int smartgaps          = 1;        /* 1 means no outer gap when there is only one window */
     17 //static const char *fonts[]          = { "みかちゃん:style=Regular:size=16",
     18 static const char *fonts[]          = { "あんずもじ:style=Regular:size=20",
     19 					"Go Mono:style=bold:size=16",
     20 					"Source Han Sans JP:style=Medium:size=16",
     21 					"Source Han Sans CN:style=Medium:size=16",
     22 					"Source Han Sans KR:style=Medium:size=16" };
     23 static const char dmenufont[]       = "Go Mono:style=bold:size=16";
     24 static const char col_gray1[]       = "#090909";
     25 static const char col_gray2[]       = "#1b1b1b";
     26 static const char col_gray3[]       = "#666666";
     27 static const char col_gray4[]       = "#999999";
     28 static const char col_cyan[]        = "#444444";
     29 static const char col_red[]         = "#e6404e";
     30 static const char *colors[][3]      = {
     31 	/*               fg         bg         border   */
     32 	[SchemeNorm]   = { col_gray3, col_gray1, col_gray1 },
     33 	[SchemeSel]    = { col_gray4, col_gray1, col_cyan },
     34 	[SchemeWarn]   = { col_gray3, col_red,   col_gray1 },
     35 	[SchemeUrgent] = { col_red,   col_gray1, col_gray1 },
     36 };
     37 
     38 /* tagging */
     39 static const char *tags[] = { "壹", "貳", "參", "肆", "伍", "陸", "漆", "捌", "玖" };
     40 #define TAG_WEB (1 << 1)
     41 
     42 static const Rule rules[] = {
     43 	/* xprop(1):
     44 	 *	WM_CLASS(STRING) = instance, class
     45 	 *	WM_NAME(STRING) = title
     46 	 */
     47 	/* class        instance    title       tags mask     isfloating   monitor */
     48 	{ "Chromium",   NULL,       NULL,       TAG_WEB,      0,           -1 },
     49 	{ "firefox",    NULL,       NULL,       TAG_WEB,      0,           -1 },
     50 	{ "mgba-sdl",   NULL,       NULL,       0,            1,           -1 },
     51 	{ "matplotlib", NULL,       NULL,       0,            1,           -1 },
     52 	{ NULL,         "spterm",   NULL,       SPTAG(0),     1,           -1 },
     53 	{ NULL,         "spcal",    NULL,       SPTAG(1),     1,           -1 },
     54 	{ NULL,         "spkeys",   NULL,       SPTAG(2),     1,           -1 },
     55 	{ NULL, "sun-awt-X11-XFramePeer", NULL, 0,           1,           -1 },
     56 };
     57 
     58 /* layout(s) */
     59 static const float mfact     = 0.60; /* factor of master area size [0.05..0.95] */
     60 static const int nmaster     = 1;    /* number of clients in master area */
     61 static const int resizehints = 0;    /* 1 means respect size hints in tiled resizals */
     62 static int fakefullscreen    = 1;
     63 
     64 /* HACK: doing this properly would make it hard to merge upstream commits */
     65 #include "gaps.c"
     66 #include "layouts.c"
     67 
     68 static const Layout layouts[] = {
     69 	/* symbol     arrange function */
     70 	{ "[]=",      tile },    /* first entry is default */
     71 	{ "[M]",      monocle },
     72 	{ "M[]",      deck },
     73 	{ "---",      horizgrid },
     74 	{ "===",      bstackhoriz },
     75 	{ "TTT",      bstack },
     76 	{ "|M|",      centeredmaster },
     77 	{ "><>",      NULL },    /* no layout function means floating behavior */
     78 	{ NULL,       NULL },    /* terminator for {next,prev}layout() */
     79 };
     80 
     81 /* key definitions */
     82 #define MODKEY Mod1Mask
     83 #define ALTKEY Mod1Mask
     84 #define SUPKEY Mod4Mask
     85 #define TAGKEYS(KEY,TAG) \
     86 	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
     87 	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
     88 	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
     89 	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
     90 
     91 /* helper for spawning shell commands in the pre dwm-5.0 fashion */
     92 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
     93 
     94 #define BOOKMARKS "xdotool type $(grep -v -e '#' -e '^$' ~/doc/urls | dmenu -i -l 20 | cut -f 1 -d ' ')"
     95 #define EMOJI "xdotool type $(cat ~/.local/share/emoji | dmenu -i -l 20 | cut -d ' ' -f 1)"
     96 #define RSS "sfeed_dmenu blogs soft videos | plumb; pkill -RTMIN+3 status"
     97 
     98 /* commands */
     99 static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
    100 static const char *dmenucmd[]  = { "dmenu_run", "-i", "-m", dmenumon, "-fn", dmenufont, NULL };
    101 static const char *termcmd[]   = { "vtgl", NULL };
    102 static const char *sterm[]     = { "vtgl", "-z", "36", NULL };
    103 static const char *browser[]   = { "browser", NULL };
    104 static const char *dpcon[]     = { "displaycon", NULL };
    105 static const char *herbe1[]    = { "pkill", "-USR1", "herbe", NULL };
    106 static const char *herbe2[]    = { "pkill", "-USR2", "herbe", NULL };
    107 static const char *mpdnext[]   = { "mpdnext", NULL };
    108 static const char *mpdprev[]   = { "mpdprev", NULL };
    109 static const char *mpdtog[]    = { "mpdtoggle", NULL };
    110 static const char *music[]     = { "st", "-z", "32", "ncmpcpp", NULL };
    111 static const char *pass[]      = { "passmenu", NULL };
    112 static const char *scrotum[]   = { "screenshot", NULL };
    113 static const char *search[]    = { "surfraw_menu", NULL };
    114 static const char *sysact[]    = { "sysact", NULL };
    115 static const char *tpadtg[]    = { "trackpad", "toggle", NULL };
    116 static const char *voldn[]     = { "volume", "-2%", NULL };
    117 static const char *voltg[]     = { "volume", "toggle", NULL };
    118 static const char *volup[]     = { "volume", "+2%", NULL };
    119 
    120 /* scratchpads */
    121 const char *spcmd0[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
    122 const char *spcmd1[] = {"st", "-n", "spcal", "-z", "24", "calcurse", NULL };
    123 const char *spcmd2[] = {"st", "-n", "spkeys", "-g", "80x50", "/bin/sh", "-c", "man ~/.config/keybinds.1", NULL };
    124 struct {
    125 	const char *name;
    126 	const void *cmd;
    127 } scratchpads[] = {
    128 	/* name          cmd  */
    129 	{"spterm",      spcmd0},
    130 	{"spcal",       spcmd1},
    131 	{"spkeys",      spcmd2},
    132 };
    133 
    134 static const Key keys[] = {
    135 	/* modifier                     key                             function        argument */
    136 	{ 0,                            XF86XK_AudioRaiseVolume,        spawn,          {.v = volup } },
    137 	{ 0,                            XF86XK_AudioLowerVolume,        spawn,          {.v = voldn } },
    138 	{ 0,                            XF86XK_AudioMute,               spawn,          {.v = voltg } },
    139 	{ 0,				XF86XK_AudioPlay,		spawn,		{.v = mpdtog } },
    140 	{ 0,				XF86XK_AudioNext,		spawn,		{.v = mpdnext } },
    141 	{ 0,				XF86XK_AudioPrev,		spawn,		{.v = mpdprev } },
    142 	{ MODKEY|ShiftMask,             XK_w,                           spawn,          {.v = browser } },
    143 	{ MODKEY|ShiftMask,             XK_m,                           spawn,          {.v = music } },
    144 	{ MODKEY|ShiftMask,             XK_s,                           spawn,          {.v = search } },
    145 	{ MODKEY,                       XK_BackSpace,                   spawn,          {.v = sysact } },
    146 	{ MODKEY,                       XK_F2,                          spawn,          {.v = dpcon } },
    147 	{ MODKEY,                       XK_F12,                         spawn,          {.v = tpadtg } },
    148 	{ MODKEY|ShiftMask,             XK_Print,                       spawn,          {.v = scrotum } },
    149 	{ MODKEY,                       XK_Print,                       spawn,          {.v = scrotum } },
    150 	{ MODKEY|ShiftMask,             XK_p,                           spawn,          {.v = scrotum } },
    151 	{ MODKEY,                       XK_p,                           spawn,          {.v = pass } },
    152 	{ MODKEY,                       XK_b,                           spawn,          SHCMD(BOOKMARKS) },
    153 	{ MODKEY,                       XK_e,                           spawn,          SHCMD(EMOJI) },
    154 	{ MODKEY,                       XK_n,                           spawn,          SHCMD(RSS) },
    155 	{ MODKEY,                       XK_d,      			spawn,          {.v = dmenucmd } },
    156 	{ MODKEY,                       XK_Return, 			spawn,          {.v = termcmd } },
    157 	{ SUPKEY,                       XK_Return, 			spawn,          {.v = sterm } },
    158 	{ MODKEY|ShiftMask,             XK_Return,                      togglescratch,  {.ui = 0 } },
    159 	{ MODKEY,                       XK_backslash,                   togglescratch,  {.ui = 1 } },
    160 	{ MODKEY,                       XK_F1,                          togglescratch,  {.ui = 2 } },
    161 	{ ControlMask,                  XK_space,                       spawn,          {.v = herbe1 } },
    162 	{ ControlMask|ShiftMask,        XK_space,                       spawn,          {.v = herbe2 } },
    163 
    164 	{ MODKEY|ShiftMask,             XK_b,          togglebar,    {0} },
    165 	{ MODKEY,                       XK_j,          focusstack,   {.i = +1 } },
    166 	{ MODKEY,                       XK_k,          focusstack,   {.i = -1 } },
    167 	{ MODKEY,                       XK_i,          incnmaster,   {.i = +1 } },
    168 	{ MODKEY|ShiftMask,             XK_i,          incnmaster,   {.i = -1 } },
    169 	{ MODKEY,                       XK_h,          setmfact,     {.f = -0.01} },
    170 	{ MODKEY,                       XK_l,          setmfact,     {.f = +0.01} },
    171 	{ MODKEY,                       XK_w,          zoom,         {0} },
    172 	{ MODKEY,                       XK_Tab,        view,         {0} },
    173 	{ MODKEY|ShiftMask,             XK_c,          killclient,   {0} },
    174 
    175 	/* Layouts */
    176 	{ MODKEY,                       XK_t,      setlayout,      {.v = &layouts[0]} }, /* tiled */
    177 	{ MODKEY,                       XK_y,      setlayout,      {.v = &layouts[1]} }, /* monocole */
    178 	{ MODKEY,                       XK_space,  nextlayout,     {0} },
    179 	{ MODKEY|ControlMask,           XK_space,  prevlayout,     {0} },
    180 	{ MODKEY|ShiftMask,             XK_space,  togglefloating, {0} },
    181 	{ MODKEY,                       XK_f,      togglefullscr,  {0} },
    182 	{ MODKEY|ShiftMask,             XK_f,      togglefakefull, {0} },
    183 
    184 	/* gaps */
    185 	{ SUPKEY,                       XK_z,      incrgaps,       {.i = +2 } },
    186 	{ SUPKEY|ShiftMask,             XK_z,      incrgaps,       {.i = -2 } },
    187 	{ SUPKEY,                       XK_s,      incrigaps,      {.i = +2 } },
    188 	{ SUPKEY|ShiftMask,             XK_s,      incrigaps,      {.i = -2 } },
    189 	{ SUPKEY,                       XK_x,      incrogaps,      {.i = +2 } },
    190 	{ SUPKEY|ShiftMask,             XK_x,      incrogaps,      {.i = -2 } },
    191 	{ SUPKEY,                       XK_0,      togglegaps,     {0} },
    192 	{ SUPKEY|ShiftMask,             XK_0,      defaultgaps,    {0} },
    193 
    194 	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
    195 	{ MODKEY|ShiftMask,             XK_0,      tag,            {.ui = ~0 } },
    196 	{ MODKEY,                       XK_comma,  focusmon,       {.i = -1 } },
    197 	{ MODKEY,                       XK_period, focusmon,       {.i = +1 } },
    198 	{ MODKEY|ShiftMask,             XK_comma,  tagmon,         {.i = -1 } },
    199 	{ MODKEY|ShiftMask,             XK_period, tagmon,         {.i = +1 } },
    200 	TAGKEYS(                        XK_1,                      0)
    201 	TAGKEYS(                        XK_2,                      1)
    202 	TAGKEYS(                        XK_3,                      2)
    203 	TAGKEYS(                        XK_4,                      3)
    204 	TAGKEYS(                        XK_5,                      4)
    205 	TAGKEYS(                        XK_6,                      5)
    206 	TAGKEYS(                        XK_7,                      6)
    207 	TAGKEYS(                        XK_8,                      7)
    208 	TAGKEYS(                        XK_9,                      8)
    209 	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
    210 };
    211 
    212 /* button definitions */
    213 /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
    214 static const Button buttons[] = {
    215 	/* click                event mask      button          function        argument */
    216 	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
    217 	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
    218 	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
    219 	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
    220 	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
    221 	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
    222 	{ ClkTagBar,            0,              Button1,        view,           {0} },
    223 	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
    224 	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
    225 	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
    226 };
    227