diff options
author | Bryson Steck <steck.bryson@gmail.com> | 2021-10-08 12:41:04 -0600 |
---|---|---|
committer | Bryson Steck <steck.bryson@gmail.com> | 2021-10-08 12:41:04 -0600 |
commit | ab3f787725dc78cb9ae73c47d40e00be0a6b2159 (patch) | |
tree | ce2041cdb456f5425a7d53b6b1f945e720b8bf05 | |
parent | a786211d6cb794fba0ea406d86002c7618998afc (diff) | |
download | dwm-ab3f787725dc78cb9ae73c47d40e00be0a6b2159.tar dwm-ab3f787725dc78cb9ae73c47d40e00be0a6b2159.tar.gz dwm-ab3f787725dc78cb9ae73c47d40e00be0a6b2159.tar.bz2 |
initial commit
-rw-r--r-- | config.def.h | 1 | ||||
-rw-r--r-- | config.h | 124 | ||||
-rw-r--r-- | drw.o | bin | 0 -> 10584 bytes | |||
-rwxr-xr-x | dwm | bin | 0 -> 61992 bytes | |||
-rw-r--r-- | dwm.c | 36 | ||||
-rw-r--r-- | dwm.o | bin | 0 -> 57536 bytes | |||
-rw-r--r-- | uselessgap.diff | 81 | ||||
-rw-r--r-- | util.o | bin | 0 -> 2256 bytes | |||
-rw-r--r-- | xfce-plugins.diff | 125 |
9 files changed, 361 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h index a2ac963..08cfbd4 100644 --- a/config.def.h +++ b/config.def.h @@ -2,6 +2,7 @@ /* appearance */ static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int gappx = 6; /* gaps between windows */ static const unsigned int snap = 32; /* snap pixel */ static const int showbar = 1; /* 0 means no bar */ static const int topbar = 1; /* 0 means bottom bar */ diff --git a/config.h b/config.h new file mode 100644 index 0000000..f251033 --- /dev/null +++ b/config.h @@ -0,0 +1,124 @@ +/* See LICENSE file for copyright and license details. */ + +/* appearance */ +static const unsigned int borderpx = 1; /* border pixel of windows */ +static const unsigned int snap = 32; /* snap pixel */ +static const int showbar = 1; /* 0 means no bar */ +static const int topbar = 1; /* 0 means bottom bar */ +static const char *fonts[] = { "JetBrains Mono:size=12" }; +static const char dmenufont[] = "JetBrains Mono:size=12"; +static const char col_gray1[] = "#222222"; +static const char col_gray2[] = "#444444"; +static const char col_gray3[] = "#bbbbbb"; +static const char col_gray4[] = "#eeeeee"; +static const char col_cyan[] = "#005577"; +static const char col_nord0[] = "#2e3440"; +static const char col_nord1[] = "#3b4252"; +static const char col_nord2[] = "#434c5e"; +static const char col_nord3[] = "#4c566a"; +static const char col_nord4[] = "#d8dee9"; +static const char col_nord10[] = "#5e81ac"; +static const unsigned int gappx = 6; + +static const char *colors[][3] = { + /* fg bg border */ + [SchemeNorm] = { col_nord4, col_nord0, col_nord0 }, + [SchemeSel] = { col_nord4, col_nord10, col_nord1 }, +}; + +/* tagging */ +static const char *tags[] = { "1", "2", "3", "4" }; + +static const Rule rules[] = { + /* xprop(1): + * WM_CLASS(STRING) = instance, class + * WM_NAME(STRING) = title + */ + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 0, 1, -1 }, + { "Firefox", NULL, NULL, 1 << 8, 0, -1 }, +}; + +/* layout(s) */ +static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static const int nmaster = 1; /* number of clients in master area */ +static const int resizehints = 1; /* 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[] = { + /* symbol arrange function */ + { "[]=", tile }, /* first entry is default */ + { "><>", NULL }, /* no layout function means floating behavior */ + { "[M]", monocle }, +}; + +/* key definitions */ +#define MODKEY Mod1Mask +#define TAGKEYS(KEY,TAG) \ + { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + +/* helper for spawning shell commands in the pre dwm-5.0 fashion */ +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } + +/* commands */ +static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */ +static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL }; +static const char *termcmd[] = { "alacritty", NULL }; + +static Key keys[] = { + /* modifier key function argument */ + { MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_b, togglebar, {0} }, + { MODKEY, XK_j, focusstack, {.i = +1 } }, + { MODKEY, XK_k, focusstack, {.i = -1 } }, + { 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} }, + { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_space, setlayout, {0} }, + { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { MODKEY, XK_0, view, {.ui = ~0 } }, + { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { 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 } }, + TAGKEYS( XK_1, 0) + TAGKEYS( XK_2, 1) + TAGKEYS( XK_3, 2) + TAGKEYS( XK_4, 3) + TAGKEYS( XK_5, 4) + TAGKEYS( XK_6, 5) + TAGKEYS( XK_7, 6) + TAGKEYS( XK_8, 7) + TAGKEYS( XK_9, 8) + { MODKEY|ShiftMask, XK_q, quit, {0} }, +}; + +/* button definitions */ +/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */ +static 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} }, + { ClkTagBar, 0, Button1, view, {0} }, + { ClkTagBar, 0, Button3, toggleview, {0} }, + { ClkTagBar, MODKEY, Button1, tag, {0} }, + { ClkTagBar, MODKEY, Button3, toggletag, {0} }, +}; + Binary files differBinary files differ@@ -52,8 +52,8 @@ #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) #define MOUSEMASK (BUTTONMASK|PointerMotionMask) -#define WIDTH(X) ((X)->w + 2 * (X)->bw) -#define HEIGHT(X) ((X)->h + 2 * (X)->bw) +#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) +#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx) #define TAGMASK ((1 << LENGTH(tags)) - 1) #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) @@ -1277,12 +1277,36 @@ void resizeclient(Client *c, int x, int y, int w, int h) { XWindowChanges wc; + unsigned int n; + unsigned int gapoffset; + unsigned int gapincr; + Client *nbc; - c->oldx = c->x; c->x = wc.x = x; - c->oldy = c->y; c->y = wc.y = y; - c->oldw = c->w; c->w = wc.width = w; - c->oldh = c->h; c->h = wc.height = h; wc.border_width = c->bw; + + /* Get number of clients for the selected monitor */ + for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++); + + /* Do nothing if layout is floating */ + if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) { + gapincr = gapoffset = 0; + } else { + /* Remove border and gap if layout is monocle or only one client */ + if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) { + gapoffset = 0; + gapincr = -2 * borderpx; + wc.border_width = 0; + } else { + gapoffset = gappx; + gapincr = 2 * gappx; + } + } + + c->oldx = c->x; c->x = wc.x = x + gapoffset; + c->oldy = c->y; c->y = wc.y = y + gapoffset; + c->oldw = c->w; c->w = wc.width = w - gapincr; + c->oldh = c->h; c->h = wc.height = h - gapincr; + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); configure(c); XSync(dpy, False); Binary files differdiff --git a/uselessgap.diff b/uselessgap.diff new file mode 100644 index 0000000..d9cacbe --- /dev/null +++ b/uselessgap.diff @@ -0,0 +1,81 @@ +From 58a5ece9406ca6c90dc362617c065e4aac19417f Mon Sep 17 00:00:00 2001 +From: Cyril Cressent <cyril@cressent.org> +Date: Wed, 3 Jul 2019 21:33:45 -0700 +Subject: [PATCH] Port the uselessgap patch to 6.2 + +--- + config.def.h | 1 + + dwm.c | 36 ++++++++++++++++++++++++++++++------ + 2 files changed, 31 insertions(+), 6 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..b11471d 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -2,6 +2,7 @@ + + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ ++static const unsigned int gappx = 6; /* gaps between windows */ + static const unsigned int snap = 32; /* snap pixel */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ +diff --git a/dwm.c b/dwm.c +index 4465af1..4545e05 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -52,8 +52,8 @@ + #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) + #define LENGTH(X) (sizeof X / sizeof X[0]) + #define MOUSEMASK (BUTTONMASK|PointerMotionMask) +-#define WIDTH(X) ((X)->w + 2 * (X)->bw) +-#define HEIGHT(X) ((X)->h + 2 * (X)->bw) ++#define WIDTH(X) ((X)->w + 2 * (X)->bw + gappx) ++#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx) + #define TAGMASK ((1 << LENGTH(tags)) - 1) + #define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad) + +@@ -1276,12 +1276,36 @@ void + resizeclient(Client *c, int x, int y, int w, int h) + { + XWindowChanges wc; ++ unsigned int n; ++ unsigned int gapoffset; ++ unsigned int gapincr; ++ Client *nbc; + +- c->oldx = c->x; c->x = wc.x = x; +- c->oldy = c->y; c->y = wc.y = y; +- c->oldw = c->w; c->w = wc.width = w; +- c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ ++ /* Get number of clients for the selected monitor */ ++ for (n = 0, nbc = nexttiled(selmon->clients); nbc; nbc = nexttiled(nbc->next), n++); ++ ++ /* Do nothing if layout is floating */ ++ if (c->isfloating || selmon->lt[selmon->sellt]->arrange == NULL) { ++ gapincr = gapoffset = 0; ++ } else { ++ /* Remove border and gap if layout is monocle or only one client */ ++ if (selmon->lt[selmon->sellt]->arrange == monocle || n == 1) { ++ gapoffset = 0; ++ gapincr = -2 * borderpx; ++ wc.border_width = 0; ++ } else { ++ gapoffset = gappx; ++ gapincr = 2 * gappx; ++ } ++ } ++ ++ c->oldx = c->x; c->x = wc.x = x + gapoffset; ++ c->oldy = c->y; c->y = wc.y = y + gapoffset; ++ c->oldw = c->w; c->w = wc.width = w - gapincr; ++ c->oldh = c->h; c->h = wc.height = h - gapincr; ++ + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +-- +2.22.0 + Binary files differdiff --git a/xfce-plugins.diff b/xfce-plugins.diff new file mode 100644 index 0000000..c789daf --- /dev/null +++ b/xfce-plugins.diff @@ -0,0 +1,125 @@ +From 4e33fe0d465fb24f6b42d4a1fb63d4d7902f1986 Mon Sep 17 00:00:00 2001 +From: Gunther Klessinger <gunther.klessinger@axiros.com> +Date: Thu, 1 Jul 2021 09:19:07 +0200 +Subject: [PATCH] Supporting xfce4-panel in dwm + +We treat the panel as special window which +- never has borders +- never has focus +- always has y=0 +- is never shown as active window in the indicators +- is shown on all tags (via config rule) +- is ignored on focusstack (MOD+j, MOD+k) + +Which window? "xfce4-panel" - configurable in config.h +--- + config.def.h | 2 ++ + dwm.c | 28 +++++++++++++++++++++------- + 2 files changed, 23 insertions(+), 7 deletions(-) + +diff --git a/config.def.h b/config.def.h +index 1c0b587..3b9e7d6 100644 +--- a/config.def.h ++++ b/config.def.h +@@ -3,6 +3,7 @@ + /* appearance */ + static const unsigned int borderpx = 1; /* border pixel of windows */ + static const unsigned int snap = 32; /* snap pixel */ ++static const char panel[][20] = { "xfce4-panel", "Xfce4-panel" }; /* name & cls of panel win */ + static const int showbar = 1; /* 0 means no bar */ + static const int topbar = 1; /* 0 means bottom bar */ + static const char *fonts[] = { "monospace:size=10" }; + + + /* layout(s) */ +diff --git a/dwm.c b/dwm.c +index b0b3466..956d402 100644 +--- a/dwm.c ++++ b/dwm.c +@@ -175,6 +175,7 @@ static long getstate(Window w); + static int gettextprop(Window w, Atom atom, char *text, unsigned int size); + static void grabbuttons(Client *c, int focused); + static void grabkeys(void); ++static int ispanel(Client *c); + static void incnmaster(const Arg *arg); + static void keypress(XEvent *e); + static void killclient(const Arg *arg); +@@ -710,6 +711,8 @@ drawbar(Monitor *m) + } + + for (c = m->clients; c; c = c->next) { ++ // prevent showing the panel as active application: ++ if (ispanel(c)) continue; + occ |= c->tags; + if (c->isurgent) + urg |= c->tags; +@@ -793,11 +796,14 @@ focus(Client *c) + selmon = c->mon; + if (c->isurgent) + seturgent(c, 0); +- detachstack(c); +- attachstack(c); +- grabbuttons(c, 1); +- XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); +- setfocus(c); ++ // prevents the panel getting focus when tag switching: ++ if (!ispanel(c)) { ++ detachstack(c); ++ attachstack(c); ++ grabbuttons(c, 1); ++ XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel); ++ setfocus(c); ++ } + } else { + XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); + XDeleteProperty(dpy, root, netatom[NetActiveWindow]); +@@ -853,6 +859,7 @@ focusstack(const Arg *arg) + if (c) { + focus(c); + restack(selmon); ++ if (ispanel(c)) focusstack(arg); + } + } + +@@ -964,6 +971,11 @@ grabkeys(void) + } + } + ++int ++ispanel(Client *c) { ++ return !strcmp(c->name, panel[0]); ++} ++ + void + incnmaster(const Arg *arg) + { +@@ -1049,7 +1061,8 @@ manage(Window w, XWindowAttributes *wa) + c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx) + && (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my); + c->bw = borderpx; +- ++ // no border - even when active ++ if (ispanel(c)) c->bw = c->oldbw = 0; + wc.border_width = c->bw; + XConfigureWindow(dpy, w, CWBorderWidth, &wc); + XSetWindowBorder(dpy, w, scheme[SchemeNorm][ColBorder].pixel); +@@ -1283,6 +1296,7 @@ resizeclient(Client *c, int x, int y, int w, int h) + c->oldw = c->w; c->w = wc.width = w; + c->oldh = c->h; c->h = wc.height = h; + wc.border_width = c->bw; ++ if (ispanel(c)) c->y = c->oldy = c->bw = wc.y = wc.border_width = 0; + XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc); + configure(c); + XSync(dpy, False); +@@ -1991,7 +2005,7 @@ void + updatestatus(void) + { + if (!gettextprop(root, XA_WM_NAME, stext, sizeof(stext))) +- strcpy(stext, "dwm-"VERSION); ++ strcpy(stext, " "); // no shining of dwm version thru panel, when transparent + drawbar(selmon); + } + +-- +2.31.1 + |