My dwm build
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

210 lines
14 KiB

  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 gappx = 10;
  5. static const unsigned int snap = 32; /* snap pixel */
  6. static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
  7. static const int showbar = 1; /* 0 means no bar */
  8. static const int topbar = 1; /* 0 means bottom bar */
  9. static const int vertpad = 10; /* vertical padding of bar */
  10. static const int sidepad = 10; /* horizontal padding of bar */
  11. static const int user_bh = 0; /* 0 means that dwm will calculate bar height, >= 1 means dwm will user_bh as bar height */
  12. static const int horizpadbar = 10; /* horizontal padding for statusbar */
  13. static const int vertpadbar = 10; /* vertical padding for statusbar */
  14. /* Display modes of the tab bar: never shown, always shown, shown only in */
  15. /* monocle mode in presence of several windows. */
  16. /* Modes after showtab_nmodes are disabled */
  17. enum showtab_modes { showtab_never, showtab_auto, showtab_nmodes, showtab_always};
  18. static const int showtab = showtab_auto; /* Default tab bar show mode */
  19. static const Bool toptab = False; /* False means bottom tab bar */
  20. static const char *fonts[] = { "fontawesome:size=15", "DejaVuSansMono Nerd Font Mono:size=13"};
  21. static const char col_gray1[] = "#222222";
  22. static const char col_gray2[] = "#666666";
  23. static const char col_gray3[] = "#bbbbbb";
  24. static const char col_gray4[] = "#eeeeee";
  25. static const char col_cyan[] = "#7733ee";
  26. static const char col_borderbar[] = "#222222";
  27. static const char *colors[][3] = {
  28. /* fg bg border */
  29. [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
  30. [SchemeSel] = { col_gray4, col_cyan, col_cyan },
  31. [SchemeDis] = { col_gray2, col_gray1, col_gray2 },
  32. };
  33. static const char *const autostart[] = {
  34. "sh", "-c", "sh ~/scripts/xinit.sh", NULL,
  35. NULL /* terminate */
  36. };
  37. /* tagging */
  38. static const char *tags[] = { "", "", "", "", "", "", "", "", "" };
  39. /* default layout per tags */
  40. /* The first element is for all-tag view, following i-th element corresponds to */
  41. /* tags[i]. Layout is referred using the layouts array index.*/
  42. static int def_layouts[1 + LENGTH(tags)] = { 0, 0, 0, 0, 0, 0, 2, 0, 2, 2};
  43. static const char *tagsel[][2] = {
  44. { "#d990cd", col_gray1 },
  45. { "#fbdf90", col_gray1 },
  46. { "#81d4ee", col_gray1 },
  47. { "#89e19c", col_gray1 },
  48. { "#d990cd", col_gray1 },
  49. { "#fbdf90", col_gray1 },
  50. { "#81d4ee", col_gray1 },
  51. { "#89e19c", col_gray1 },
  52. { "#d990cd", col_gray1 },
  53. };
  54. static const unsigned int ulinepad = 5; /* horizontal padding between the underline and tag */
  55. static const unsigned int ulinestroke = 2; /* thickness / height of the underline */
  56. static const unsigned int ulinevoffset = 0; /* how far above the bottom of the bar the line should appear */
  57. static const int ulineall = 0; /* 1 to show underline on all tags, 0 for just the active ones */
  58. static const Rule rules[] = {
  59. /* xprop(1):
  60. * WM_CLASS(STRING) = instance, class
  61. * WM_NAME(STRING) = title
  62. */
  63. /* class instance title tags mask iscentered isfloating isterminal noswallow monitor */
  64. { "Gimp", NULL, NULL, 1 << 7, 0, 1, 0, 0, -1 },
  65. { "LibreWolf", NULL, NULL, 1 << 2, 0, 0, 0, -1, -1 },
  66. { "firefox", NULL, NULL, 1 << 2, 0, 0, 0, -1, -1 },
  67. { "Brave-browser", NULL, NULL, 1 << 2, 0, 0, 0, -1, -1 },
  68. { "St", NULL, NULL, 0, 0, 0, 1, 0, -1 },
  69. { NULL, NULL, "Zoom Meeting", 1 << 1, 0, 1, 0, -1, -1 },
  70. { NULL, NULL, "Zoom Cloud Meetings", 1 << 1, 0, 1, 0, -1, -1 },
  71. { "cmus", NULL, NULL, 1 << 3, 0, 0, 0, -1, -1 },
  72. { "TelegramDesktop", NULL, NULL, 1 << 4, 0, 0, 0, -1, -1 },
  73. { "Discord", NULL, NULL, 1 << 4, 0, 0, 0, -1, -1 },
  74. { "cpsrc", NULL, NULL, 1 << 1, 0, 0, 0, -1, -1 },
  75. { "Emacs", NULL, NULL, 1 << 1, 0, 0, 0, -1, -1 },
  76. { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
  77. };
  78. /* layout(s) */
  79. static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
  80. static const int nmaster = 1; /* number of clients in master area */
  81. static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
  82. static const Layout layouts[] = {
  83. /* symbol arrange function */
  84. { "[]=", tile }, /* first entry is default */
  85. { "><>", NULL }, /* no layout function means floating behavior */
  86. { "[M]", monocle },
  87. { "|M|", centeredmaster },
  88. { ">M>", centeredfloatingmaster },
  89. };
  90. /* key definitions */
  91. #define MODKEY Mod4Mask
  92. #define TAGKEYS(KEY,TAG) \
  93. { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
  94. { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
  95. { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
  96. { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
  97. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  98. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
  99. /* commands */
  100. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  101. static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, NULL };
  102. static const char *termcmd[] = { "st", NULL };
  103. #include <X11/XF86keysym.h>
  104. static Key keys[] = {
  105. /* modifier key function argument */
  106. { 0, XK_Print, spawn, SHCMD("~/scripts/screenshot.sh") },
  107. { 0, XF86XK_PowerOff, spawn, SHCMD("~/scripts/poweroff.sh") },
  108. { 0, XF86XK_AudioMute, spawn, SHCMD("~/scripts/mute.sh 1") },
  109. { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer set Master 1%+") },
  110. { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer set Master 1%-") },
  111. { 0, XF86XK_AudioPrev, spawn, SHCMD("~/scripts/playmus.sh 3") },
  112. { 0, XF86XK_AudioNext, spawn, SHCMD("~/scripts/playmus.sh 2") },
  113. { 0, XF86XK_AudioPause, spawn, SHCMD("~/scripts/playmus.sh 1") },
  114. { 0, XF86XK_AudioPlay, spawn, SHCMD("~/scripts/playmus.sh 1") },
  115. { 0, XF86XK_AudioStop, spawn, SHCMD("~/scripts/playmus.sh 1") },
  116. { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("brightnessctl s +5%")},
  117. { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("brightnessctl s 5%-")},
  118. { ControlMask|ShiftMask, XK_space, spawn, SHCMD("dunstctl close") },
  119. { Mod1Mask|ShiftMask, NULL, spawn, SHCMD("~/scripts/switch-input.sh") },
  120. { MODKEY|ShiftMask, XK_space, togglealwaysontop, {0} },
  121. { MODKEY, XK_w, spawn, SHCMD("firefox") },
  122. { MODKEY, XK_c, spawn, SHCMD("~/scripts/showcal.sh") },
  123. { MODKEY|ShiftMask, XK_l, spawn, SHCMD("slock.sh") },
  124. { MODKEY|ShiftMask, XK_d, spawn, SHCMD("killall Discord") },
  125. { MODKEY|ShiftMask, XK_e, spawn, SHCMD("emacsclient --create-frame") },
  126. { MODKEY|ShiftMask, XK_m, spawn, SHCMD("~/scripts/autostart.sh") },
  127. { MODKEY|ShiftMask, XK_j, spawn, SHCMD("screenkey.sh") },
  128. { MODKEY|ShiftMask, XK_k, spawn, SHCMD("killall screenkey") },
  129. { MODKEY|ShiftMask, XK_s, spawn, SHCMD("~/scripts/screenshot.sh 1") },
  130. { MODKEY|ShiftMask, XK_n, spawn, SHCMD("~/scripts/network.sh") },
  131. { MODKEY|ShiftMask, XK_x, spawn, SHCMD("mixer.sh") },
  132. { MODKEY|ShiftMask, XK_t, spawn, SHCMD("telegram-desktop") },
  133. { MODKEY|ShiftMask, XK_a, spawn, SHCMD("~/scripts/start-jack.sh 1") },
  134. { MODKEY, XK_p, spawn, {.v = dmenucmd } },
  135. { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
  136. { MODKEY, XK_b, togglebar, {0} },
  137. { MODKEY, XK_w, tabmode, {-1} },
  138. { MODKEY, XK_j, focusstack, {.i = +1 } },
  139. { MODKEY, XK_k, focusstack, {.i = -1 } },
  140. { MODKEY, XK_i, incnmaster, {.i = +1 } },
  141. { MODKEY, XK_d, incnmaster, {.i = -1 } },
  142. { MODKEY, XK_h, setmfact, {.f = -0.05} },
  143. { MODKEY, XK_l, setmfact, {.f = +0.05} },
  144. { MODKEY, XK_Return, zoom, {0} },
  145. { MODKEY, XK_Tab, view, {0} },
  146. { MODKEY|ShiftMask, XK_c, killclient, {0} },
  147. { MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
  148. { MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
  149. { MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
  150. { MODKEY, XK_u, setlayout, {.v = &layouts[3]} },
  151. { MODKEY, XK_o, setlayout, {.v = &layouts[4]} },
  152. { MODKEY, XK_space, setlayout, {0} },
  153. { MODKEY|ShiftMask, XK_space, togglefloating, {0} },
  154. { MODKEY, XK_0, view, {.ui = ~0 } },
  155. { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
  156. { MODKEY, XK_comma, focusmon, {.i = -1 } },
  157. { MODKEY, XK_period, focusmon, {.i = +1 } },
  158. { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
  159. { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
  160. { MODKEY, XK_minus, setgaps, {.i = -5 } },
  161. { MODKEY, XK_equal, setgaps, {.i = +5 } },
  162. { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
  163. TAGKEYS( XK_1, 0)
  164. TAGKEYS( XK_2, 1)
  165. TAGKEYS( XK_3, 2)
  166. TAGKEYS( XK_4, 3)
  167. TAGKEYS( XK_5, 4)
  168. TAGKEYS( XK_6, 5)
  169. TAGKEYS( XK_7, 6)
  170. TAGKEYS( XK_8, 7)
  171. TAGKEYS( XK_9, 8)
  172. { MODKEY|ShiftMask, XK_q, quit, {0} },
  173. };
  174. /* button definitions */
  175. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  176. static Button buttons[] = {
  177. /* click event mask button function argument */
  178. { ClkLtSymbol, 0, Button1, setlayout, {0} },
  179. { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
  180. { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
  181. { ClkClientWin, MODKEY, Button1, movemouse, {0} },
  182. { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
  183. { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
  184. { ClkTagBar, 0, Button1, view, {0} },
  185. { ClkTagBar, 0, Button3, toggleview, {0} },
  186. { ClkTagBar, MODKEY, Button1, tag, {0} },
  187. { ClkTagBar, MODKEY, Button3, toggletag, {0} },
  188. { ClkTabBar, 0, Button1, focuswin, {0} },
  189. };