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.
 
 
 
 
 

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