config.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /* See LICENSE file for copyright and license details. */
  2. /* appearance */
  3. static const unsigned int borderpx = 1; /* border pixel of windows */
  4. static const unsigned int barborderpx = 0; /* border pixel of bar */
  5. static const unsigned int snap = 32; /* snap pixel */
  6. static const int swallowfloating = 1; /* 1 means swallow floating windows by default */
  7. static const unsigned int gappih = 10; /* horiz inner gap between windows */
  8. static const unsigned int gappiv = 10; /* vert inner gap between windows */
  9. static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
  10. static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
  11. static const int smartgaps_fact = 0; /* gap factor when there is only one client; 0 = no gaps, 3 = 3x outer gaps */
  12. static const char autostartblocksh[] = "autostart_blocking.sh";
  13. static const char autostartsh[] = "autostart.sh";
  14. static const char dwmdir[] = "dwm";
  15. static const char localshare[] = ".local/share";
  16. static const int showbar = 0; /* 0 means no bar */
  17. static const int topbar = 0; /* 0 means bottom bar */
  18. static const int bar_height = 45; /* 0 means derive from font, >= 1 explicit height */
  19. static const int statusmon = 'A'; /* Status is to be shown on: -1 (all monitors), 0 (a specific monitor by index), 'A' (active monitor) */
  20. static const int horizpadbar = 10; /* horizontal padding for statusbar */
  21. static const int vertpadbar = 15; /* vertical padding for statusbar */
  22. /* alt-tab configuration */
  23. static const unsigned int tabmodkey = 0x40; /* (Alt) when this key is held down the alt-tab functionality stays active. Must be the same modifier as used to run alttabstart */
  24. static const unsigned int tabcyclekey = 0x17; /* (Tab) when this key is hit the menu moves one position forward in client stack. Must be the same key as used to run alttabstart */
  25. static const unsigned int tabposy = 1; /* tab position on Y axis, 0 = top, 1 = center, 2 = bottom */
  26. static const unsigned int tabposx = 1; /* tab position on X axis, 0 = left, 1 = center, 2 = right */
  27. static const unsigned int maxwtab = 600; /* tab menu width */
  28. static const unsigned int maxhtab = 200; /* tab menu height */
  29. /* Indicators: see patch/bar_indicators.h for options */
  30. static int tagindicatortype = INDICATOR_CLIENT_DOTS;
  31. static int tiledindicatortype = INDICATOR_NONE;
  32. static int floatindicatortype = INDICATOR_TOP_LEFT_SQUARE;
  33. static const char *fonts[] = { "SF Pro Rounded:style=Regular:size=9:antialias=true", "Font Awesome 6 Pro:style=Solid:pixelsize=16:antialias=true", "Font Awesome 6 Brands:style=Solid:pixelsize=16:antialias=true", "Material Design Icons:Regular:pixelsize=19:antialias=true" };
  34. static const char dmenufont[] = "SF Pro Rounded:style=Regular:size=9:antialias=true";
  35. static char c000000[] = "#141414"; // placeholder value
  36. static char normfgcolor[] = "#a7a7a7";
  37. static char normbgcolor[] = "#141414";
  38. static char normbordercolor[] = "#202020";
  39. static char normfloatcolor[] = "#303030";
  40. static char selfgcolor[] = "#808fa0";
  41. static char selbgcolor[] = "#141414";
  42. static char selbordercolor[] = "#505050";
  43. static char selfloatcolor[] = "#505050";
  44. static char titlenormfgcolor[] = "#a7a7a7";
  45. static char titlenormbgcolor[] = "#141414";
  46. static char titlenormbordercolor[] = "#141414";
  47. static char titlenormfloatcolor[] = "#303030";
  48. static char titleselfgcolor[] = "#808fa0";
  49. static char titleselbgcolor[] = "#141414";
  50. static char titleselbordercolor[] = "#141414";
  51. static char titleselfloatcolor[] = "#a7a7a7";
  52. static char tagsnormfgcolor[] = "#a7a7a7";
  53. static char tagsnormbgcolor[] = "#141414";
  54. static char tagsnormbordercolor[] = "#141414";
  55. static char tagsnormfloatcolor[] = "#303030";
  56. static char tagsselfgcolor[] = "#808fa0";
  57. static char tagsselbgcolor[] = "#141414";
  58. static char tagsselbordercolor[] = "#141414";
  59. static char tagsselfloatcolor[] = "#a7a7a7";
  60. static char hidnormfgcolor[] = "#a7a7a7";
  61. static char hidselfgcolor[] = "#808fa0";
  62. static char hidnormbgcolor[] = "#222222";
  63. static char hidselbgcolor[] = "#222222";
  64. static char urgfgcolor[] = "#b16286";
  65. static char urgbgcolor[] = "#141414";
  66. static char urgbordercolor[] = "#b16286";
  67. static char urgfloatcolor[] = "#b16286";
  68. static const unsigned int baralpha = 255;
  69. static const unsigned int borderalpha = OPAQUE;
  70. static const unsigned int alphas[][3] = {
  71. /* fg bg border */
  72. [SchemeNorm] = { OPAQUE, baralpha, borderalpha },
  73. [SchemeSel] = { OPAQUE, baralpha, borderalpha },
  74. [SchemeTitleNorm] = { OPAQUE, baralpha, borderalpha },
  75. [SchemeTitleSel] = { OPAQUE, baralpha, borderalpha },
  76. [SchemeTagsNorm] = { OPAQUE, baralpha, borderalpha },
  77. [SchemeTagsSel] = { OPAQUE, baralpha, borderalpha },
  78. [SchemeHidNorm] = { OPAQUE, baralpha, borderalpha },
  79. [SchemeHidSel] = { OPAQUE, baralpha, borderalpha },
  80. [SchemeUrg] = { OPAQUE, baralpha, borderalpha },
  81. };
  82. static char *colors[][ColCount] = {
  83. /* fg bg border float */
  84. [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor, normfloatcolor },
  85. [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor, selfloatcolor },
  86. [SchemeTitleNorm] = { titlenormfgcolor, titlenormbgcolor, titlenormbordercolor, titlenormfloatcolor },
  87. [SchemeTitleSel] = { titleselfgcolor, titleselbgcolor, titleselbordercolor, titleselfloatcolor },
  88. [SchemeTagsNorm] = { tagsnormfgcolor, tagsnormbgcolor, tagsnormbordercolor, tagsnormfloatcolor },
  89. [SchemeTagsSel] = { tagsselfgcolor, tagsselbgcolor, tagsselbordercolor, tagsselfloatcolor },
  90. [SchemeHidNorm] = { hidnormfgcolor, hidnormbgcolor, c000000, c000000 },
  91. [SchemeHidSel] = { hidselfgcolor, hidselbgcolor, c000000, c000000 },
  92. [SchemeUrg] = { urgfgcolor, urgbgcolor, urgbordercolor, urgfloatcolor },
  93. };
  94. const char *spcmd1[] = {"st", "-n", "spterm", "-g", "120x34", NULL };
  95. static Sp scratchpads[] = {
  96. /* name cmd */
  97. {"spterm", spcmd1},
  98. };
  99. static char *tagicons[][NUMTAGS] =
  100. {
  101. [DEFAULT_TAGS] = { "", "", "", "", "", "", "", "", "" },
  102. [ALTERNATIVE_TAGS] = { "A", "B", "C", "D", "E", "F", "G", "H", "I" },
  103. [ALT_TAGS_DECORATION] = { "", "", "", "", "", "", "", "", "" },
  104. };
  105. /* xprop(1):
  106. * WM_CLASS(STRING) = instance, class
  107. * WM_NAME(STRING) = title
  108. * WM_WINDOW_ROLE(STRING) = role
  109. * _NET_WM_WINDOW_TYPE(ATOM) = wintype
  110. */
  111. static const Rule rules[] = {
  112. RULE(.wintype = WTYPE "DIALOG", .isfloating = 1)
  113. RULE(.wintype = WTYPE "UTILITY", .isfloating = 1)
  114. RULE(.wintype = WTYPE "TOOLBAR", .isfloating = 1)
  115. RULE(.wintype = WTYPE "SPLASH", .isfloating = 1)
  116. RULE(.class = "Gimp", .tags = 1 << 8, .switchtag = 1)
  117. RULE(.class = "firefox", .tags = 1, .switchtag = 1)
  118. RULE(.class = "qutebrowser", .tags = 1, .switchtag = 1)
  119. RULE(.class = "transmission-gtk", .tags = 1 << 2)
  120. RULE(.class = "Nicotine", .tags = 1 << 2, .switchtag = 1)
  121. RULE(.class = "ncmpcpp", .tags = 1 << 3, .switchtag = 1)
  122. RULE(.class = "Thunar", .tags = 1 << 4, .switchtag = 1)
  123. RULE(.class = "Sxiv", .tags = 1 << 4, .isfloating = 1, .iscentered = 1, .switchtag = 1)
  124. RULE(.class = "Nsxiv", .tags = 1 << 4, .isfloating = 1, .iscentered = 1, .switchtag = 1)
  125. RULE(.class = "mpv", .tags = 1 << 4, .isfloating = 1, .iscentered = 1, .switchtag = 1)
  126. RULE(.class = "file-roller", .tags = 1 << 4, .isfloating = 1, .iscentered = 1)
  127. RULE(.class = "Subl", .tags = 1 << 6, .switchtag = 1)
  128. RULE(.class = "nano", .tags = 1 << 6, .switchtag = 1)
  129. RULE(.class = "Toolkit", .title = "Picture-in-Picture", .wintype = "_NET_WM_WINDOW_TYPE_UTILITY", .tags = 0, .isfloating = 1, .iscentered = 1)
  130. RULE(.class = "steam", .tags = 1 << 7, .switchtag = 1,.isfloating = 0, .iscentered = 1)
  131. RULE(.class = "Easytag", .tags = 1 << 8, .switchtag = 1)
  132. RULE(.instance = "GtkFileChooserDialog", .title = "Save File", .tags = 0, .isfloating = 1, .iscentered = 1)
  133. RULE(.instance = "spterm", .tags = SPTAG(0), .isfloating = 1)
  134. RULE(.wintype = "About Mozilla Firefox", .tags = 0, .isfloating = 1, .iscentered = 1)
  135. RULE(.wintype = "_NET_WM_WINDOW_TYPE_DIALOG", .title = "File Operation Progress", .tags = 0, .isfloating = 1, .iscentered = 1)
  136. RULE(.wintype = "_NET_WM_WINDOW_TYPE_UTILITY", .title = "Picture-in-Picture", .tags = 0, .isfloating = 1, .iscentered = 1)
  137. };
  138. static const BarRule barrules[] = {
  139. /* monitor bar alignment widthfunc drawfunc clickfunc hoverfunc name */
  140. { -1, 0, BAR_ALIGN_LEFT, width_tags, draw_tags, click_tags, hover_tags, "tags" },
  141. { -1, 0, BAR_ALIGN_LEFT, width_ltsymbol, draw_ltsymbol, click_ltsymbol, NULL, "layout" },
  142. { statusmon, 0, BAR_ALIGN_RIGHT, width_status2d, draw_status2d, click_status2d, NULL, "status2d" },
  143. { -1, 0, BAR_ALIGN_NONE, width_awesomebar, draw_awesomebar, click_awesomebar, NULL, "awesomebar" },
  144. };
  145. /* layout(s) */
  146. static const float mfact = 0.50; /* factor of master area size [0.05..0.95] */
  147. static const int nmaster = 1; /* number of clients in master area */
  148. static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
  149. static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
  150. static const Layout layouts[] = {
  151. /* symbol arrange function */
  152. { "󰕴", dwindle }, /* first entry is default */
  153. { "󰕰", tile },
  154. { "󰕯", NULL }, /* no layout function means floating behavior */
  155. { "󰃚", monocle },
  156. };
  157. /* key definitions */
  158. #define MODKEY Mod4Mask
  159. #define TAGKEYS(KEY,TAG) \
  160. { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
  161. { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
  162. { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
  163. { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
  164. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  165. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
  166. /* commands */
  167. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  168. static const char *dmenucmd[] = {"dmenu_run_history", NULL};
  169. static const char *termcmd[] = { "st", NULL };
  170. #define APP_BROWSER "firefox"
  171. #define APP_QUTE "qutebrowser"
  172. #define APP_MUSIC "st -c ncmpcpp -e ncmpcpp"
  173. #define APP_MPDTOG "mpc toggle"
  174. #define APP_FILE "thunar"
  175. #define APP_EDIT "subl"
  176. #define APP_VOLU "/home/dobbie/.bin/volume up"
  177. #define APP_VOLD "/home/dobbie/.bin/volume down"
  178. #define APP_EXIT "/usr/bin/dmenu_logout"
  179. #define APP_MAIM "/home/dobbie/.bin/ss.sh"
  180. #define APP_MAIMS "/home/dobbie/.bin/sss.sh"
  181. #define APP_DUNSTHIST "dunstctl history-pop"
  182. #define APP_DUNSTCLOSE "dunstctl close"
  183. #define APP_LOCK "slock"
  184. #define APP_NANO "st -c nano -e nano"
  185. #define APP_CLIP "greenclip print | grep . | dmenu -l 10 -p clipboard | xargs -r -d'\n' -I '{}' greenclip print '{}'"
  186. #include <X11/XF86keysym.h>
  187. static const Key keys[] = {
  188. /* modifier key function argument */
  189. { MODKEY, XK_space, spawn, {.v = dmenucmd } },
  190. { MODKEY, XK_t, spawn, {.v = termcmd } },
  191. { MODKEY, XK_w, spawn, SHCMD(APP_BROWSER) },
  192. { MODKEY|ShiftMask, XK_w, spawn, SHCMD(APP_QUTE) },
  193. { MODKEY, XK_m, spawn, SHCMD(APP_MUSIC) },
  194. { MODKEY, XK_e, spawn, SHCMD(APP_EDIT) },
  195. { MODKEY|ShiftMask, XK_e, spawn, SHCMD(APP_NANO) },
  196. { 0, XK_Print, spawn, SHCMD(APP_MAIM) },
  197. { 0|ShiftMask, XK_Print, spawn, SHCMD(APP_MAIMS) },
  198. { MODKEY, XK_Escape, spawn, SHCMD(APP_MPDTOG) },
  199. { 0, XF86XK_AudioPlay, spawn, SHCMD(APP_MPDTOG) },
  200. { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD(APP_VOLU) },
  201. { 0, XF86XK_AudioLowerVolume, spawn, SHCMD(APP_VOLD) },
  202. { MODKEY|ShiftMask, XK_r, spawn, SHCMD(APP_EXIT) },
  203. { MODKEY, XK_f, spawn, SHCMD(APP_FILE) },
  204. { MODKEY, XK_l, spawn, SHCMD(APP_LOCK) },
  205. { ControlMask, XK_grave, spawn, SHCMD(APP_DUNSTHIST) },
  206. { ControlMask, XK_space, spawn, SHCMD(APP_DUNSTCLOSE) },
  207. { MODKEY|ShiftMask, XK_v, spawn, SHCMD(APP_CLIP) },
  208. { MODKEY, XK_b, togglebar, {0} },
  209. { MODKEY|ControlMask, XK_space, focusmaster, {0} },
  210. { MODKEY|ShiftMask, XK_j, rotatestack, {.i = +1 } },
  211. { MODKEY|ShiftMask, XK_k, rotatestack, {.i = -1 } },
  212. { MODKEY, XK_j, focusstack, {.i = +1 } },
  213. { MODKEY, XK_k, focusstack, {.i = -1 } },
  214. { MODKEY, XK_i, incnmaster, {.i = +1 } },
  215. { MODKEY, XK_d, incnmaster, {.i = -1 } },
  216. { MODKEY, XK_h, setmfact, {.f = -0.05} },
  217. { MODKEY|ControlMask, XK_l, setmfact, {.f = +0.05} },
  218. { MODKEY, XK_Return, zoom, {0} },
  219. { MODKEY|Mod4Mask, XK_u, incrgaps, {.i = +1 } },
  220. { MODKEY|Mod4Mask|ShiftMask, XK_u, incrgaps, {.i = -1 } },
  221. { MODKEY|Mod4Mask, XK_i, incrigaps, {.i = +1 } },
  222. { MODKEY|Mod4Mask|ShiftMask, XK_i, incrigaps, {.i = -1 } },
  223. { MODKEY|Mod4Mask, XK_o, incrogaps, {.i = +1 } },
  224. { MODKEY|Mod4Mask|ShiftMask, XK_o, incrogaps, {.i = -1 } },
  225. { MODKEY|Mod4Mask, XK_6, incrihgaps, {.i = +1 } },
  226. { MODKEY|Mod4Mask|ShiftMask, XK_6, incrihgaps, {.i = -1 } },
  227. { MODKEY|Mod4Mask, XK_7, incrivgaps, {.i = +1 } },
  228. { MODKEY|Mod4Mask|ShiftMask, XK_7, incrivgaps, {.i = -1 } },
  229. { MODKEY|Mod4Mask, XK_8, incrohgaps, {.i = +1 } },
  230. { MODKEY|Mod4Mask|ShiftMask, XK_8, incrohgaps, {.i = -1 } },
  231. { MODKEY|Mod4Mask, XK_9, incrovgaps, {.i = +1 } },
  232. { MODKEY|Mod4Mask|ShiftMask, XK_9, incrovgaps, {.i = -1 } },
  233. { MODKEY|Mod4Mask, XK_0, togglegaps, {0} },
  234. { MODKEY|Mod4Mask|ShiftMask, XK_0, defaultgaps, {0} },
  235. { Mod1Mask, XK_Tab, alttabstart, {0} },
  236. { MODKEY|ControlMask, XK_z, showhideclient, {0} },
  237. { MODKEY, XK_q, killclient, {0} },
  238. { MODKEY|ShiftMask, XK_q, quit, {0} },
  239. { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} },
  240. { MODKEY, XK_u, focusurgent, {0} },
  241. { MODKEY|ShiftMask, XK_F5, xrdb, {.v = NULL } },
  242. { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[0]} },
  243. { MODKEY|ControlMask, XK_f, setlayout, {.v = &layouts[1]} },
  244. { MODKEY|ControlMask, XK_m, setlayout, {.v = &layouts[2]} },
  245. { MODKEY|ControlMask|ShiftMask, XK_space, setlayout, {0} },
  246. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  247. { MODKEY, XK_s, togglescratch, {.ui = 0 } },
  248. { MODKEY|ControlMask, XK_s, setscratch, {.ui = 0 } },
  249. { MODKEY|ShiftMask, XK_s, removescratch, {.ui = 0 } },
  250. { MODKEY, XK_0, view, {.ui = ~SPTAGMASK } },
  251. { MODKEY|ShiftMask, XK_0, tag, {.ui = ~SPTAGMASK } },
  252. { MODKEY, XK_comma, focusmon, {.i = -1 } },
  253. { MODKEY, XK_period, focusmon, {.i = +1 } },
  254. { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
  255. { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
  256. { MODKEY, XK_n, togglealttag, {0} },
  257. { MODKEY|ControlMask, XK_minus, setborderpx, {.i = -1 } },
  258. { MODKEY|ControlMask, XK_plus, setborderpx, {.i = +1 } },
  259. { MODKEY|ControlMask, XK_numbersign, setborderpx, {.i = 0 } },
  260. TAGKEYS( XK_1, 0)
  261. TAGKEYS( XK_2, 1)
  262. TAGKEYS( XK_3, 2)
  263. TAGKEYS( XK_4, 3)
  264. TAGKEYS( XK_5, 4)
  265. TAGKEYS( XK_6, 5)
  266. TAGKEYS( XK_7, 6)
  267. TAGKEYS( XK_8, 7)
  268. TAGKEYS( XK_9, 8)
  269. TAGKEYS( XK_0, 9)
  270. };
  271. /* button definitions */
  272. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  273. static const Button buttons[] = {
  274. /* click event mask button function argument */
  275. { ClkLtSymbol, 0, Button1, setlayout, {0} },
  276. { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
  277. { ClkWinTitle, 0, Button1, togglewin, {0} },
  278. { ClkWinTitle, 0, Button3, showhideclient, {0} },
  279. { ClkWinTitle, 0, Button2, zoom, {0} },
  280. { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
  281. { ClkClientWin, MODKEY, Button1, movemouse, {0} },
  282. { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
  283. { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
  284. { ClkClientWin, MODKEY, Button4, rotatestack, {.i = +1 } },
  285. { ClkClientWin, MODKEY, Button5, rotatestack, {.i = -1 } },
  286. { ClkTagBar, 0, Button1, view, {0} },
  287. { ClkTagBar, 0, Button3, toggleview, {0} },
  288. { ClkTagBar, MODKEY, Button1, tag, {0} },
  289. { ClkTagBar, MODKEY, Button3, toggletag, {0} },
  290. };