chore: Merge branch 'hacks'
c44a815e
8 file(s) · +197 −66
| 1 | - | dwm - dynamic window manager |
|
| 2 | - | ============================ |
|
| 3 | - | dwm is an extremely fast, small, and dynamic window manager for X. |
|
| 4 | - | ||
| 5 | - | ||
| 6 | - | Requirements |
|
| 7 | - | ------------ |
|
| 8 | - | In order to build dwm you need the Xlib header files. |
|
| 9 | - | ||
| 10 | - | ||
| 11 | - | Installation |
|
| 12 | - | ------------ |
|
| 13 | - | Edit config.mk to match your local setup (dwm is installed into |
|
| 14 | - | the /usr/local namespace by default). |
|
| 15 | - | ||
| 16 | - | Afterwards enter the following command to build and install dwm (if |
|
| 17 | - | necessary as root): |
|
| 18 | - | ||
| 19 | - | make clean install |
|
| 20 | - | ||
| 21 | - | ||
| 22 | - | Running dwm |
|
| 23 | - | ----------- |
|
| 24 | - | Add the following line to your .xinitrc to start dwm using startx: |
|
| 25 | - | ||
| 26 | - | exec dwm |
|
| 27 | - | ||
| 28 | - | In order to connect dwm to a specific display, make sure that |
|
| 29 | - | the DISPLAY environment variable is set correctly, e.g.: |
|
| 30 | - | ||
| 31 | - | DISPLAY=foo.bar:1 exec dwm |
|
| 32 | - | ||
| 33 | - | (This will start dwm on display :1 of the host foo.bar.) |
|
| 34 | - | ||
| 35 | - | In order to display status info in the bar, you can do something |
|
| 36 | - | like this in your .xinitrc: |
|
| 37 | - | ||
| 38 | - | while xsetroot -name "`date` `uptime | sed 's/.*,//'`" |
|
| 39 | - | do |
|
| 40 | - | sleep 1 |
|
| 41 | - | done & |
|
| 42 | - | exec dwm |
|
| 43 | - | ||
| 44 | - | ||
| 45 | - | Configuration |
|
| 46 | - | ------------- |
|
| 47 | - | The configuration of dwm is done by creating a custom config.h |
|
| 48 | - | and (re)compiling the source code. |
| 1 | 1 | /* See LICENSE file for copyright and license details. */ |
|
| 2 | - | ||
| 3 | 2 | /* appearance */ |
|
| 4 | - | static const unsigned int borderpx = 1; /* border pixel of windows */ |
|
| 3 | + | static const unsigned int borderpx = 2; /* border pixel of windows */ |
|
| 5 | 4 | static const unsigned int snap = 32; /* snap pixel */ |
|
| 6 | 5 | static const int showbar = 1; /* 0 means no bar */ |
|
| 7 | 6 | static const int topbar = 1; /* 0 means bottom bar */ |
|
| 8 | - | static const char *fonts[] = { "monospace:size=10" }; |
|
| 9 | - | static const char dmenufont[] = "monospace:size=10"; |
|
| 10 | - | static const char col_gray1[] = "#222222"; |
|
| 11 | - | static const char col_gray2[] = "#444444"; |
|
| 12 | - | static const char col_gray3[] = "#bbbbbb"; |
|
| 13 | - | static const char col_gray4[] = "#eeeeee"; |
|
| 14 | - | static const char col_cyan[] = "#005577"; |
|
| 7 | + | static const char *fonts[] = { "BerkeleyMono Nerd Font:size=16", "monospace:size=16" }; |
|
| 8 | + | static const char dmenufont[] = "BerkeleyMono Nerd Font:size=16"; |
|
| 9 | + | static const char col_bg[] = "#121113"; /* background */ |
|
| 10 | + | static const char col_fg[] = "#ffffff"; /* foreground */ |
|
| 11 | + | static const char col_selection[] = "#222222"; /* selection bg */ |
|
| 12 | + | static const char col_gray[] = "#888888"; /* muted gray */ |
|
| 13 | + | static const char col_accent[] = "#fbcb97"; /* accent color */ |
|
| 15 | 14 | static const char *colors[][3] = { |
|
| 16 | 15 | /* fg bg border */ |
|
| 17 | - | [SchemeNorm] = { col_gray3, col_gray1, col_gray2 }, |
|
| 18 | - | [SchemeSel] = { col_gray4, col_cyan, col_cyan }, |
|
| 16 | + | [SchemeNorm] = { col_fg, col_bg, col_gray }, |
|
| 17 | + | [SchemeSel] = { col_accent, col_bg, col_accent }, |
|
| 19 | 18 | }; |
|
| 20 | 19 | ||
| 21 | 20 | /* tagging */ |
|
| 46 | 45 | }; |
|
| 47 | 46 | ||
| 48 | 47 | /* key definitions */ |
|
| 49 | - | #define MODKEY Mod1Mask |
|
| 48 | + | #define MODKEY Mod4Mask |
|
| 50 | 49 | #define TAGKEYS(KEY,TAG) \ |
|
| 51 | 50 | { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ |
|
| 52 | 51 | { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ |
|
| 57 | 56 | #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } |
|
| 58 | 57 | ||
| 59 | 58 | /* commands */ |
|
| 59 | + | static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL }; |
|
| 60 | 60 | static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ |
|
| 61 | - | static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; |
|
| 62 | - | static const char *termcmd[] = { "st", NULL }; |
|
| 61 | + | static const char *termcmd[] = { "wezterm", NULL }; |
|
| 62 | + | static const char *browsercmd[] = { "/home/stevedylandev/Applications/helium-0.6.4.1-x86_64_892a013378cdb3a291a71a624890c408.AppImage %U", NULL }; |
|
| 63 | 63 | ||
| 64 | 64 | static const Key keys[] = { |
|
| 65 | 65 | /* modifier key function argument */ |
|
| 66 | 66 | { MODKEY, XK_p, spawn, {.v = dmenucmd } }, |
|
| 67 | - | { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, |
|
| 68 | - | { MODKEY, XK_b, togglebar, {0} }, |
|
| 67 | + | { MODKEY, XK_Return, spawn, {.v = termcmd } }, |
|
| 68 | + | { MODKEY, XK_b, spawn, SHCMD("/home/stevedylandev/Applications/helium-0.6.4.1-x86_64_892a013378cdb3a291a71a624890c408.AppImage %U")}, |
|
| 69 | 69 | { MODKEY, XK_j, focusstack, {.i = +1 } }, |
|
| 70 | 70 | { MODKEY, XK_k, focusstack, {.i = -1 } }, |
|
| 71 | + | { MODKEY, XK_h, focusstack, {.i = -1 } }, |
|
| 72 | + | { MODKEY, XK_l, focusstack, {.i = +1 } }, |
|
| 71 | 73 | { MODKEY, XK_i, incnmaster, {.i = +1 } }, |
|
| 72 | 74 | { MODKEY, XK_d, incnmaster, {.i = -1 } }, |
|
| 73 | - | { MODKEY, XK_h, setmfact, {.f = -0.05} }, |
|
| 74 | - | { MODKEY, XK_l, setmfact, {.f = +0.05} }, |
|
| 75 | + | { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, |
|
| 76 | + | { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, |
|
| 77 | + | { MODKEY|ShiftMask, XK_h, movestack, {.i = -1 } }, |
|
| 78 | + | { MODKEY|ShiftMask, XK_l, movestack, {.i = +1 } }, |
|
| 79 | + | // { MODKEY, XK_h, setmfact, {.f = -0.05} }, |
|
| 80 | + | // { MODKEY, XK_l, setmfact, {.f = +0.05} }, |
|
| 75 | 81 | { MODKEY, XK_Return, zoom, {0} }, |
|
| 76 | 82 | { MODKEY, XK_Tab, view, {0} }, |
|
| 77 | 83 | { MODKEY|ShiftMask, XK_c, killclient, {0} }, |
|
| 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 int showbar = 1; /* 0 means no bar */ |
|
| 6 | + | static const int topbar = 1; /* 0 means bottom bar */ |
|
| 7 | + | static const char *fonts[] = { "BerkeleyMono Nerd Font:size=16", "monospace:size=16" }; |
|
| 8 | + | static const char dmenufont[] = "BerkeleyMono Nerd Font:size=16"; |
|
| 9 | + | static const char col_bg[] = "#121113"; /* background */ |
|
| 10 | + | static const char col_fg[] = "#ffffff"; /* foreground */ |
|
| 11 | + | static const char col_selection[] = "#222222"; /* selection bg */ |
|
| 12 | + | static const char col_gray[] = "#888888"; /* muted gray */ |
|
| 13 | + | static const char col_accent[] = "#fbcb97"; /* accent color */ |
|
| 14 | + | static const char *colors[][3] = { |
|
| 15 | + | /* fg bg border */ |
|
| 16 | + | [SchemeNorm] = { col_fg, col_bg, col_gray }, |
|
| 17 | + | [SchemeSel] = { col_accent, col_bg, col_accent }, |
|
| 18 | + | }; |
|
| 19 | + | ||
| 20 | + | /* tagging */ |
|
| 21 | + | static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; |
|
| 22 | + | ||
| 23 | + | static const Rule rules[] = { |
|
| 24 | + | /* xprop(1): |
|
| 25 | + | * WM_CLASS(STRING) = instance, class |
|
| 26 | + | * WM_NAME(STRING) = title |
|
| 27 | + | */ |
|
| 28 | + | /* class instance title tags mask isfloating monitor */ |
|
| 29 | + | { "Gimp", NULL, NULL, 0, 1, -1 }, |
|
| 30 | + | { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, |
|
| 31 | + | }; |
|
| 32 | + | ||
| 33 | + | /* layout(s) */ |
|
| 34 | + | static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ |
|
| 35 | + | static const int nmaster = 1; /* number of clients in master area */ |
|
| 36 | + | static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */ |
|
| 37 | + | static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ |
|
| 38 | + | static const int refreshrate = 120; /* refresh rate (per second) for client move/resize */ |
|
| 39 | + | ||
| 40 | + | static const Layout layouts[] = { |
|
| 41 | + | /* symbol arrange function */ |
|
| 42 | + | { "[]=", tile }, /* first entry is default */ |
|
| 43 | + | { "><>", NULL }, /* no layout function means floating behavior */ |
|
| 44 | + | { "[M]", monocle }, |
|
| 45 | + | }; |
|
| 46 | + | ||
| 47 | + | /* key definitions */ |
|
| 48 | + | #define MODKEY Mod4Mask |
|
| 49 | + | #define TAGKEYS(KEY,TAG) \ |
|
| 50 | + | { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ |
|
| 51 | + | { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ |
|
| 52 | + | { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ |
|
| 53 | + | { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, |
|
| 54 | + | ||
| 55 | + | /* helper for spawning shell commands in the pre dwm-5.0 fashion */ |
|
| 56 | + | #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } |
|
| 57 | + | ||
| 58 | + | /* commands */ |
|
| 59 | + | static const char *dmenucmd[] = { "rofi", "-show", "drun", NULL }; |
|
| 60 | + | static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ |
|
| 61 | + | static const char *termcmd[] = { "wezterm", NULL }; |
|
| 62 | + | static const char *browsercmd[] = { "/home/stevedylandev/Applications/helium-0.6.4.1-x86_64_892a013378cdb3a291a71a624890c408.AppImage %U", NULL }; |
|
| 63 | + | ||
| 64 | + | static const Key keys[] = { |
|
| 65 | + | /* modifier key function argument */ |
|
| 66 | + | { MODKEY, XK_p, spawn, {.v = dmenucmd } }, |
|
| 67 | + | { MODKEY, XK_Return, spawn, {.v = termcmd } }, |
|
| 68 | + | { MODKEY, XK_b, spawn, SHCMD("/home/stevedylandev/Applications/helium-0.6.4.1-x86_64_892a013378cdb3a291a71a624890c408.AppImage %U")}, |
|
| 69 | + | { MODKEY, XK_j, focusstack, {.i = +1 } }, |
|
| 70 | + | { MODKEY, XK_k, focusstack, {.i = -1 } }, |
|
| 71 | + | { MODKEY, XK_h, focusstack, {.i = -1 } }, |
|
| 72 | + | { MODKEY, XK_l, focusstack, {.i = +1 } }, |
|
| 73 | + | { MODKEY, XK_i, incnmaster, {.i = +1 } }, |
|
| 74 | + | { MODKEY, XK_d, incnmaster, {.i = -1 } }, |
|
| 75 | + | { MODKEY|ShiftMask, XK_j, movestack, {.i = +1 } }, |
|
| 76 | + | { MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } }, |
|
| 77 | + | { MODKEY|ShiftMask, XK_h, movestack, {.i = -1 } }, |
|
| 78 | + | { MODKEY|ShiftMask, XK_l, movestack, {.i = +1 } }, |
|
| 79 | + | // { MODKEY, XK_h, setmfact, {.f = -0.05} }, |
|
| 80 | + | // { MODKEY, XK_l, setmfact, {.f = +0.05} }, |
|
| 81 | + | { MODKEY, XK_Return, zoom, {0} }, |
|
| 82 | + | { MODKEY, XK_Tab, view, {0} }, |
|
| 83 | + | { MODKEY|ShiftMask, XK_c, killclient, {0} }, |
|
| 84 | + | { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, |
|
| 85 | + | { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, |
|
| 86 | + | { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, |
|
| 87 | + | { MODKEY, XK_space, setlayout, {0} }, |
|
| 88 | + | { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, |
|
| 89 | + | { MODKEY, XK_0, view, {.ui = ~0 } }, |
|
| 90 | + | { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, |
|
| 91 | + | { MODKEY, XK_comma, focusmon, {.i = -1 } }, |
|
| 92 | + | { MODKEY, XK_period, focusmon, {.i = +1 } }, |
|
| 93 | + | { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, |
|
| 94 | + | { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, |
|
| 95 | + | TAGKEYS( XK_1, 0) |
|
| 96 | + | TAGKEYS( XK_2, 1) |
|
| 97 | + | TAGKEYS( XK_3, 2) |
|
| 98 | + | TAGKEYS( XK_4, 3) |
|
| 99 | + | TAGKEYS( XK_5, 4) |
|
| 100 | + | TAGKEYS( XK_6, 5) |
|
| 101 | + | TAGKEYS( XK_7, 6) |
|
| 102 | + | TAGKEYS( XK_8, 7) |
|
| 103 | + | TAGKEYS( XK_9, 8) |
|
| 104 | + | { MODKEY|ShiftMask, XK_q, quit, {0} }, |
|
| 105 | + | }; |
|
| 106 | + | ||
| 107 | + | /* button definitions */ |
|
| 108 | + | /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ |
|
| 109 | + | static const Button buttons[] = { |
|
| 110 | + | /* click event mask button function argument */ |
|
| 111 | + | { ClkLtSymbol, 0, Button1, setlayout, {0} }, |
|
| 112 | + | { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, |
|
| 113 | + | { ClkWinTitle, 0, Button2, zoom, {0} }, |
|
| 114 | + | { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, |
|
| 115 | + | { ClkClientWin, MODKEY, Button1, movemouse, {0} }, |
|
| 116 | + | { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, |
|
| 117 | + | { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, |
|
| 118 | + | { ClkTagBar, 0, Button1, view, {0} }, |
|
| 119 | + | { ClkTagBar, 0, Button3, toggleview, {0} }, |
|
| 120 | + | { ClkTagBar, MODKEY, Button1, tag, {0} }, |
|
| 121 | + | { ClkTagBar, MODKEY, Button3, toggletag, {0} }, |
|
| 122 | + | }; |
|
| 123 | + |
Binary file — no preview.
Binary file — no preview.
| 183 | 183 | static void monocle(Monitor *m); |
|
| 184 | 184 | static void motionnotify(XEvent *e); |
|
| 185 | 185 | static void movemouse(const Arg *arg); |
|
| 186 | + | static void movestack(const Arg *arg); |
|
| 186 | 187 | static Client *nexttiled(Client *c); |
|
| 187 | 188 | static void pop(Client *c); |
|
| 188 | 189 | static void propertynotify(XEvent *e); |
|
| 2137 | 2138 | if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next))) |
|
| 2138 | 2139 | return; |
|
| 2139 | 2140 | pop(c); |
|
| 2141 | + | } |
|
| 2142 | + | ||
| 2143 | + | void |
|
| 2144 | + | movestack(const Arg *arg) { |
|
| 2145 | + | Client *c = NULL, *p = NULL, *pc = NULL, *i; |
|
| 2146 | + | ||
| 2147 | + | if(arg->i > 0) { |
|
| 2148 | + | /* find the client after selmon->sel */ |
|
| 2149 | + | for(c = selmon->sel->next; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); |
|
| 2150 | + | if(!c) |
|
| 2151 | + | for(c = selmon->clients; c && (!ISVISIBLE(c) || c->isfloating); c = c->next); |
|
| 2152 | + | ||
| 2153 | + | } |
|
| 2154 | + | else { |
|
| 2155 | + | /* find the client before selmon->sel */ |
|
| 2156 | + | for(i = selmon->clients; i != selmon->sel; i = i->next) |
|
| 2157 | + | if(ISVISIBLE(i) && !i->isfloating) |
|
| 2158 | + | c = i; |
|
| 2159 | + | if(!c) |
|
| 2160 | + | for(; i; i = i->next) |
|
| 2161 | + | if(ISVISIBLE(i) && !i->isfloating) |
|
| 2162 | + | c = i; |
|
| 2163 | + | } |
|
| 2164 | + | /* find the client before selmon->sel and c */ |
|
| 2165 | + | for(i = selmon->clients; i && (!p || !pc); i = i->next) { |
|
| 2166 | + | if(i->next == selmon->sel) |
|
| 2167 | + | p = i; |
|
| 2168 | + | if(i->next == c) |
|
| 2169 | + | pc = i; |
|
| 2170 | + | } |
|
| 2171 | + | ||
| 2172 | + | /* swap c and selmon->sel selmon->clients in the selmon->clients list */ |
|
| 2173 | + | if(c && c != selmon->sel) { |
|
| 2174 | + | Client *temp = selmon->sel->next==c?selmon->sel:selmon->sel->next; |
|
| 2175 | + | selmon->sel->next = c->next==selmon->sel?c:c->next; |
|
| 2176 | + | c->next = temp; |
|
| 2177 | + | ||
| 2178 | + | if(p && p != c) |
|
| 2179 | + | p->next = c; |
|
| 2180 | + | if(pc && pc != selmon->sel) |
|
| 2181 | + | pc->next = selmon->sel; |
|
| 2182 | + | ||
| 2183 | + | if(selmon->sel == selmon->clients) |
|
| 2184 | + | selmon->clients = c; |
|
| 2185 | + | else if(c == selmon->clients) |
|
| 2186 | + | selmon->clients = selmon->sel; |
|
| 2187 | + | ||
| 2188 | + | arrange(selmon); |
|
| 2189 | + | } |
|
| 2140 | 2190 | } |
|
| 2141 | 2191 | ||
| 2142 | 2192 | int |
|
Binary file — no preview.
Binary file — no preview.