My patched version of suckless' dwm.
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.

158 lines
8.6 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
  1. /* See LICENSE file for copyright and license details. */
  2. /* for media keys */
  3. #include <X11/XF86keysym.h>
  4. /* appearance */
  5. static const unsigned int borderpx = 1; /* border pixel of windows */
  6. static const unsigned int snap = 32; /* snap pixel */
  7. static const int showbar = 1; /* 0 means no bar */
  8. static const int topbar = 1; /* 0 means bottom bar */
  9. static const char *fonts[] = { "monospace:size=10", "Noto Color Emoji:size=11" };
  10. static const char dmenufont[] = "monospace:size=10";
  11. static const char col_gray1[] = "#222222";
  12. static const char col_gray2[] = "#444444";
  13. static const unsigned int baralpha = 0xd0;
  14. static const unsigned int borderalpha = OPAQUE;
  15. static const char col_gray3[] = "#f7f7f7";
  16. static const char col_gray4[] = "#000000";
  17. static const char col_cyan[] = "#a62238";
  18. static const char *colors[][3] = {
  19. /* fg bg border */
  20. [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
  21. [SchemeSel] = { col_gray4, col_cyan, col_gray3 },
  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 isCentered isfloating monitor */
  36. { "Gimp", NULL, NULL, 0, 0, 1, -1 },
  37. { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
  38. { NULL, "de.uol.swp.client.ClientApp", NULL, 0, 0, 1, -1 },
  39. };
  40. /* layout(s) */
  41. static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
  42. static const int nmaster = 1; /* number of clients in master area */
  43. static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
  44. static const Layout layouts[] = {
  45. /* symbol arrange function */
  46. { "[]=", tile }, /* first entry is default */
  47. { "><>", NULL }, /* no layout function means floating behavior */
  48. { "[M]", monocle },
  49. { "[D]", deck },
  50. };
  51. /* key definitions */
  52. #define MODKEY Mod4Mask
  53. #define TAGKEYS(KEY,TAG) \
  54. { MODKEY, KEY, view, {.ui = 1 << TAG} }, \
  55. { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
  56. { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
  57. { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
  58. /* helper for spawning shell commands in the pre dwm-5.0 fashion */
  59. #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
  60. /* commands */
  61. static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
  62. static const char *dmenucmd[] = { "dmenu_run", "-c", "-l", "20", NULL };
  63. static const char *termcmd[] = { "st", NULL };
  64. static const char *browsercmd[] = { "firefox", NULL };
  65. static const char *filecmd[] = {"st", "-e", "vifmrun", NULL };
  66. static const char *javaidecmd[] = {"intellij-idea-ultimate-edition", NULL };
  67. static const char *mailcmd[] = {"thunderbird", NULL };
  68. static const char *musiccmd[] = {"st", "-e", "ncmpcpp", NULL };
  69. static const char *lockcmd[] = {"prompt", "Lock computer?", "slock", NULL };
  70. static const char *rebootcmd[] = {"prompt", "Reboot computer?", "sudo -A shutdown -h now", NULL };
  71. static const char *shutdowncmd[] = {"prompt", "Shutdown computer?", "sudo -A shutdown -h now", NULL };
  72. static Key keys[] = {
  73. /* modifier key function argument */
  74. { MODKEY|ShiftMask, XK_Escape, quit, {0} },
  75. { MODKEY, XK_Return, spawn, {.v = termcmd } },
  76. { MODKEY, XK_b, spawn, {.v = browsercmd } },
  77. { MODKEY|ShiftMask, XK_b, togglebar, {0} },
  78. { MODKEY|ShiftMask, XK_c, setlayout, {.v = &layouts[3]} },
  79. { MODKEY|ShiftMask, XK_d, togglefloating, {0} },
  80. { MODKEY, XK_f, spawn, {.v = filecmd } },
  81. { MODKEY|ShiftMask, XK_f, setlayout, {.v = &layouts[2]} },
  82. { MODKEY, XK_h, focusstack, {.i = -1 } },
  83. { MODKEY|ShiftMask, XK_h, zoom, {0} },
  84. { MODKEY, XK_i, spawn, {.v = javaidecmd } },
  85. { MODKEY, XK_j, focusstack, {.i = +1 } },
  86. { MODKEY|ShiftMask, XK_j, zoom, {0} },
  87. { MODKEY, XK_k, focusstack, {.i = -1 } },
  88. { MODKEY|ShiftMask, XK_k, zoom, {0} },
  89. { MODKEY, XK_l, focusstack, {.i = +1 } },
  90. { MODKEY, XK_m, spawn, {.v = mailcmd } },
  91. { MODKEY|ShiftMask, XK_o, setmfact, {.f = +0.05} },
  92. { MODKEY, XK_p, spawn, {.v = musiccmd } },
  93. { MODKEY, XK_q, killclient, {0} },
  94. { MODKEY|ShiftMask, XK_r, spawn, {.v = dmenucmd } },
  95. { MODKEY, XK_s, spawn, SHCMD("startpagesearch") },
  96. { MODKEY|ShiftMask, XK_t, setlayout, {.v = &layouts[0]} },
  97. { MODKEY|ShiftMask, XK_z, setmfact, {.f = -0.05} },
  98. { MODKEY, XK_0, view, {.ui = ~0 } },
  99. { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
  100. { MODKEY, XK_comma, focusmon, {.i = -1 } },
  101. { MODKEY, XK_period, focusmon, {.i = +1 } },
  102. { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
  103. { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
  104. { MODKEY, XK_F5, spawn, SHCMD("togglemonitor") },
  105. { MODKEY, XK_F6, spawn, SHCMD("toggletouchpad") },
  106. { MODKEY, XK_F7, spawn, SHCMD("dmenumount") },
  107. { MODKEY, XK_F8, spawn, SHCMD("dmenuumount") },
  108. { MODKEY, XK_F9, spawn, SHCMD("sudo -A systemctl restart NetworkManager") },
  109. { MODKEY, XK_F10, spawn, {.v = lockcmd } },
  110. { MODKEY, XK_F11, spawn, {.v = rebootcmd } },
  111. { MODKEY, XK_F12, spawn, {.v = shutdowncmd } },
  112. { 0, XF86XK_AudioMute, spawn, SHCMD("lmc m; refbar") },
  113. { 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute 1 toggle") },
  114. { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("lmc down 5; refbar") },
  115. { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("lmc up 5; refbar") },
  116. { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("light -U 15") },
  117. { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("light -A 15") },
  118. //{ MODKEY|ShiftMask, XK_o, incnmaster, {.i = +1 } },
  119. //{ MODKEY|ShiftMask, XK_z, incnmaster, {.i = -1 } },
  120. //{ MODKEY, XK_space, setlayout, {0} },
  121. TAGKEYS( XK_1, 0)
  122. TAGKEYS( XK_2, 1)
  123. TAGKEYS( XK_3, 2)
  124. TAGKEYS( XK_4, 3)
  125. TAGKEYS( XK_5, 4)
  126. TAGKEYS( XK_6, 5)
  127. TAGKEYS( XK_7, 6)
  128. TAGKEYS( XK_8, 7)
  129. TAGKEYS( XK_9, 8)
  130. };
  131. /* button definitions */
  132. /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
  133. static Button buttons[] = {
  134. /* click event mask button function argument */
  135. { ClkLtSymbol, 0, Button1, setlayout, {0} },
  136. { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
  137. { ClkWinTitle, 0, Button2, zoom, {0} },
  138. { ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
  139. { ClkClientWin, MODKEY, Button1, movemouse, {0} },
  140. { ClkClientWin, MODKEY, Button2, togglefloating, {0} },
  141. { ClkClientWin, MODKEY, Button3, resizemouse, {0} },
  142. { ClkTagBar, 0, Button1, view, {0} },
  143. { ClkTagBar, 0, Button3, toggleview, {0} },
  144. { ClkTagBar, MODKEY, Button1, tag, {0} },
  145. { ClkTagBar, MODKEY, Button3, toggletag, {0} },
  146. };