config.def.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /* See LICENSE file for copyright and license details. */
  2. /* appearance */
  3. static unsigned int borderpx = 1; /* border pixel of windows */
  4. static unsigned int snap = 32; /* snap pixel */
  5. static int showbar = 1; /* 0 means no bar */
  6. static int topbar = 1; /* 0 means bottom bar */
  7. static char font[] = "monospace:size=10";
  8. static char dmenufont[] = "monospace:size=10";
  9. static const char *fonts[] = { font };
  10. static char normbgcolor[] = "#222222";
  11. static char normbordercolor[] = "#444444";
  12. static char normfgcolor[] = "#bbbbbb";
  13. static char selfgcolor[] = "#eeeeee";
  14. static const unsigned int baralpha = 0xd0;
  15. static const unsigned int borderalpha = OPAQUE;
  16. static char selbordercolor[] = "#005577";
  17. static char selbgcolor[] = "#005577";
  18. static char *colors[][3] = {
  19. /* fg bg border */
  20. [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
  21. [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
  22. };
  23. static const unsigned int alphas[][3] = {
  24. /* fg bg border */
  25. [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
  26. [SchemeSel] = { OPAQUE, baralpha, borderalpha },
  27. };
  28. /* tagging */
  29. static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
  30. static const Rule rules[] = {
  31. /* xprop(1):
  32. * WM_CLASS(STRING) = instance, class
  33. * WM_NAME(STRING) = title
  34. */
  35. /* class instance title tags mask isfloating monitor */
  36. { "Gimp", NULL, NULL, 0, 1, -1 },
  37. { "Firefox", NULL, NULL, 1 << 8, 0, -1 },
  38. };
  39. /* window swallowing */
  40. static const int swaldecay = 3;
  41. static const int swalretroactive = 1;
  42. static const char swalsymbol[] = "👅";
  43. /* layout(s) */
  44. static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
  45. static int nmaster = 1; /* number of clients in master area */
  46. static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
  47. static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
  48. static const Layout layouts[] = {
  49. /* symbol arrange function */
  50. { "[]=", tile }, /* first entry is default */
  51. { "><>", NULL }, /* no layout function means floating behavior */
  52. { "[M]", monocle },
  53. };
  54. /* key definitions */
  55. #define MODKEY Mod4Mask
  56. #define TAGKEYS(KEY,TAG) \
  57. { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
  58. { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
  59. { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
  60. { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
  61. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  62. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
  63. /* commands */
  64. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  65. static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
  66. static const char *termcmd[] = { "st", NULL };
  67. /*
  68. * Xresources preferences to load at startup
  69. */
  70. ResourcePref resources[] = {
  71. { "font", STRING, &font },
  72. { "dmenufont", STRING, &dmenufont },
  73. { "normbgcolor", STRING, &normbgcolor },
  74. { "normbordercolor", STRING, &normbordercolor },
  75. { "normfgcolor", STRING, &normfgcolor },
  76. { "selbgcolor", STRING, &selbgcolor },
  77. { "selbordercolor", STRING, &selbordercolor },
  78. { "selfgcolor", STRING, &selfgcolor },
  79. { "borderalpha", INTEGER, &borderalpha },
  80. // { "baralpha", INTEGER, &baralpha },
  81. // { "borderpx", INTEGER, &borderpx },
  82. // TODO: figure out how to add these
  83. { "snap", INTEGER, &snap },
  84. { "showbar", INTEGER, &showbar },
  85. { "topbar", INTEGER, &topbar },
  86. { "nmaster", INTEGER, &nmaster },
  87. { "resizehints", INTEGER, &resizehints },
  88. { "mfact", FLOAT, &mfact },
  89. };
  90. static Key keys[] = {
  91. /* modifier key function argument */
  92. { MODKEY, XK_p, spawn, {.v = dmenucmd } },
  93. { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
  94. { MODKEY, XK_b, togglebar, {0} },
  95. { MODKEY, XK_j, focusstack, {.i = +1 } },
  96. { MODKEY, XK_k, focusstack, {.i = -1 } },
  97. { MODKEY, XK_i, incnmaster, {.i = +1 } },
  98. { MODKEY, XK_d, incnmaster, {.i = -1 } },
  99. { MODKEY, XK_h, setmfact, {.f = -0.05} },
  100. { MODKEY, XK_l, setmfact, {.f = +0.05} },
  101. { MODKEY, XK_Return, zoom, {0} },
  102. { MODKEY, XK_Tab, view, {0} },
  103. { MODKEY|ShiftMask, XK_c, killclient, {0} },
  104. { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
  105. { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
  106. { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
  107. { MODKEY, XK_space, setlayout, {0} },
  108. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  109. { MODKEY, XK_0, view, {.ui = ~0 } },
  110. { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
  111. { MODKEY, XK_comma, focusmon, {.i = -1 } },
  112. { MODKEY, XK_period, focusmon, {.i = +1 } },
  113. { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
  114. { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
  115. { MODKEY, XK_u, swalstopsel, {0} },
  116. TAGKEYS( XK_1, 0)
  117. TAGKEYS( XK_2, 1)
  118. TAGKEYS( XK_3, 2)
  119. TAGKEYS( XK_4, 3)
  120. TAGKEYS( XK_5, 4)
  121. TAGKEYS( XK_6, 5)
  122. TAGKEYS( XK_7, 6)
  123. TAGKEYS( XK_8, 7)
  124. TAGKEYS( XK_9, 8)
  125. { MODKEY|ShiftMask, XK_q, quit, {0} },
  126. };
  127. /* button definitions */
  128. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  129. static Button buttons[] = {
  130. /* click event mask button function argument */
  131. { ClkLtSymbol, 0, Button1, setlayout, {0} },
  132. { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
  133. { ClkWinTitle, 0, Button2, zoom, {0} },
  134. { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
  135. { ClkClientWin, MODKEY, Button1, movemouse, {0} },
  136. { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
  137. { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
  138. { ClkClientWin, MODKEY|ShiftMask, Button1, swalmouse, {0} },
  139. { ClkTagBar, 0, Button1, view, {0} },
  140. { ClkTagBar, 0, Button3, toggleview, {0} },
  141. { ClkTagBar, MODKEY, Button1, tag, {0} },
  142. { ClkTagBar, MODKEY, Button3, toggletag, {0} },
  143. };