config.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /* See LICENSE file for copyright and license details. */
  2. /* appearance */
  3. static const unsigned int borderpx = 2; /* border pixel of windows */
  4. static const unsigned int snap = 32; /* snap pixel */
  5. //static const unsigned int gappx = 10; /*gAPS i like*/
  6. static const unsigned int gappx = 3;
  7. static const int showbar = 1; /* 0 means no bar */
  8. static const int topbar = 1; /* 0 means bottom bar */
  9. static const int user_bh = 27; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
  10. static const unsigned int systraypinning = 0;
  11. static const unsigned int systrayspacing = 2;
  12. static const int systraypinningfailfirst = 1;
  13. static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
  14. static const int showsystray = 1;
  15. static const char *fonts[] = { "JetBrains Mono Nerd Font Mono:size=12" };
  16. static const char dmenufont[] = "JetBrains Mono Nerd Font Mono:size=11";
  17. static char normbgcolor[] = "#1E1E1E";
  18. static char normbordercolor[] = "#262626";
  19. static char selfgcolor[] = "#ffffff";
  20. static char normfgcolor[] = "#bababa";
  21. static char selbordercolor[] = "#1E1E1E";
  22. static char selbgcolor[] = "#1E1E1E";
  23. static char *colors[][3] = {
  24. /* fg bg border */
  25. [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
  26. [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
  27. };
  28. /* tagging */
  29. static const char *tags[] = {
  30. " 爵 ", "  ", "  ", "  ", "  ", "  ", " 喇 ", "  ", "  "
  31. };
  32. static const char *tagsalt[] = {
  33. " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 "
  34. };
  35. static const Rule rules[] = {
  36. /* xprop(1):
  37. * WM_CLASS(STRING) = instance, class
  38. * WM_NAME(STRING) = title
  39. */
  40. /* class instance title tags mask isfloating isterminal noswallow monitor */
  41. { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 },
  42. { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 },
  43. { "tabbed", NULL, NULL, 0, 0, 1, 0, -1 },
  44. { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
  45. };
  46. /* layout(s) */
  47. static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
  48. static const int nmaster = 1; /* number of clients in master area */
  49. static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
  50. static const Layout layouts[] = {
  51. /* symbol arrange function */
  52. { "[]=", tile }, /* first entry is default */
  53. { "><>", NULL }, /* no layout function means floating behavior */
  54. { "[M]", monocle },
  55. { "|M|", centeredmaster },
  56. { ">M>", centeredfloatingmaster },
  57. };
  58. /* key definitions */
  59. #define MODKEY Mod4Mask
  60. #define TAGKEYS(KEY,TAG) \
  61. { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
  62. { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
  63. { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
  64. { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
  65. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  66. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/bash", "-c", cmd, NULL } }
  67. /* commands */
  68. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  69. static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL };
  70. static const char *termcmd[] = { "st", NULL }; /* Terminal (vitali64-st is recommended) */
  71. static const char *showkeypresses[] = { "screenkey", NULL }; /* { OPTIONAL } screenkey */
  72. static const char *layoutmenu_cmd = "layoutmenu.sh";
  73. #define TERMINALRUN "st -e " /* Terminal to use for running terminal commands (vitali64-st is recommended) */
  74. #define TABBEDST "tabbed st -w"
  75. #define FILEMANAGER "pcmanfm" /* File manager */
  76. #define BROWSER "torbrowser-launcher" /* Web browser */
  77. #define WALLPAPERCHANGER "wal -n -i $(find /usr/share/backgrounds/ -type f -iregex '.*.\\(jpg\\|png\\)' | sort -R | head -1) --backend wal ; feh --bg-fill \"$(< \"${HOME}/.cache/wal/wal\" )\" " /* Change the wallpaper by using feh */
  78. #define EMAILCLIENT "neomutt" /* E-Mail client */
  79. #define SCRIPTS "~/scripts" /* { OPTIONAL } My scripts directory */
  80. #define MEDIA_PLAYER "mpv --profile=pseudo-gui" /* The media player */
  81. #define CHATCLIENT1 "irssi" /* {->IRC<-,XMPP,Matrix} client */
  82. #define CHATCLIENT2 "nheko" /* {IRC,XMPP,->Matrix<-} client */
  83. #include <X11/XF86keysym.h>
  84. static Key keys[] = {
  85. /* modifier key function argument */
  86. { MODKEY, XK_p, spawn, {.v = dmenucmd } },
  87. { MODKEY, XK_Return, spawn, SHCMD(TABBEDST) },
  88. { MODKEY, XK_b, togglebar, {0} },
  89. { MODKEY, XK_j, focusstack, {.i = +1 } },
  90. { MODKEY, XK_k, focusstack, {.i = -1 } },
  91. { MODKEY, XK_i, incnmaster, {.i = +1 } },
  92. { MODKEY, XK_d, incnmaster, {.i = -1 } },
  93. { MODKEY, XK_h, setmfact, {.f = -0.05} },
  94. { MODKEY, XK_l, setmfact, {.f = +0.05} },
  95. { MODKEY|ShiftMask, XK_Return, zoom, {0} },
  96. { MODKEY, XK_Tab, view, {0} },
  97. { MODKEY|ShiftMask, XK_c, killclient, {0} },
  98. { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
  99. { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
  100. { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
  101. { MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
  102. { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
  103. { MODKEY, XK_space, setlayout, {0} },
  104. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  105. { MODKEY, XK_a, view, {.ui = ~0 } },
  106. { MODKEY|ShiftMask, XK_a, tag, {.ui = ~0 } },
  107. { MODKEY, XK_comma, focusmon, {.i = -1 } },
  108. { MODKEY, XK_period, focusmon, {.i = +1 } },
  109. { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
  110. { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
  111. { MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
  112. { MODKEY, XK_n, togglealttag, {0} },
  113. { MODKEY, XK_F5, xrdb, {.v = NULL } },
  114. /*
  115. * Here goes our own bindings for running an app.
  116. * For some bindings, you need to remove "TERMINALRUN"
  117. * if the program is a GUI program
  118. * to prevent an unnecessary terminal to pop up, and to add
  119. * "TERMINALRUN" if the program is a CLI program.
  120. */
  121. { MODKEY|ControlMask, XK_Return, spawn, SHCMD(FILEMANAGER) },
  122. { MODKEY|ControlMask, XK_m, spawn, SHCMD(TERMINALRUN EMAILCLIENT) },
  123. { MODKEY|ControlMask, XK_space, spawn, SHCMD(BROWSER) },
  124. { MODKEY|ControlMask, XK_Tab, spawn, SHCMD(TERMINALRUN WALLPAPERCHANGER) },
  125. { MODKEY|ControlMask, XK_p, spawn, SHCMD(MEDIA_PLAYER) },
  126. { MODKEY|ControlMask, XK_u, spawn, SHCMD(TERMINALRUN CHATCLIENT1) },
  127. { MODKEY|ControlMask, XK_o, spawn, SHCMD(CHATCLIENT2) },
  128. /* Other things */
  129. { MODKEY|ShiftMask, XK_h, setcfact, {.f = +0.25} },
  130. { MODKEY|ShiftMask, XK_l, setcfact, {.f = -0.25} },
  131. { MODKEY|ShiftMask, XK_o, setcfact, {.f = 0.00} },
  132. /* moveresize
  133. * I most of the time don't use a mouse so I want a way to move windows
  134. * with the keyboard, and my macbook's mouse has only one button so
  135. * I have to press with my 2 fingers and move at the same time which,
  136. * most of the time, doesn't work (this is registered as a scrolling movement)
  137. * and is inconvinient.
  138. */
  139. { MODKEY, XK_Down, moveresize, {.v = "0x 25y 0w 0h" } },
  140. { MODKEY, XK_Up, moveresize, {.v = "0x -25y 0w 0h" } },
  141. { MODKEY, XK_Right, moveresize, {.v = "25x 0y 0w 0h" } },
  142. { MODKEY, XK_Left, moveresize, {.v = "-25x 0y 0w 0h" } },
  143. { MODKEY|ShiftMask, XK_Down, moveresize, {.v = "0x 0y 0w 25h" } },
  144. { MODKEY|ShiftMask, XK_Up, moveresize, {.v = "0x 0y 0w -25h" } },
  145. { MODKEY|ShiftMask, XK_Right, moveresize, {.v = "0x 0y 25w 0h" } },
  146. { MODKEY|ShiftMask, XK_Left, moveresize, {.v = "0x 0y -25w 0h" } },
  147. { MODKEY|ControlMask, XK_Up, moveresizeedge, {.v = "t"} },
  148. { MODKEY|ControlMask, XK_Down, moveresizeedge, {.v = "b"} },
  149. { MODKEY|ControlMask, XK_Left, moveresizeedge, {.v = "l"} },
  150. { MODKEY|ControlMask, XK_Right, moveresizeedge, {.v = "r"} },
  151. { MODKEY|ControlMask|ShiftMask, XK_Up, moveresizeedge, {.v = "T"} },
  152. { MODKEY|ControlMask|ShiftMask, XK_Down, moveresizeedge, {.v = "B"} },
  153. { MODKEY|ControlMask|ShiftMask, XK_Left, moveresizeedge, {.v = "L"} },
  154. { MODKEY|ControlMask|ShiftMask, XK_Right, moveresizeedge, {.v = "R"} },
  155. /* Here are buttons to, for example, lower the volume,
  156. * the brightness, etc...
  157. */
  158. {0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer set Master 5%+; pkill -RTMIN+10 dwmblocks") },
  159. {0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer set Master 5%-; pkill -RTMIN+10 dwmblocks") },
  160. {0, XF86XK_MonBrightnessUp, spawn, SHCMD("xbacklight -dec -10; pkill -RTMIN+15 dwmblocks") },
  161. {0, XF86XK_MonBrightnessDown, spawn, SHCMD("xbacklight -dec 10; pkill -RTMIN+15 dwmblocks") },
  162. {0, XF86XK_AudioMute, spawn, SHCMD("amixer set Master toggle") },
  163. {0, XF86XK_Eject, spawn, SHCMD("slock") },
  164. TAGKEYS( XK_1, 0)
  165. TAGKEYS( XK_2, 1)
  166. TAGKEYS( XK_3, 2)
  167. TAGKEYS( XK_4, 3)
  168. TAGKEYS( XK_5, 4)
  169. TAGKEYS( XK_6, 5)
  170. TAGKEYS( XK_7, 6)
  171. TAGKEYS( XK_8, 7)
  172. TAGKEYS( XK_9, 8)
  173. { MODKEY|ShiftMask, XK_q, quit, {0} },
  174. };
  175. /* button definitions */
  176. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  177. static Button buttons[] = {
  178. /* click event mask button function argument */
  179. { ClkLtSymbol, 0, Button1, setlayout, {0} },
  180. /*{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },*/
  181. { ClkLtSymbol, 0, Button3, layoutmenu, {0} },
  182. { ClkWinTitle, 0, Button2, zoom, {0} },
  183. { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
  184. { ClkClientWin, MODKEY, Button1, movemouse, {0} },
  185. { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
  186. { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
  187. { ClkTagBar, 0, Button1, view, {0} },
  188. { ClkTagBar, 0, Button3, toggleview, {0} },
  189. { ClkTagBar, MODKEY, Button1, tag, {0} },
  190. { ClkTagBar, MODKEY, Button3, toggletag, {0} },
  191. };