From 231de1647f518e0feabc06a814448764bb490b53 Mon Sep 17 00:00:00 2001 From: frosty Date: Sun, 25 Aug 2024 02:58:44 -0400 Subject: [PATCH] remove some unneeded functions and features, add some keybinds, change some options --- config.def.h | 79 +++++++++++++++++++++++++++++++++------------------- dwm.c | 33 +--------------------- 2 files changed, 51 insertions(+), 61 deletions(-) diff --git a/config.def.h b/config.def.h index ae13dfa..a83a817 100644 --- a/config.def.h +++ b/config.def.h @@ -6,7 +6,6 @@ static unsigned int snap = 32; /* snap pixel */ static int showbar = 1; /* 0 means no bar */ static int topbar = 1; /* 0 means bottom bar */ static char font[] = "monospace:size=10"; -static char dmenufont[] = "monospace:size=10"; static const char *fonts[] = { font }; static char normbgcolor[] = "#222222"; static char normbordercolor[] = "#444444"; @@ -29,14 +28,13 @@ static const Rule rules[] = { * WM_NAME(STRING) = title */ /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, 1, -1 }, - { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, + { NULL, NULL, NULL, 0, 0, -1 }, }; /* layout(s) */ static float mfact = 0.55; /* factor of master area size [0.05..0.95] */ static int nmaster = 1; /* number of clients in master area */ -static int resizehints = 1; /* 1 means respect size hints in tiled resizals */ +static int resizehints = 0; /* 1 means respect size hints in tiled resizals */ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */ static const Layout layouts[] = { @@ -45,11 +43,10 @@ static const Layout layouts[] = { { "><>", NULL }, /* no layout function means floating behavior */ { "[M]", monocle }, { "TTT", bstack }, - { "===", bstackhoriz }, }; /* key definitions */ -#define MODKEY Mod1Mask +#define MODKEY Mod4Mask #define TAGKEYS(KEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ @@ -61,15 +58,13 @@ static const Layout layouts[] = { /* commands */ static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ -static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbordercolor, "-sf", selfgcolor, NULL }; -static const char *termcmd[] = { "st", NULL }; +static const char *dmenucmd[] = { "dmenu_run", "-g", "8", "-l", "4", "-m", dmenumon, "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; /* * Xresources preferences to load at startup */ ResourcePref resources[] = { { "font", STRING, &font }, - { "dmenufont", STRING, &dmenufont }, { "normbgcolor", STRING, &normbgcolor }, { "normbordercolor", STRING, &normbordercolor }, { "normfgcolor", STRING, &normfgcolor }, @@ -85,39 +80,46 @@ ResourcePref resources[] = { { "mfact", FLOAT, &mfact }, }; +#include + static const Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_b, togglebar, {0} }, + /* stack control */ { MODKEY, XK_j, focusstack, {.i = +1 } }, { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY|ControlMask, XK_j, pushdown, {0} }, - { MODKEY|ControlMask, XK_k, pushup, {0} }, + { MODKEY|ShiftMask, XK_j, pushdown, {0} }, + { MODKEY|ShiftMask, XK_k, pushup, {0} }, + { MODKEY|ShiftMask, XK_Return, zoom, {0} }, + + /* master control */ { MODKEY, XK_i, incnmaster, {.i = +1 } }, { MODKEY, XK_d, incnmaster, {.i = -1 } }, { MODKEY, XK_h, setmfact, {.f = -0.05} }, { MODKEY, XK_l, setmfact, {.f = +0.05} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, + + /* layouts */ { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, { MODKEY, XK_u, setlayout, {.v = &layouts[3]} }, - { MODKEY, XK_o, setlayout, {.v = &layouts[4]} }, - { MODKEY, XK_space, setlayout, {0} }, + + /* client actions */ + { MODKEY|ShiftMask, XK_c, killclient, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY|ShiftMask, XK_f, togglefullscr, {0} }, - { MODKEY, XK_s, togglesticky, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_y, shiftview, {.i = +1 } }, - { MODKEY|ShiftMask, XK_y, shiftview, {.i = -1 } }, + { MODKEY|ShiftMask, XK_s, togglesticky, {0} }, + + /* monitors */ { MODKEY, XK_comma, focusmon, {.i = -1 } }, { MODKEY, XK_period, focusmon, {.i = +1 } }, { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + + /* tags */ + { MODKEY, XK_y, shiftview, {.i = +1 } }, + { MODKEY|ShiftMask, XK_y, shiftview, {.i = -1 } }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -127,17 +129,36 @@ static const Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY, XK_Tab, view, {0} }, + + /* session */ + { MODKEY|ControlMask, XK_s, quit, {0} }, + { MODKEY|ShiftMask, XK_Delete, spawn, SHCMD("pkill xinit") }, + + /* programs/ui */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY, XK_Return, spawn, SHCMD("st") }, + { MODKEY, XK_w, spawn, SHCMD("firefox") }, + { MODKEY, XK_v, spawn, SHCMD("st -e pulsemixer") }, + { MODKEY|ControlMask, XK_l, spawn, SHCMD("xidlehook-client --socket $XIDLEHOOK_SOCK control --action trigger --timer 0") }, + { MODKEY|ControlMask, XK_t, spawn, SHCMD("screenshot -cs full") }, + { MODKEY|ControlMask, XK_r, spawn, SHCMD("screenshot -cs select") }, + { MODKEY, XK_b, togglebar, {0} }, + + /* etc. */ + { 0, XF86XK_MonBrightnessDown, spawn, SHCMD("lightctrl acpi_video0 5%- Display") }, + { 0, XF86XK_MonBrightnessUp, spawn, SHCMD("lightctrl acpi_video0 5%+ Display") }, + { 0, XF86XK_KbdBrightnessDown, spawn, SHCMD("lightctrl smc::kbd_backlight 5%- Keyboard") }, + { 0, XF86XK_KbdBrightnessUp, spawn, SHCMD("lightctrl smc::kbd_backlight 5%+ Keyboard") }, + { 0, XF86XK_AudioMute, spawn, SHCMD("volumectrl toggle") }, + { 0, XF86XK_AudioLowerVolume, spawn, SHCMD("volumectrl 5%-") }, + { 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("volumectrl 5%+") }, }; /* button definitions */ /* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ static const Button buttons[] = { /* click event mask button function argument */ - { ClkLtSymbol, 0, Button1, setlayout, {0} }, - { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, - { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff --git a/dwm.c b/dwm.c index daf9d71..d8bd495 100644 --- a/dwm.c +++ b/dwm.c @@ -261,7 +261,6 @@ static void zoom(const Arg *arg); static void load_xresources(void); static void resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst); static void bstack(Monitor *m); -static void bstackhoriz(Monitor *m); /* variables */ static const char broken[] = "broken"; @@ -1351,7 +1350,7 @@ movemouse(const Arg *arg) handler[ev.type](&ev); break; case MotionNotify: - if ((ev.xmotion.time - lasttime) <= (1000 / 60)) + if ((ev.xmotion.time - lasttime) <= (1000 / 120)) continue; lasttime = ev.xmotion.time; @@ -2578,33 +2577,3 @@ bstack(Monitor *m) { } } -static void -bstackhoriz(Monitor *m) { - int w, mh, mx, tx, ty, th; - unsigned int i, n; - Client *c; - - for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); - if (n == 0) - return; - if (n > m->nmaster) { - mh = m->nmaster ? m->mfact * m->wh : 0; - th = (m->wh - mh) / (n - m->nmaster); - ty = m->wy + mh; - } else { - th = mh = m->wh; - ty = m->wy; - } - for (i = mx = 0, tx = m->wx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++) { - if (i < m->nmaster) { - w = (m->ww - mx) / (MIN(n, m->nmaster) - i); - resize(c, m->wx + mx, m->wy, w - (2 * c->bw), mh - (2 * c->bw), 0); - mx += WIDTH(c); - } else { - resize(c, tx, ty, m->ww - (2 * c->bw), th - (2 * c->bw), 0); - if (th != m->wh) - ty += HEIGHT(c); - } - } -} -