fix: upgrade dwm to v6.3 and config refresh

- Upgrade DWM to v6.3.
- Remove patches.
- Small updates made to the theme.
- Change the install prefix to /usr/local for now.
- Open firefox with MODKEY + SHIFT + B.
- Update README.
This commit is contained in:
Dan Anglin 2022-05-22 05:01:44 +01:00
parent 38f966c10a
commit 15d7ac3eaf
Signed by: dananglin
GPG Key ID: 0C1D44CFBEE68638
9 changed files with 50 additions and 191 deletions

View File

@ -2,8 +2,11 @@
This repository is a fork of the Dynamic Window Manager (DWM)
from suckless which contains additional patches and custom configurations.
DWM is an extremely fast, small, and dynamic window manager for X.
Version: 6.3
# Additional patches
- [**titlecolor**](https://dwm.suckless.org/patches/titlecolor/): Allows you to set a separate colour scheme for your title bar.
@ -61,10 +64,13 @@ and (re)compiling the source code.
The `MODKEY` is set to the Super key (Windows key).
| Keybinding | Action |
|---------------------------|--------|
| `MODKEY + SHIFT + RETURN` | open the st terminal |
| `MODKEY + b` | toggle the bar |
| `MODKEY + SHIFT + w` | open Firefox |
| `MODKEY + SHIFT + t` | open Tmux in the st terminal |
| `MODKEY + SHIFT + q` | quit DWM |
| Key bindings | Action |
|---------------------------|-----------------------------------------|
| `MODKEY + SHIFT + RETURN` | open the st terminal |
| `MODKEY + b` | toggle the bar |
| `MODKEY + SHIFT + b` | open firefox |
| `MODKEY + SHIFT + t` | open tmux in the st terminal |
| `MODKEY + SHIFT + c` | close a window |
| `MODKEY + SHIFT + q` | quit dwm |
| `MODKEY + SHIFT + <N>` | move the active window to workspace <N> |
| `MODKEY + <N>` | move to workspace <N> |

View File

@ -2,7 +2,6 @@
/* 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 */
@ -17,7 +16,6 @@ static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
[SchemeTitle] = { col_gray4, col_cyan, col_cyan },
};
/* tagging */
@ -37,6 +35,7 @@ static const Rule rules[] = {
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 */

View File

@ -8,23 +8,23 @@ static const char *fonts[] = {
"Noto Sans:size=10",
"monospace:size=10"
};
static const char dmenufont[] = "monospace:size=10";
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int gappx = 2; /* useless gap patch: gaps between windows */
//static const unsigned int gappx = 2; /* useless gap patch: 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 */
static const char col_gray1[] = "#1c1c1c"; /* Currently used as the background colour */
static const char col_gray1[] = "#15161e"; /* Currently used as the background colour */
static const char col_gray2[] = "#444444"; /* Inactive window border colour */
static const char col_gray3[] = "#bbbbbb"; /* Font colour */
static const char col_gray4[] = "#eeeeee"; /* Current tag and cuurent window font colour */
static const char col_cyan[] = "#005577"; /* Cyan */
static const char col_magenta[] = "#4a226e"; /* Magenta */
static const char col_cyan[] = "#7dcfff"; /* Cyan */
static const char col_magenta[] = "#bb9af7"; /* Magenta */
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_magenta, col_magenta },
[SchemeTitle] = { col_gray4, col_gray1, col_gray2 }, /* titlecolor patch*/
[SchemeSel] = { col_gray4, col_gray1, col_magenta },
};
/* tagging */
@ -44,6 +44,7 @@ static const Rule rules[] = {
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 */
@ -100,8 +101,8 @@ static Key keys[] = {
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ShiftMask, XK_w, spawn, {.v = firefoxcmd } },
{ MODKEY|ShiftMask, XK_t, spawn, {.v = tmuxcmd } },
{ MODKEY|ShiftMask, XK_b, spawn, {.v = firefoxcmd } },
};
/* button definitions */

View File

@ -1,10 +1,10 @@
# dwm version
VERSION = 6.2
VERSION = 6.3
# Customize below to fit your system
# paths
PREFIX = ${HOME}/.local
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
@ -25,7 +25,7 @@ INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=2 -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}

1
drw.c
View File

@ -95,6 +95,7 @@ drw_free(Drw *drw)
{
XFreePixmap(drw->dpy, drw->drawable);
XFreeGC(drw->dpy, drw->gc);
drw_fontset_free(drw->fonts);
free(drw);
}

2
dwm.1
View File

@ -33,7 +33,7 @@ dwm draws a small border around windows to indicate the focus state.
.SH OPTIONS
.TP
.B \-v
prints version information to standard output, then exits.
prints version information to stderr, then exits.
.SH USAGE
.SS Status bar
.TP

64
dwm.c
View File

@ -52,14 +52,14 @@
#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 + gappx)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw + gappx)
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
#define HEIGHT(X) ((X)->h + 2 * (X)->bw)
#define TAGMASK ((1 << LENGTH(tags)) - 1)
#define TEXTW(X) (drw_fontset_getwidth(drw, (X)) + lrpad)
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel, SchemeTitle }; /* color schemes */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@ -169,6 +169,7 @@ static void focus(Client *c);
static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
@ -439,7 +440,7 @@ buttonpress(XEvent *e)
arg.ui = 1 << i;
} else if (ev->x < x + blw)
click = ClkLtSymbol;
else if (ev->x > selmon->ww - TEXTW(stext))
else if (ev->x > selmon->ww - (int)TEXTW(stext))
click = ClkStatusText;
else
click = ClkWinTitle;
@ -695,17 +696,20 @@ dirtomon(int dir)
void
drawbar(Monitor *m)
{
int x, w, sw = 0;
int x, w, tw = 0;
int boxs = drw->fonts->h / 9;
int boxw = drw->fonts->h / 6 + 2;
unsigned int i, occ = 0, urg = 0;
Client *c;
if (!m->showbar)
return;
/* draw status first so it can be overdrawn by tags later */
if (m == selmon) { /* status is only drawn on selected monitor */
drw_setscheme(drw, scheme[SchemeNorm]);
sw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - sw, 0, sw, bh, 0, stext, 0);
tw = TEXTW(stext) - lrpad + 2; /* 2px right padding */
drw_text(drw, m->ww - tw, 0, tw, bh, 0, stext, 0);
}
for (c = m->clients; c; c = c->next) {
@ -728,9 +732,9 @@ drawbar(Monitor *m)
drw_setscheme(drw, scheme[SchemeNorm]);
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
if ((w = m->ww - sw - x) > bh) {
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]);
drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
@ -834,7 +838,7 @@ focusstack(const Arg *arg)
{
Client *c = NULL, *i;
if (!selmon->sel)
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
return;
if (arg->i > 0) {
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
@ -1276,36 +1280,12 @@ 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 client's monitor */
for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
/* Do nothing if layout is floating */
if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
gapincr = gapoffset = 0;
} else {
/* Remove border and gap if layout is monocle or only one client */
if (c->mon->lt[c->mon->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);
@ -1544,7 +1524,7 @@ setmfact(const Arg *arg)
if (!arg || !selmon->lt[selmon->sellt]->arrange)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.1 || f > 0.9)
if (f < 0.05 || f > 0.95)
return;
selmon->mfact = f;
arrange(selmon);
@ -1712,11 +1692,13 @@ tile(Monitor *m)
if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
my += HEIGHT(c);
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
} else {
h = (m->wh - ty) / (n - i);
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
ty += HEIGHT(c);
if (ty + HEIGHT(c) < m->wh)
ty += HEIGHT(c);
}
}

View File

@ -1,47 +0,0 @@
From b15016b717c88eb378d87703dcf2169b6059047c Mon Sep 17 00:00:00 2001
From: knary <theknary@gmail.com>
Date: Wed, 6 Feb 2019 21:44:19 -0500
Subject: [PATCH] Adds title bar color scheme, seperating it from SchemeSel.
---
config.def.h | 1 +
dwm.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 1c0b587..48e7ace 100644
--- a/config.def.h
+++ b/config.def.h
@@ -16,6 +16,7 @@ static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
+ [SchemeTitle] = { col_gray4, col_cyan, col_cyan },
};
/* tagging */
diff --git a/dwm.c b/dwm.c
index 4465af1..216e1f3 100644
--- a/dwm.c
+++ b/dwm.c
@@ -59,7 +59,7 @@
/* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
-enum { SchemeNorm, SchemeSel }; /* color schemes */
+enum { SchemeNorm, SchemeSel, SchemeTitle }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
@@ -730,7 +730,7 @@ drawbar(Monitor *m)
if ((w = m->ww - sw - x) > bh) {
if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
+ drw_setscheme(drw, scheme[m == selmon ? SchemeTitle : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
--
2.20.1

View File

@ -1,83 +0,0 @@
From bb3259fd727ae751abb33364e91d73ab1bcda4da Mon Sep 17 00:00:00 2001
From: Mateus Auler <mateusauler@protonmail.com>
Date: Sun, 19 Jul 2020 18:03:58 -0300
Subject: [PATCH] Fixed issue where when moving a client to a different
monitor, it would incorrectly check the client's previous monitor instead of
its current one to determine if the gaps and border should be drawn.
---
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 9fd0286..79703b3 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)
@@ -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 client's monitor */
+ for (n = 0, nbc = nexttiled(c->mon->clients); nbc; nbc = nexttiled(nbc->next), n++);
+
+ /* Do nothing if layout is floating */
+ if (c->isfloating || c->mon->lt[c->mon->sellt]->arrange == NULL) {
+ gapincr = gapoffset = 0;
+ } else {
+ /* Remove border and gap if layout is monocle or only one client */
+ if (c->mon->lt[c->mon->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.27.0