Compare commits
51 Commits
Author | SHA1 | Date |
---|---|---|
David JULIEN | 36a8e80ee2 | |
David JULIEN | 4a476e877c | |
David JULIEN | 16bc69ce1c | |
David JULIEN | 115058faa8 | |
Chris Down | 89f9905714 | |
David JULIEN | 4af8e13709 | |
David JULIEN | aa43e52021 | |
David JULIEN | 89d751ef3a | |
David JULIEN | ad4ddc40f3 | |
Hiltjo Posthuma | ba56fe9fea | |
David JULIEN | 1b6b09b50d | |
Hiltjo Posthuma | 50ad171eea | |
Hiltjo Posthuma | 970f376973 | |
Stein | c2b748e793 | |
NRK | 84d7322113 | |
Stein | 5799dd1fca | |
Stein | 44adafe006 | |
Stein | a859676ead | |
Hiltjo Posthuma | e0dee91145 | |
NRK | 5e76e7e21d | |
explosion-mental | 5b2e5e7a40 | |
Stein | 786f6e2a6f | |
Hiltjo Posthuma | e03248a4d5 | |
NRK | 6613d9f9a1 | |
NRK | 9bffa845fa | |
Hiltjo Posthuma | d3f93c7c1a | |
Hiltjo Posthuma | cd0773cee9 | |
Chris Down | 8b48e30973 | |
Hiltjo Posthuma | a83dc20310 | |
Hiltjo Posthuma | a4771de5ba | |
David JULIEN | 82003c8dad | |
David JULIEN | a1ab7f5da7 | |
David JULIEN | 3a5835b297 | |
David JULIEN | 65e044bd26 | |
David JULIEN | e382777f81 | |
David JULIEN | a7ad711b5a | |
David JULIEN | a2dd850d3a | |
David JULIEN | 116cf1f7c7 | |
David JULIEN | 1d38ae649f | |
David JULIEN | c4f556bce0 | |
Santtu Lakkala | d93ff48803 | |
Chris Down | 8806b6e237 | |
Miles Alan | bece862a0f | |
NRK | 60e9a14998 | |
Hiltjo Posthuma | d39e2f3441 | |
Chris Down | 8657affa2a | |
Hiltjo Posthuma | a786211d6c | |
Miles Alan | 716233534b | |
Quentin Rameau | 138b405f0c | |
Chris Down | 67d76bdc68 | |
Ian Remmler | 61bb8b2241 |
1
LICENSE
1
LICENSE
|
@ -17,6 +17,7 @@ MIT/X Consortium License
|
||||||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||||
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
|
||||||
|
© 2020-2022 Chris Down <chris@chrisdown.name>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
copy of this software and associated documentation files (the "Software"),
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ dwm: ${OBJ}
|
||||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz config.h
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dwm-${VERSION}
|
mkdir -p dwm-${VERSION}
|
||||||
|
|
129
config.def.h
129
config.def.h
|
@ -1,21 +1,29 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
#define SESSION_FILE "/tmp/dwm-session"
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static unsigned int gappx = 5; /* gaps between windows */
|
||||||
static const int showbar = 1; /* 0 means no bar */
|
static unsigned int snap = 32; /* snap pixel */
|
||||||
static const int topbar = 1; /* 0 means bottom bar */
|
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
static const char *fonts[] = { "monospace:size=10" };
|
static int showbar = 1; /* 0 means no bar */
|
||||||
static const char dmenufont[] = "monospace:size=10";
|
static int topbar = 1; /* 0 means bottom bar */
|
||||||
static const char col_gray1[] = "#222222";
|
static char font[] = "monospace:size=10";
|
||||||
static const char col_gray2[] = "#444444";
|
static char symbols[] = "monospace:size=10";
|
||||||
static const char col_gray3[] = "#bbbbbb";
|
static char japan[] = "monospace:size=10";
|
||||||
static const char col_gray4[] = "#eeeeee";
|
static char dmenufont[] = "monospace:size=10";
|
||||||
static const char col_cyan[] = "#005577";
|
static const char *fonts[] = { font, symbols, japan };
|
||||||
static const char *colors[][3] = {
|
static char normbgcolor[] = "#222222";
|
||||||
/* fg bg border */
|
static char normbordercolor[] = "#444444";
|
||||||
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
static char normfgcolor[] = "#bbbbbb";
|
||||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
static char selfgcolor[] = "#eeeeee";
|
||||||
|
static char selbordercolor[] = "#005577";
|
||||||
|
static char selbgcolor[] = "#005577";
|
||||||
|
static char *colors[][3] = {
|
||||||
|
/* fg bg border */
|
||||||
|
[SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
|
[SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* tagging */
|
/* tagging */
|
||||||
|
@ -26,15 +34,21 @@ static const Rule rules[] = {
|
||||||
* WM_CLASS(STRING) = instance, class
|
* WM_CLASS(STRING) = instance, class
|
||||||
* WM_NAME(STRING) = title
|
* WM_NAME(STRING) = title
|
||||||
*/
|
*/
|
||||||
/* class instance title tags mask isfloating monitor */
|
/* class instance title tags mask iscentered isfloating isterminal noswallow monitor */
|
||||||
{ "Gimp", NULL, NULL, 0, 1, -1 },
|
// { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 },
|
||||||
{ "Firefox", NULL, NULL, 1 << 8, 0, -1 },
|
// { "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1, -1 },
|
||||||
|
{ "St", NULL, NULL, 0, 0, 0, 1, -1, -1 },
|
||||||
|
{ "Pinentry-gtk-2",NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||||
|
{ "Gcr-prompter",NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||||
|
{ "floating",NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||||
|
{ NULL, NULL, "Event Tester", 0, 0, 1, 0, 1, -1 }, /* xev */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static 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 int nmaster = 1; /* number of clients in master area */
|
||||||
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
static 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[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
|
@ -44,7 +58,7 @@ static const Layout layouts[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
#define MODKEY Mod1Mask
|
#define MODKEY Mod4Mask
|
||||||
#define TAGKEYS(KEY,TAG) \
|
#define TAGKEYS(KEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||||
|
@ -56,53 +70,80 @@ static const Layout layouts[] = {
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
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 *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-p", "run:", NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
static Key keys[] = {
|
/*
|
||||||
|
* Xresources preferences to load at startup
|
||||||
|
*/
|
||||||
|
ResourcePref resources[] = {
|
||||||
|
{ "font", STRING, &font },
|
||||||
|
{ "symbols", STRING, &symbols },
|
||||||
|
{ "japan", STRING, &japan },
|
||||||
|
{ "dmenufont", STRING, &dmenufont },
|
||||||
|
{ "background", STRING, &normbgcolor },
|
||||||
|
{ "normforeground", STRING, &normbordercolor },
|
||||||
|
{ "normforeground", STRING, &normfgcolor },
|
||||||
|
{ "selbackground", STRING, &selbgcolor },
|
||||||
|
{ "selborder", STRING, &selbordercolor },
|
||||||
|
{ "selforeground", STRING, &selfgcolor },
|
||||||
|
{ "borderpx", INTEGER, &borderpx },
|
||||||
|
{ "gappx", INTEGER, &gappx },
|
||||||
|
{ "snap", INTEGER, &snap },
|
||||||
|
{ "showbar", INTEGER, &showbar },
|
||||||
|
{ "topbar", INTEGER, &topbar },
|
||||||
|
{ "nmaster", INTEGER, &nmaster },
|
||||||
|
{ "resizehints", INTEGER, &resizehints },
|
||||||
|
{ "mfact", FLOAT, &mfact },
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Key keys[] = {
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
// { MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
// { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
{ MODKEY, XK_b, togglebar, {0} },
|
{ MODKEY, XK_b, togglebar, {0} },
|
||||||
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
{ MODKEY, XK_j, focusstack, {.i = +1 } },
|
||||||
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
{ MODKEY, XK_k, focusstack, {.i = -1 } },
|
||||||
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
|
{ MODKEY, XK_o, incnmaster, {.i = +1 } },
|
||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_i, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_space, zoom, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY, XK_q, killclient, {0} },
|
||||||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||||
{ MODKEY, XK_space, setlayout, {0} },
|
// { MODKEY, XK_space, setlayout, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||||
{ MODKEY, XK_0, view, {.ui = ~0 } },
|
{ MODKEY, XK_agrave, view, {.ui = ~0 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
|
{ MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } },
|
||||||
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
|
||||||
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
TAGKEYS( XK_1, 0)
|
{ MODKEY, XK_less, setgaps, {.i = -1 } },
|
||||||
TAGKEYS( XK_2, 1)
|
{ MODKEY|ShiftMask, XK_less, setgaps, {.i = +1 } },
|
||||||
TAGKEYS( XK_3, 2)
|
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
TAGKEYS( XK_4, 3)
|
TAGKEYS( XK_ampersand, 0)
|
||||||
TAGKEYS( XK_5, 4)
|
TAGKEYS( XK_eacute, 1)
|
||||||
TAGKEYS( XK_6, 5)
|
TAGKEYS( XK_quotedbl, 2)
|
||||||
TAGKEYS( XK_7, 6)
|
TAGKEYS( XK_apostrophe, 3)
|
||||||
TAGKEYS( XK_8, 7)
|
TAGKEYS( XK_parenleft, 4)
|
||||||
TAGKEYS( XK_9, 8)
|
TAGKEYS( XK_minus, 5)
|
||||||
|
TAGKEYS( XK_egrave, 6)
|
||||||
|
TAGKEYS( XK_underscore, 7)
|
||||||
|
TAGKEYS( XK_ccedilla, 8)
|
||||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
{ MODKEY|Mod1Mask, XK_q, quit, {1} },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* button definitions */
|
/* button definitions */
|
||||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||||
static Button buttons[] = {
|
static const Button buttons[] = {
|
||||||
/* click event mask button function argument */
|
/* click event mask button function argument */
|
||||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||||
{ ClkWinTitle, 0, Button2, zoom, {0} },
|
|
||||||
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
|
||||||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 6.2
|
VERSION = 6.4
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
@ -19,10 +19,12 @@ FREETYPELIBS = -lfontconfig -lXft
|
||||||
FREETYPEINC = /usr/include/freetype2
|
FREETYPEINC = /usr/include/freetype2
|
||||||
# OpenBSD (uncomment)
|
# OpenBSD (uncomment)
|
||||||
#FREETYPEINC = ${X11INC}/freetype2
|
#FREETYPEINC = ${X11INC}/freetype2
|
||||||
|
#KVMLIB = -lkvm
|
||||||
|
#MANPREFIX = ${PREFIX}/man
|
||||||
|
|
||||||
# includes and libs
|
# includes and libs
|
||||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
|
104
drw.c
104
drw.c
|
@ -133,19 +133,6 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
||||||
die("no font specified.");
|
die("no font specified.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Do not allow using color fonts. This is a workaround for a BadLength
|
|
||||||
* error from Xft with color glyphs. Modelled on the Xterm workaround. See
|
|
||||||
* https://bugzilla.redhat.com/show_bug.cgi?id=1498269
|
|
||||||
* https://lists.suckless.org/dev/1701/30932.html
|
|
||||||
* https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916349
|
|
||||||
* and lots more all over the internet.
|
|
||||||
*/
|
|
||||||
FcBool iscol;
|
|
||||||
if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
|
|
||||||
XftFontClose(drw->dpy, xfont);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
font = ecalloc(1, sizeof(Fnt));
|
font = ecalloc(1, sizeof(Fnt));
|
||||||
font->xfont = xfont;
|
font->xfont = xfont;
|
||||||
font->pattern = pattern;
|
font->pattern = pattern;
|
||||||
|
@ -208,7 +195,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||||
* returned color scheme when done using it. */
|
* returned color scheme when done using it. */
|
||||||
Clr *
|
Clr *
|
||||||
drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
Clr *ret;
|
Clr *ret;
|
||||||
|
@ -251,12 +238,10 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
||||||
int
|
int
|
||||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
int i, ty, ellipsis_x = 0;
|
||||||
int ty;
|
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
|
||||||
unsigned int ew;
|
|
||||||
XftDraw *d = NULL;
|
XftDraw *d = NULL;
|
||||||
Fnt *usedfont, *curfont, *nextfont;
|
Fnt *usedfont, *curfont, *nextfont;
|
||||||
size_t i, len;
|
|
||||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||||
long utf8codepoint = 0;
|
long utf8codepoint = 0;
|
||||||
const char *utf8str;
|
const char *utf8str;
|
||||||
|
@ -264,13 +249,17 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
FcPattern *fcpattern;
|
FcPattern *fcpattern;
|
||||||
FcPattern *match;
|
FcPattern *match;
|
||||||
XftResult result;
|
XftResult result;
|
||||||
int charexists = 0;
|
int charexists = 0, overflow = 0;
|
||||||
|
/* keep track of a couple codepoints for which we have no match. */
|
||||||
|
enum { nomatches_len = 64 };
|
||||||
|
static struct { long codepoint[nomatches_len]; unsigned int idx; } nomatches;
|
||||||
|
static unsigned int ellipsis_width = 0;
|
||||||
|
|
||||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!render) {
|
if (!render) {
|
||||||
w = ~w;
|
w = invert ? invert : ~invert;
|
||||||
} else {
|
} else {
|
||||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||||
|
@ -282,8 +271,10 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
}
|
}
|
||||||
|
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
|
if (!ellipsis_width && render)
|
||||||
|
ellipsis_width = drw_fontset_getwidth(drw, "...");
|
||||||
while (1) {
|
while (1) {
|
||||||
utf8strlen = 0;
|
ew = ellipsis_len = utf8strlen = 0;
|
||||||
utf8str = text;
|
utf8str = text;
|
||||||
nextfont = NULL;
|
nextfont = NULL;
|
||||||
while (*text) {
|
while (*text) {
|
||||||
|
@ -291,9 +282,27 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
for (curfont = drw->fonts; curfont; curfont = curfont->next) {
|
||||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
||||||
if (charexists) {
|
if (charexists) {
|
||||||
if (curfont == usedfont) {
|
drw_font_getexts(curfont, text, utf8charlen, &tmpw, NULL);
|
||||||
|
if (ew + ellipsis_width <= w) {
|
||||||
|
/* keep track where the ellipsis still fits */
|
||||||
|
ellipsis_x = x + ew;
|
||||||
|
ellipsis_w = w - ew;
|
||||||
|
ellipsis_len = utf8strlen;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ew + tmpw > w) {
|
||||||
|
overflow = 1;
|
||||||
|
/* called from drw_fontset_getwidth_clamp():
|
||||||
|
* it wants the width AFTER the overflow
|
||||||
|
*/
|
||||||
|
if (!render)
|
||||||
|
x += tmpw;
|
||||||
|
else
|
||||||
|
utf8strlen = ellipsis_len;
|
||||||
|
} else if (curfont == usedfont) {
|
||||||
utf8strlen += utf8charlen;
|
utf8strlen += utf8charlen;
|
||||||
text += utf8charlen;
|
text += utf8charlen;
|
||||||
|
ew += tmpw;
|
||||||
} else {
|
} else {
|
||||||
nextfont = curfont;
|
nextfont = curfont;
|
||||||
}
|
}
|
||||||
|
@ -301,36 +310,25 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!charexists || nextfont)
|
if (overflow || !charexists || nextfont)
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (utf8strlen) {
|
if (utf8strlen) {
|
||||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
if (render) {
|
||||||
/* shorten text if necessary */
|
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
|
||||||
|
|
||||||
if (len) {
|
|
||||||
memcpy(buf, utf8str, len);
|
|
||||||
buf[len] = '\0';
|
|
||||||
if (len < utf8strlen)
|
|
||||||
for (i = len; i && i > len - 3; buf[--i] = '.')
|
|
||||||
; /* NOP */
|
|
||||||
|
|
||||||
if (render) {
|
|
||||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
|
||||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
|
||||||
usedfont->xfont, x, ty, (XftChar8 *)buf, len);
|
|
||||||
}
|
|
||||||
x += ew;
|
|
||||||
w -= ew;
|
|
||||||
}
|
}
|
||||||
|
x += ew;
|
||||||
|
w -= ew;
|
||||||
}
|
}
|
||||||
|
if (render && overflow)
|
||||||
|
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
|
||||||
|
|
||||||
if (!*text) {
|
if (!*text || overflow) {
|
||||||
break;
|
break;
|
||||||
} else if (nextfont) {
|
} else if (nextfont) {
|
||||||
charexists = 0;
|
charexists = 0;
|
||||||
|
@ -340,6 +338,12 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
* character must be drawn. */
|
* character must be drawn. */
|
||||||
charexists = 1;
|
charexists = 1;
|
||||||
|
|
||||||
|
for (i = 0; i < nomatches_len; ++i) {
|
||||||
|
/* avoid calling XftFontMatch if we know we won't find a match */
|
||||||
|
if (utf8codepoint == nomatches.codepoint[i])
|
||||||
|
goto no_match;
|
||||||
|
}
|
||||||
|
|
||||||
fccharset = FcCharSetCreate();
|
fccharset = FcCharSetCreate();
|
||||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||||
|
|
||||||
|
@ -351,7 +355,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
|
||||||
|
|
||||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||||
FcDefaultSubstitute(fcpattern);
|
FcDefaultSubstitute(fcpattern);
|
||||||
|
@ -368,6 +371,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
||||||
curfont->next = usedfont;
|
curfont->next = usedfont;
|
||||||
} else {
|
} else {
|
||||||
xfont_free(usedfont);
|
xfont_free(usedfont);
|
||||||
|
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
|
||||||
|
no_match:
|
||||||
usedfont = drw->fonts;
|
usedfont = drw->fonts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,6 +402,15 @@ drw_fontset_getwidth(Drw *drw, const char *text)
|
||||||
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
return drw_text(drw, 0, 0, 0, 0, 0, text, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n)
|
||||||
|
{
|
||||||
|
unsigned int tmp = 0;
|
||||||
|
if (drw && drw->fonts && text && n)
|
||||||
|
tmp = drw_text(drw, 0, 0, 0, 0, 0, text, n);
|
||||||
|
return MIN(n, tmp);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||||
{
|
{
|
||||||
|
|
3
drw.h
3
drw.h
|
@ -35,11 +35,12 @@ void drw_free(Drw *drw);
|
||||||
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
||||||
void drw_fontset_free(Fnt* set);
|
void drw_fontset_free(Fnt* set);
|
||||||
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
unsigned int drw_fontset_getwidth(Drw *drw, const char *text);
|
||||||
|
unsigned int drw_fontset_getwidth_clamp(Drw *drw, const char *text, unsigned int n);
|
||||||
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h);
|
||||||
|
|
||||||
/* Colorscheme abstraction */
|
/* Colorscheme abstraction */
|
||||||
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount);
|
||||||
|
|
||||||
/* Cursor abstraction */
|
/* Cursor abstraction */
|
||||||
Cur *drw_cur_create(Drw *drw, int shape);
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
|
92
dwm.1
92
dwm.1
|
@ -25,9 +25,7 @@ layout, the title of the focused window, and the text read from the root window
|
||||||
name property, if the screen is focused. A floating window is indicated with an
|
name property, if the screen is focused. A floating window is indicated with an
|
||||||
empty square and a maximised floating window is indicated with a filled square
|
empty square and a maximised floating window is indicated with a filled square
|
||||||
before the windows title. The selected tags are indicated with a different
|
before the windows title. The selected tags are indicated with a different
|
||||||
color. The tags of the focused window are indicated with a filled square in the
|
color.
|
||||||
top left corner. The tags which are applied to one or more windows are
|
|
||||||
indicated with an empty square in the top left corner.
|
|
||||||
.P
|
.P
|
||||||
dwm draws a small border around windows to indicate the focus state.
|
dwm draws a small border around windows to indicate the focus state.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
|
@ -49,112 +47,132 @@ label toggles between tiled and floating layout.
|
||||||
.B Button3
|
.B Button3
|
||||||
click on a tag label adds/removes all windows with that tag to/from the view.
|
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Button1
|
.B Mod4\-Button1
|
||||||
click on a tag label applies that tag to the focused window.
|
click on a tag label applies that tag to the focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Button3
|
.B Mod4\-Button3
|
||||||
click on a tag label adds/removes that tag to/from the focused window.
|
click on a tag label adds/removes that tag to/from the focused window.
|
||||||
.SS Keyboard commands
|
.SS Keyboard commands
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-Return
|
.B Mod4\-Shift\-Return
|
||||||
Start
|
Start
|
||||||
.BR st(1).
|
.BR st(1).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-p
|
.B Mod4\-d
|
||||||
Spawn
|
Spawn
|
||||||
.BR dmenu(1)
|
.BR dmenu(1)
|
||||||
for launching other programs.
|
for launching other programs.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-,
|
.B Mod4\-,
|
||||||
Focus previous screen, if any.
|
Focus previous screen, if any.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-.
|
.B Mod4\-.
|
||||||
Focus next screen, if any.
|
Focus next screen, if any.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-,
|
.B Mod4\-Shift\-,
|
||||||
Send focused window to previous screen, if any.
|
Send focused window to previous screen, if any.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-.
|
.B Mod4\-Shift\-.
|
||||||
Send focused window to next screen, if any.
|
Send focused window to next screen, if any.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-b
|
.B Mod4\-b
|
||||||
Toggles bar on and off.
|
Toggles bar on and off.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-t
|
.B Mod4\-t
|
||||||
Sets tiled layout.
|
Sets tiled layout.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-f
|
.B Mod4\-f
|
||||||
Sets floating layout.
|
Sets floating layout.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-m
|
.B Mod4\-m
|
||||||
Sets monocle layout.
|
Sets monocle layout.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-space
|
.\" .B Mod4\-space
|
||||||
Toggles between current and previous layout.
|
.\" Toggles between current and previous layout.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-j
|
.B Mod4\-j
|
||||||
Focus next window.
|
Focus next window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-k
|
.B Mod4\-k
|
||||||
Focus previous window.
|
Focus previous window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-i
|
.B Mod4\-o
|
||||||
Increase number of windows in master area.
|
Increase number of windows in master area.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-d
|
.B Mod4\-i
|
||||||
Decrease number of windows in master area.
|
Decrease number of windows in master area.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-l
|
.B Mod4\-l
|
||||||
Increase master area size.
|
Increase master area size.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-h
|
.B Mod4\-h
|
||||||
Decrease master area size.
|
Decrease master area size.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Return
|
.B Mod4\-space
|
||||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-c
|
.B Mod4\-q
|
||||||
Close focused window.
|
Close focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-space
|
.B Mod4\-Shift\-space
|
||||||
Toggle focused window between tiled and floating state.
|
Toggle focused window between tiled and floating state.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Tab
|
.B Mod4\-Tab
|
||||||
Toggles to the previously selected tags.
|
Toggles to the previously selected tags.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-[1..n]
|
.B Mod4\-Shift\-[1..n]
|
||||||
Apply nth tag to focused window.
|
Apply nth tag to focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-0
|
.B Mod4\-Shift\-0
|
||||||
Apply all tags to focused window.
|
Apply all tags to focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Control\-Shift\-[1..n]
|
.B Mod4\-Control\-Shift\-[1..n]
|
||||||
Add/remove nth tag to/from focused window.
|
Add/remove nth tag to/from focused window.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-[1..n]
|
.B Mod4\-[1..n]
|
||||||
View all windows with nth tag.
|
View all windows with nth tag.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-0
|
.B Mod4\-0
|
||||||
View all windows with any tag.
|
View all windows with any tag.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Control\-[1..n]
|
.B Mod4\-Control\-[1..n]
|
||||||
Add/remove all windows with nth tag to/from the view.
|
Add/remove all windows with nth tag to/from the view.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Shift\-q
|
.B Mod4\-<
|
||||||
|
Decrease the gaps around windows.
|
||||||
|
.TP
|
||||||
|
.B Mod4\->
|
||||||
|
Increase the gaps around windows.
|
||||||
|
.TP
|
||||||
|
.B Mod4\-Shift-=
|
||||||
|
Reset the gaps around windows to
|
||||||
|
.BR 0 .
|
||||||
|
.TP
|
||||||
|
.B Mod4\-Shift\-q
|
||||||
Quit dwm.
|
Quit dwm.
|
||||||
|
.TP
|
||||||
|
.B Mod4\-Mod1\-q
|
||||||
|
Restart dwm.
|
||||||
.SS Mouse commands
|
.SS Mouse commands
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Button1
|
.B Mod4\-Button1
|
||||||
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Button2
|
.B Mod4\-Button2
|
||||||
Toggles focused window between floating and tiled state.
|
Toggles focused window between floating and tiled state.
|
||||||
.TP
|
.TP
|
||||||
.B Mod1\-Button3
|
.B Mod4\-Button3
|
||||||
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||||
.SH CUSTOMIZATION
|
.SH CUSTOMIZATION
|
||||||
dwm is customized by creating a custom config.h and (re)compiling the source
|
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||||
code. This keeps it fast, secure and simple.
|
code. This keeps it fast, secure and simple.
|
||||||
|
.SH SIGNALS
|
||||||
|
.TP
|
||||||
|
.B SIGHUP - 1
|
||||||
|
Restart the dwm process.
|
||||||
|
.TP
|
||||||
|
.B SIGTERM - 15
|
||||||
|
Cleanly terminate the dwm process.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR dmenu (1),
|
.BR dmenu (1),
|
||||||
.BR st (1)
|
.BR st (1)
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
From d5eec73302c622f3eba1ad5e3887aaa1d0a8d9e1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: David JULIEN <swytch@mailo.com>
|
||||||
|
Date: Sat, 23 Apr 2022 13:24:34 +0200
|
||||||
|
Subject: [PATCH] fix: patch application
|
||||||
|
|
||||||
|
Patch application got broken by a recent commit. This commit fixes it
|
||||||
|
and allows for a smooth patching process
|
||||||
|
---
|
||||||
|
dwm.c | 32 ++++++++++++++++++++++++++++----
|
||||||
|
1 file changed, 28 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 0fc328a..c294e72 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -49,7 +49,8 @@
|
||||||
|
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||||
|
#define INTERSECT(x,y,w,h,m) (MAX(0, MIN((x)+(w),(m)->wx+(m)->ww) - MAX((x),(m)->wx)) \
|
||||||
|
* MAX(0, MIN((y)+(h),(m)->wy+(m)->wh) - MAX((y),(m)->wy)))
|
||||||
|
-#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||||
|
+#define ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||||
|
+#define ISVISIBLE(C) ISVISIBLEONTAG(C, 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)
|
||||||
|
@@ -147,6 +148,7 @@ static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interac
|
||||||
|
static void arrange(Monitor *m);
|
||||||
|
static void arrangemon(Monitor *m);
|
||||||
|
static void attach(Client *c);
|
||||||
|
+static void attachaside(Client *c);
|
||||||
|
static void attachstack(Client *c);
|
||||||
|
static void buttonpress(XEvent *e);
|
||||||
|
static void checkotherwm(void);
|
||||||
|
@@ -184,6 +186,7 @@ static void maprequest(XEvent *e);
|
||||||
|
static void monocle(Monitor *m);
|
||||||
|
static void motionnotify(XEvent *e);
|
||||||
|
static void movemouse(const Arg *arg);
|
||||||
|
+static Client *nexttagged(Client *c);
|
||||||
|
static Client *nexttiled(Client *c);
|
||||||
|
static void pop(Client *);
|
||||||
|
static void propertynotify(XEvent *e);
|
||||||
|
@@ -409,6 +412,17 @@ attach(Client *c)
|
||||||
|
c->mon->clients = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+attachaside(Client *c) {
|
||||||
|
+ Client *at = nexttagged(c);
|
||||||
|
+ if(!at) {
|
||||||
|
+ attach(c);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ c->next = at->next;
|
||||||
|
+ at->next = c;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
attachstack(Client *c)
|
||||||
|
{
|
||||||
|
@@ -1068,7 +1082,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
|
c->isfloating = c->oldstate = t || c->isfixed;
|
||||||
|
if (c->isfloating)
|
||||||
|
XRaiseWindow(dpy, c->win);
|
||||||
|
- attach(c);
|
||||||
|
+ attachaside(c);
|
||||||
|
attachstack(c);
|
||||||
|
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||||
|
(unsigned char *) &(c->win), 1);
|
||||||
|
@@ -1198,6 +1212,16 @@ movemouse(const Arg *arg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+Client *
|
||||||
|
+nexttagged(Client *c) {
|
||||||
|
+ Client *walked = c->mon->clients;
|
||||||
|
+ for(;
|
||||||
|
+ walked && (walked->isfloating || !ISVISIBLEONTAG(walked, c->tags));
|
||||||
|
+ walked = walked->next
|
||||||
|
+ );
|
||||||
|
+ return walked;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Client *
|
||||||
|
nexttiled(Client *c)
|
||||||
|
{
|
||||||
|
@@ -1423,7 +1447,7 @@ sendmon(Client *c, Monitor *m)
|
||||||
|
detachstack(c);
|
||||||
|
c->mon = m;
|
||||||
|
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||||
|
- attach(c);
|
||||||
|
+ attachaside(c);
|
||||||
|
attachstack(c);
|
||||||
|
focus(NULL);
|
||||||
|
arrange(NULL);
|
||||||
|
@@ -1906,7 +1930,7 @@ updategeom(void)
|
||||||
|
m->clients = c->next;
|
||||||
|
detachstack(c);
|
||||||
|
c->mon = mons;
|
||||||
|
- attach(c);
|
||||||
|
+ attachaside(c);
|
||||||
|
attachstack(c);
|
||||||
|
}
|
||||||
|
if (m == selmon)
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
From 69f91089d9248fa9695eb925956e255a215171b8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: bakkeby <bakkeby@gmail.com>
|
||||||
|
Date: Tue, 7 Apr 2020 12:29:08 +0200
|
||||||
|
Subject: [PATCH] Adding 6.2 center patch with multi-monitor fix and
|
||||||
|
auto-centering of floating popup windows
|
||||||
|
---
|
||||||
|
config.def.h | 6 +++---
|
||||||
|
dwm.c | 13 +++++++++++--
|
||||||
|
2 files changed, 14 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..44b46e5 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -26,9 +26,9 @@ static const Rule rules[] = {
|
||||||
|
* 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 },
|
||||||
|
+ /* class instance title tags mask iscentered isfloating monitor */
|
||||||
|
+ { "Gimp", NULL, NULL, 0, 0, 1, -1 },
|
||||||
|
+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..ab33757 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -92,7 +92,7 @@ struct Client {
|
||||||
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
|
int bw, oldbw;
|
||||||
|
unsigned int tags;
|
||||||
|
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
+ int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
Client *next;
|
||||||
|
Client *snext;
|
||||||
|
Monitor *mon;
|
||||||
|
@@ -137,6 +137,7 @@ typedef struct {
|
||||||
|
const char *instance;
|
||||||
|
const char *title;
|
||||||
|
unsigned int tags;
|
||||||
|
+ int iscentered;
|
||||||
|
int isfloating;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
@@ -285,6 +286,7 @@ applyrules(Client *c)
|
||||||
|
XClassHint ch = { NULL, NULL };
|
||||||
|
|
||||||
|
/* rule matching */
|
||||||
|
+ c->iscentered = 0;
|
||||||
|
c->isfloating = 0;
|
||||||
|
c->tags = 0;
|
||||||
|
XGetClassHint(dpy, c->win, &ch);
|
||||||
|
@@ -297,6 +299,7 @@ applyrules(Client *c)
|
||||||
|
&& (!r->class || strstr(class, r->class))
|
||||||
|
&& (!r->instance || strstr(instance, r->instance)))
|
||||||
|
{
|
||||||
|
+ c->iscentered = r->iscentered;
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
c->tags |= r->tags;
|
||||||
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||||
|
@@ -1056,6 +1059,10 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
|
updatewindowtype(c);
|
||||||
|
updatesizehints(c);
|
||||||
|
updatewmhints(c);
|
||||||
|
+ if (c->iscentered) {
|
||||||
|
+ c->x = c->mon->mx + (c->mon->mw - WIDTH(c)) / 2;
|
||||||
|
+ c->y = c->mon->my + (c->mon->mh - HEIGHT(c)) / 2;
|
||||||
|
+ }
|
||||||
|
XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask);
|
||||||
|
grabbuttons(c, 0);
|
||||||
|
if (!c->isfloating)
|
||||||
|
@@ -2009,8 +2016,10 @@ updatewindowtype(Client *c)
|
||||||
|
|
||||||
|
if (state == netatom[NetWMFullscreen])
|
||||||
|
setfullscreen(c, 1);
|
||||||
|
- if (wtype == netatom[NetWMWindowTypeDialog])
|
||||||
|
+ if (wtype == netatom[NetWMWindowTypeDialog]) {
|
||||||
|
+ c->iscentered = 1;
|
||||||
|
c->isfloating = 1;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
|
@ -0,0 +1,138 @@
|
||||||
|
From 7b7773458c072e4b24d6ea32d0364a8e402e4a43 Mon Sep 17 00:00:00 2001
|
||||||
|
From: swy7ch <swy7ch@protonmail.com>
|
||||||
|
Date: Fri, 8 May 2020 19:07:24 +0200
|
||||||
|
Subject: [PATCH] [PATCH] update dwm-fullgaps patch to be used with tile layout
|
||||||
|
update
|
||||||
|
|
||||||
|
the recent tile layout changes in commit HEAD~1 (f09418b) broke the
|
||||||
|
patch
|
||||||
|
|
||||||
|
this patch adapt the new `if` statements to take gaps into account
|
||||||
|
|
||||||
|
this patch also provides manpage entries for the keybindings
|
||||||
|
---
|
||||||
|
config.def.h | 4 ++++
|
||||||
|
dwm.1 | 10 ++++++++++
|
||||||
|
dwm.c | 33 +++++++++++++++++++++++----------
|
||||||
|
3 files changed, 37 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..38d2f6c 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 = 5; /* 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 */
|
||||||
|
@@ -84,6 +85,9 @@ static Key keys[] = {
|
||||||
|
{ MODKEY, XK_period, focusmon, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
|
TAGKEYS( XK_1, 0)
|
||||||
|
TAGKEYS( XK_2, 1)
|
||||||
|
TAGKEYS( XK_3, 2)
|
||||||
|
diff --git a/dwm.1 b/dwm.1
|
||||||
|
index 13b3729..0202d96 100644
|
||||||
|
--- a/dwm.1
|
||||||
|
+++ b/dwm.1
|
||||||
|
@@ -140,6 +140,16 @@ View all windows with any tag.
|
||||||
|
.B Mod1\-Control\-[1..n]
|
||||||
|
Add/remove all windows with nth tag to/from the view.
|
||||||
|
.TP
|
||||||
|
+.B Mod1\--
|
||||||
|
+Decrease the gaps around windows.
|
||||||
|
+.TP
|
||||||
|
+.B Mod1\-=
|
||||||
|
+Increase the gaps around windows.
|
||||||
|
+.TP
|
||||||
|
+.B Mod1\-Shift-=
|
||||||
|
+Reset the gaps around windows to
|
||||||
|
+.BR 0 .
|
||||||
|
+.TP
|
||||||
|
.B Mod1\-Shift\-q
|
||||||
|
Quit dwm.
|
||||||
|
.SS Mouse commands
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 9fd0286..45a58f3 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -119,6 +119,7 @@ struct Monitor {
|
||||||
|
int by; /* bar geometry */
|
||||||
|
int mx, my, mw, mh; /* screen size */
|
||||||
|
int wx, wy, ww, wh; /* window area */
|
||||||
|
+ int gappx; /* gaps between windows */
|
||||||
|
unsigned int seltags;
|
||||||
|
unsigned int sellt;
|
||||||
|
unsigned int tagset[2];
|
||||||
|
@@ -200,6 +201,7 @@ static void sendmon(Client *c, Monitor *m);
|
||||||
|
static void setclientstate(Client *c, long state);
|
||||||
|
static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
|
+static void setgaps(const Arg *arg);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
@@ -639,6 +641,7 @@ createmon(void)
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
+ m->gappx = gappx;
|
||||||
|
m->lt[0] = &layouts[0];
|
||||||
|
m->lt[1] = &layouts[1 % LENGTH(layouts)];
|
||||||
|
strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
|
||||||
|
@@ -1498,6 +1501,16 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+setgaps(const Arg *arg)
|
||||||
|
+{
|
||||||
|
+ if ((arg->i == 0) || (selmon->gappx + arg->i < 0))
|
||||||
|
+ selmon->gappx = 0;
|
||||||
|
+ else
|
||||||
|
+ selmon->gappx += arg->i;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
setlayout(const Arg *arg)
|
||||||
|
{
|
||||||
|
@@ -1684,18 +1697,18 @@ tile(Monitor *m)
|
||||||
|
if (n > m->nmaster)
|
||||||
|
mw = m->nmaster ? m->ww * m->mfact : 0;
|
||||||
|
else
|
||||||
|
- mw = m->ww;
|
||||||
|
- for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
+ mw = m->ww - m->gappx;
|
||||||
|
+ for (i = 0, my = ty = m->gappx, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
|
||||||
|
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);
|
||||||
|
- if (my + HEIGHT(c) < m->wh)
|
||||||
|
- my += HEIGHT(c);
|
||||||
|
+ h = (m->wh - my) / (MIN(n, m->nmaster) - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + m->gappx, m->wy + my, mw - (2*c->bw) - m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (my + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ my += HEIGHT(c) + m->gappx;
|
||||||
|
} 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);
|
||||||
|
- if (ty + HEIGHT(c) < m->wh)
|
||||||
|
- ty += HEIGHT(c);
|
||||||
|
+ h = (m->wh - ty) / (n - i) - m->gappx;
|
||||||
|
+ resize(c, m->wx + mw + m->gappx, m->wy + ty, m->ww - mw - (2*c->bw) - 2*m->gappx, h - (2*c->bw), 0);
|
||||||
|
+ if (ty + HEIGHT(c) + m->gappx < m->wh)
|
||||||
|
+ ty += HEIGHT(c) + m->gappx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index a96f33c..f2da729 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -432,9 +432,15 @@ buttonpress(XEvent *e)
|
||||||
|
}
|
||||||
|
if (ev->window == selmon->barwin) {
|
||||||
|
i = x = 0;
|
||||||
|
- do
|
||||||
|
+ unsigned int occ = 0;
|
||||||
|
+ for(c = m->clients; c; c=c->next)
|
||||||
|
+ occ |= c->tags;
|
||||||
|
+ do {
|
||||||
|
+ /* Do not reserve space for vacant tags */
|
||||||
|
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||||
|
+ continue;
|
||||||
|
x += TEXTW(tags[i]);
|
||||||
|
- while (ev->x >= x && ++i < LENGTH(tags));
|
||||||
|
+ } while (ev->x >= x && ++i < LENGTH(tags));
|
||||||
|
if (i < LENGTH(tags)) {
|
||||||
|
click = ClkTagBar;
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
@@ -719,13 +725,12 @@ drawbar(Monitor *m)
|
||||||
|
}
|
||||||
|
x = 0;
|
||||||
|
for (i = 0; i < LENGTH(tags); i++) {
|
||||||
|
+ /* Do not draw vacant tags */
|
||||||
|
+ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||||
|
+ continue;
|
||||||
|
w = TEXTW(tags[i]);
|
||||||
|
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
|
||||||
|
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
|
||||||
|
- if (occ & 1 << i)
|
||||||
|
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
|
||||||
|
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
|
||||||
|
- urg & 1 << i);
|
||||||
|
x += w;
|
||||||
|
}
|
||||||
|
w = blw = TEXTW(m->ltsymbol);
|
|
@ -0,0 +1,31 @@
|
||||||
|
From 700b0bdea872f4c00182b2bd925b41fe03f8d222 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Aidan Hall <aidan.hall@outlook.com>
|
||||||
|
Date: Tue, 2 Jun 2020 14:41:53 +0000
|
||||||
|
Subject: [PATCH] Prevents hiding the border if layout is floating.
|
||||||
|
|
||||||
|
---
|
||||||
|
dwm.c | 8 ++++++++
|
||||||
|
1 file changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 4465af1..2dd959d 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -1282,6 +1282,14 @@ 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 (((nexttiled(c->mon->clients) == c && !nexttiled(c->next))
|
||||||
|
+ || &monocle == c->mon->lt[c->mon->sellt]->arrange)
|
||||||
|
+ && !c->isfullscreen && !c->isfloating
|
||||||
|
+ && NULL != c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
|
+ c->w = wc.width += c->bw * 2;
|
||||||
|
+ c->h = wc.height += c->bw * 2;
|
||||||
|
+ wc.border_width = 0;
|
||||||
|
+ }
|
||||||
|
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
|
||||||
|
configure(c);
|
||||||
|
XSync(dpy, False);
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
From a3a7e94f59553689656871a65ea9ce90169a7c91 Mon Sep 17 00:00:00 2001
|
||||||
|
From: birdalicous <jack.bird@durham.ac.uk>
|
||||||
|
Date: Thu, 15 Jul 2021 12:28:29 +0100
|
||||||
|
Subject: [PATCH] notitle patch applied#
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 1 -
|
||||||
|
dwm.c | 20 ++++----------------
|
||||||
|
2 files changed, 4 insertions(+), 17 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a2ac963..eac20b4 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -103,7 +103,6 @@ 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} },
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 5e4d494..6cd9fb7 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||||
|
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
|
||||||
|
NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
|
||||||
|
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
|
||||||
|
-enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
|
||||||
|
- ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
+enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkClientWin,
|
||||||
|
+ ClkRootWin, ClkLast }; /* clicks */
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
int i;
|
||||||
|
@@ -440,10 +440,8 @@ buttonpress(XEvent *e)
|
||||||
|
arg.ui = 1 << i;
|
||||||
|
} else if (ev->x < x + blw)
|
||||||
|
click = ClkLtSymbol;
|
||||||
|
- else if (ev->x > selmon->ww - (int)TEXTW(stext))
|
||||||
|
- click = ClkStatusText;
|
||||||
|
else
|
||||||
|
- click = ClkWinTitle;
|
||||||
|
+ click = ClkStatusText;
|
||||||
|
} else if ((c = wintoclient(ev->window))) {
|
||||||
|
focus(c);
|
||||||
|
restack(selmon);
|
||||||
|
@@ -730,15 +728,8 @@ drawbar(Monitor *m)
|
||||||
|
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||||
|
|
||||||
|
if ((w = m->ww - tw - x) > bh) {
|
||||||
|
- if (m->sel) {
|
||||||
|
- 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);
|
||||||
|
- } else {
|
||||||
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
|
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||||
|
}
|
||||||
|
@@ -1236,11 +1227,8 @@ propertynotify(XEvent *e)
|
||||||
|
drawbars();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
- if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName]) {
|
||||||
|
+ if (ev->atom == XA_WM_NAME || ev->atom == netatom[NetWMName])
|
||||||
|
updatetitle(c);
|
||||||
|
- if (c == c->mon->sel)
|
||||||
|
- drawbar(c->mon);
|
||||||
|
- }
|
||||||
|
if (ev->atom == netatom[NetWMWindowType])
|
||||||
|
updatewindowtype(c);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.32.0
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
From 2991f37f0aaf44b9f9b11e7893ff0af8eb88f649 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Christopher Drelich <cd@cdrakka.com>
|
||||||
|
Date: Wed, 23 May 2018 22:50:38 -0400
|
||||||
|
Subject: [PATCH] Modifies quit to handle restarts and adds SIGHUP and SIGTERM
|
||||||
|
handlers.
|
||||||
|
|
||||||
|
Modified quit() to restart if it receives arg .i = 1
|
||||||
|
MOD+CTRL+SHIFT+Q was added to confid.def.h to do just that.
|
||||||
|
|
||||||
|
Signal handlers were handled for SIGHUP and SIGTERM.
|
||||||
|
If dwm receives these signals it calls quit() with
|
||||||
|
arg .i = to 1 or 0, respectively.
|
||||||
|
|
||||||
|
To restart dwm:
|
||||||
|
MOD+CTRL+SHIFT+Q
|
||||||
|
or
|
||||||
|
kill -HUP dwmpid
|
||||||
|
|
||||||
|
To quit dwm cleanly:
|
||||||
|
MOD+SHIFT+Q
|
||||||
|
or
|
||||||
|
kill -TERM dwmpid
|
||||||
|
---
|
||||||
|
config.def.h | 1 +
|
||||||
|
dwm.1 | 10 ++++++++++
|
||||||
|
dwm.c | 22 ++++++++++++++++++++++
|
||||||
|
3 files changed, 33 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a9ac303..e559429 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -94,6 +94,7 @@ static Key keys[] = {
|
||||||
|
TAGKEYS( XK_8, 7)
|
||||||
|
TAGKEYS( XK_9, 8)
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
+ { MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* button definitions */
|
||||||
|
diff --git a/dwm.1 b/dwm.1
|
||||||
|
index 13b3729..36a331c 100644
|
||||||
|
--- a/dwm.1
|
||||||
|
+++ b/dwm.1
|
||||||
|
@@ -142,6 +142,9 @@ Add/remove all windows with nth tag to/from the view.
|
||||||
|
.TP
|
||||||
|
.B Mod1\-Shift\-q
|
||||||
|
Quit dwm.
|
||||||
|
+.TP
|
||||||
|
+.B Mod1\-Control\-Shift\-q
|
||||||
|
+Restart dwm.
|
||||||
|
.SS Mouse commands
|
||||||
|
.TP
|
||||||
|
.B Mod1\-Button1
|
||||||
|
@@ -155,6 +158,13 @@ Resize focused window while dragging. Tiled windows will be toggled to the float
|
||||||
|
.SH CUSTOMIZATION
|
||||||
|
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||||
|
code. This keeps it fast, secure and simple.
|
||||||
|
+.SH SIGNALS
|
||||||
|
+.TP
|
||||||
|
+.B SIGHUP - 1
|
||||||
|
+Restart the dwm process.
|
||||||
|
+.TP
|
||||||
|
+.B SIGTERM - 15
|
||||||
|
+Cleanly terminate the dwm process.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR dmenu (1),
|
||||||
|
.BR st (1)
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index bb95e26..286eecd 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -205,6 +205,8 @@ static void setup(void);
|
||||||
|
static void seturgent(Client *c, int urg);
|
||||||
|
static void showhide(Client *c);
|
||||||
|
static void sigchld(int unused);
|
||||||
|
+static void sighup(int unused);
|
||||||
|
+static void sigterm(int unused);
|
||||||
|
static void spawn(const Arg *arg);
|
||||||
|
static void tag(const Arg *arg);
|
||||||
|
static void tagmon(const Arg *arg);
|
||||||
|
@@ -260,6 +262,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
|
[UnmapNotify] = unmapnotify
|
||||||
|
};
|
||||||
|
static Atom wmatom[WMLast], netatom[NetLast];
|
||||||
|
+static int restart = 0;
|
||||||
|
static int running = 1;
|
||||||
|
static Cur *cursor[CurLast];
|
||||||
|
static Clr **scheme;
|
||||||
|
@@ -1248,6 +1251,7 @@ propertynotify(XEvent *e)
|
||||||
|
void
|
||||||
|
quit(const Arg *arg)
|
||||||
|
{
|
||||||
|
+ if(arg->i) restart = 1;
|
||||||
|
running = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1536,6 +1540,9 @@ setup(void)
|
||||||
|
/* clean up any zombies immediately */
|
||||||
|
sigchld(0);
|
||||||
|
|
||||||
|
+ signal(SIGHUP, sighup);
|
||||||
|
+ signal(SIGTERM, sigterm);
|
||||||
|
+
|
||||||
|
/* init screen */
|
||||||
|
screen = DefaultScreen(dpy);
|
||||||
|
sw = DisplayWidth(dpy, screen);
|
||||||
|
@@ -1637,6 +1644,20 @@ sigchld(int unused)
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+sighup(int unused)
|
||||||
|
+{
|
||||||
|
+ Arg a = {.i = 1};
|
||||||
|
+ quit(&a);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+sigterm(int unused)
|
||||||
|
+{
|
||||||
|
+ Arg a = {.i = 0};
|
||||||
|
+ quit(&a);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
spawn(const Arg *arg)
|
||||||
|
{
|
||||||
|
if (arg->v == dmenucmd)
|
||||||
|
@@ -2139,6 +2160,7 @@ main(int argc, char *argv[])
|
||||||
|
setup();
|
||||||
|
scan();
|
||||||
|
run();
|
||||||
|
+ if(restart) execvp(argv[0], argv);
|
||||||
|
cleanup();
|
||||||
|
XCloseDisplay(dpy);
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
--
|
||||||
|
2.7.4
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
From 9fd4a02b57aa8a764d8105d5f2f854372f4ef559 Mon Sep 17 00:00:00 2001
|
||||||
|
From: ViliamKovac1223 <viliamkovac1223@gmail.com>
|
||||||
|
Date: Sat, 9 Jul 2022 17:35:54 +0200
|
||||||
|
Subject: [PATCH] add restore patch
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 2 ++
|
||||||
|
dwm.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
2 files changed, 55 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 6ec4146..0b91976 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -1,5 +1,7 @@
|
||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
+#define SESSION_FILE "/tmp/dwm-session"
|
||||||
|
+
|
||||||
|
/* appearance */
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 74cec7e..76b40a2 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -1255,11 +1255,63 @@ propertynotify(XEvent *e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+saveSession(void)
|
||||||
|
+{
|
||||||
|
+ FILE *fw = fopen(SESSION_FILE, "w");
|
||||||
|
+ for (Client *c = selmon->clients; c != NULL; c = c->next) { // get all the clients with their tags and write them to the file
|
||||||
|
+ fprintf(fw, "%lu %u\n", c->win, c->tags);
|
||||||
|
+ }
|
||||||
|
+ fclose(fw);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+restoreSession(void)
|
||||||
|
+{
|
||||||
|
+ // restore session
|
||||||
|
+ FILE *fr = fopen(SESSION_FILE, "r");
|
||||||
|
+ if (!fr)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ char *str = malloc(23 * sizeof(char)); // allocate enough space for excepted input from text file
|
||||||
|
+ while (fscanf(fr, "%[^\n] ", str) != EOF) { // read file till the end
|
||||||
|
+ long unsigned int winId;
|
||||||
|
+ unsigned int tagsForWin;
|
||||||
|
+ int check = sscanf(str, "%lu %u", &winId, &tagsForWin); // get data
|
||||||
|
+ if (check != 2) // break loop if data wasn't read correctly
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ for (Client *c = selmon->clients; c ; c = c->next) { // add tags to every window by winId
|
||||||
|
+ if (c->win == winId) {
|
||||||
|
+ c->tags = tagsForWin;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (Client *c = selmon->clients; c ; c = c->next) { // refocus on windows
|
||||||
|
+ focus(c);
|
||||||
|
+ restack(c->mon);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for (Monitor *m = selmon; m; m = m->next) // rearrange all monitors
|
||||||
|
+ arrange(m);
|
||||||
|
+
|
||||||
|
+ free(str);
|
||||||
|
+ fclose(fr);
|
||||||
|
+
|
||||||
|
+ // delete a file
|
||||||
|
+ remove(SESSION_FILE);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
quit(const Arg *arg)
|
||||||
|
{
|
||||||
|
if(arg->i) restart = 1;
|
||||||
|
running = 0;
|
||||||
|
+
|
||||||
|
+ if (restart == 1)
|
||||||
|
+ saveSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
Monitor *
|
||||||
|
@@ -2173,6 +2225,7 @@ main(int argc, char *argv[])
|
||||||
|
die("pledge");
|
||||||
|
#endif /* __OpenBSD__ */
|
||||||
|
scan();
|
||||||
|
+ restoreSession();
|
||||||
|
run();
|
||||||
|
if(restart) execvp(argv[0], argv);
|
||||||
|
cleanup();
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
|
@ -0,0 +1,412 @@
|
||||||
|
From f0cdf40e0a7126838d051eb84d84b91421b771d6 Mon Sep 17 00:00:00 2001
|
||||||
|
From: 0x1bi <ben@0x1bi.net>
|
||||||
|
Date: Fri, 11 Dec 2020 10:16:25 -0500
|
||||||
|
Subject: [PATCH] fix swallow for openbsd
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 9 +-
|
||||||
|
config.mk | 3 +-
|
||||||
|
dwm.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||||
|
3 files changed, 237 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 1c0b587..fe51476 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 int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
|
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" };
|
||||||
|
@@ -26,9 +27,11 @@ static const Rule rules[] = {
|
||||||
|
* 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 },
|
||||||
|
+ /* class instance title tags mask isfloating isterminal noswallow monitor */
|
||||||
|
+ { "Gimp", NULL, NULL, 0, 1, 0, 0, -1 },
|
||||||
|
+ { "Firefox", NULL, NULL, 1 << 8, 0, 0, -1, -1 },
|
||||||
|
+ { "St", NULL, NULL, 0, 0, 1, 0, -1 },
|
||||||
|
+ { NULL, NULL, "Event Tester", 0, 0, 0, 1, -1 }, /* xev */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
diff --git a/config.mk b/config.mk
|
||||||
|
index 7084c33..ff9e508 100644
|
||||||
|
--- a/config.mk
|
||||||
|
+++ b/config.mk
|
||||||
|
@@ -19,10 +19,11 @@ FREETYPELIBS = -lfontconfig -lXft
|
||||||
|
FREETYPEINC = /usr/include/freetype2
|
||||||
|
# OpenBSD (uncomment)
|
||||||
|
#FREETYPEINC = ${X11INC}/freetype2
|
||||||
|
+#KVMLIB = -lkvm
|
||||||
|
|
||||||
|
# includes and libs
|
||||||
|
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
|
-LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||||
|
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB}
|
||||||
|
|
||||||
|
# flags
|
||||||
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 664c527..0b20086 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -40,6 +40,12 @@
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
#endif /* XINERAMA */
|
||||||
|
#include <X11/Xft/Xft.h>
|
||||||
|
+#include <X11/Xlib-xcb.h>
|
||||||
|
+#include <xcb/res.h>
|
||||||
|
+#ifdef __OpenBSD__
|
||||||
|
+#include <sys/sysctl.h>
|
||||||
|
+#include <kvm.h>
|
||||||
|
+#endif /* __OpenBSD */
|
||||||
|
|
||||||
|
#include "drw.h"
|
||||||
|
#include "util.h"
|
||||||
|
@@ -92,9 +98,11 @@ struct Client {
|
||||||
|
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||||
|
int bw, oldbw;
|
||||||
|
unsigned int tags;
|
||||||
|
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
|
||||||
|
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow;
|
||||||
|
+ pid_t pid;
|
||||||
|
Client *next;
|
||||||
|
Client *snext;
|
||||||
|
+ Client *swallowing;
|
||||||
|
Monitor *mon;
|
||||||
|
Window win;
|
||||||
|
};
|
||||||
|
@@ -138,6 +146,8 @@ typedef struct {
|
||||||
|
const char *title;
|
||||||
|
unsigned int tags;
|
||||||
|
int isfloating;
|
||||||
|
+ int isterminal;
|
||||||
|
+ int noswallow;
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
@@ -235,6 +245,12 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
|
static void zoom(const Arg *arg);
|
||||||
|
|
||||||
|
+static pid_t getparentprocess(pid_t p);
|
||||||
|
+static int isdescprocess(pid_t p, pid_t c);
|
||||||
|
+static Client *swallowingclient(Window w);
|
||||||
|
+static Client *termforwin(const Client *c);
|
||||||
|
+static pid_t winpid(Window w);
|
||||||
|
+
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
static char stext[256];
|
||||||
|
@@ -269,6 +285,8 @@ static Drw *drw;
|
||||||
|
static Monitor *mons, *selmon;
|
||||||
|
static Window root, wmcheckwin;
|
||||||
|
|
||||||
|
+static xcb_connection_t *xcon;
|
||||||
|
+
|
||||||
|
/* configuration, allows nested code to access above variables */
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
@@ -298,6 +316,8 @@ applyrules(Client *c)
|
||||||
|
&& (!r->class || strstr(class, r->class))
|
||||||
|
&& (!r->instance || strstr(instance, r->instance)))
|
||||||
|
{
|
||||||
|
+ c->isterminal = r->isterminal;
|
||||||
|
+ c->noswallow = r->noswallow;
|
||||||
|
c->isfloating = r->isfloating;
|
||||||
|
c->tags |= r->tags;
|
||||||
|
for (m = mons; m && m->num != r->monitor; m = m->next);
|
||||||
|
@@ -414,6 +434,53 @@ attachstack(Client *c)
|
||||||
|
c->mon->stack = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+swallow(Client *p, Client *c)
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ if (c->noswallow || c->isterminal)
|
||||||
|
+ return;
|
||||||
|
+ if (c->noswallow && !swallowfloating && c->isfloating)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ detach(c);
|
||||||
|
+ detachstack(c);
|
||||||
|
+
|
||||||
|
+ setclientstate(c, WithdrawnState);
|
||||||
|
+ XUnmapWindow(dpy, p->win);
|
||||||
|
+
|
||||||
|
+ p->swallowing = c;
|
||||||
|
+ c->mon = p->mon;
|
||||||
|
+
|
||||||
|
+ Window w = p->win;
|
||||||
|
+ p->win = c->win;
|
||||||
|
+ c->win = w;
|
||||||
|
+ updatetitle(p);
|
||||||
|
+ XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
|
||||||
|
+ arrange(p->mon);
|
||||||
|
+ configure(p);
|
||||||
|
+ updateclientlist();
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+unswallow(Client *c)
|
||||||
|
+{
|
||||||
|
+ c->win = c->swallowing->win;
|
||||||
|
+
|
||||||
|
+ free(c->swallowing);
|
||||||
|
+ c->swallowing = NULL;
|
||||||
|
+
|
||||||
|
+ /* unfullscreen the client */
|
||||||
|
+ setfullscreen(c, 0);
|
||||||
|
+ updatetitle(c);
|
||||||
|
+ arrange(c->mon);
|
||||||
|
+ XMapWindow(dpy, c->win);
|
||||||
|
+ XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
|
||||||
|
+ setclientstate(c, NormalState);
|
||||||
|
+ focus(NULL);
|
||||||
|
+ arrange(c->mon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void
|
||||||
|
buttonpress(XEvent *e)
|
||||||
|
{
|
||||||
|
@@ -653,6 +720,9 @@ destroynotify(XEvent *e)
|
||||||
|
|
||||||
|
if ((c = wintoclient(ev->window)))
|
||||||
|
unmanage(c, 1);
|
||||||
|
+
|
||||||
|
+ else if ((c = swallowingclient(ev->window)))
|
||||||
|
+ unmanage(c->swallowing, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -1018,12 +1088,13 @@ killclient(const Arg *arg)
|
||||||
|
void
|
||||||
|
manage(Window w, XWindowAttributes *wa)
|
||||||
|
{
|
||||||
|
- Client *c, *t = NULL;
|
||||||
|
+ Client *c, *t = NULL, *term = NULL;
|
||||||
|
Window trans = None;
|
||||||
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
c = ecalloc(1, sizeof(Client));
|
||||||
|
c->win = w;
|
||||||
|
+ c->pid = winpid(w);
|
||||||
|
/* geometry */
|
||||||
|
c->x = c->oldx = wa->x;
|
||||||
|
c->y = c->oldy = wa->y;
|
||||||
|
@@ -1038,6 +1109,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
|
} else {
|
||||||
|
c->mon = selmon;
|
||||||
|
applyrules(c);
|
||||||
|
+ term = termforwin(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
|
||||||
|
@@ -1074,6 +1146,8 @@ manage(Window w, XWindowAttributes *wa)
|
||||||
|
c->mon->sel = c;
|
||||||
|
arrange(c->mon);
|
||||||
|
XMapWindow(dpy, c->win);
|
||||||
|
+ if (term)
|
||||||
|
+ swallow(term, c);
|
||||||
|
focus(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -1768,6 +1842,20 @@ unmanage(Client *c, int destroyed)
|
||||||
|
Monitor *m = c->mon;
|
||||||
|
XWindowChanges wc;
|
||||||
|
|
||||||
|
+ if (c->swallowing) {
|
||||||
|
+ unswallow(c);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ Client *s = swallowingclient(c->win);
|
||||||
|
+ if (s) {
|
||||||
|
+ free(s->swallowing);
|
||||||
|
+ s->swallowing = NULL;
|
||||||
|
+ arrange(m);
|
||||||
|
+ focus(NULL);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
detach(c);
|
||||||
|
detachstack(c);
|
||||||
|
if (!destroyed) {
|
||||||
|
@@ -1782,9 +1870,12 @@ unmanage(Client *c, int destroyed)
|
||||||
|
XUngrabServer(dpy);
|
||||||
|
}
|
||||||
|
free(c);
|
||||||
|
- focus(NULL);
|
||||||
|
- updateclientlist();
|
||||||
|
- arrange(m);
|
||||||
|
+
|
||||||
|
+ if (!s) {
|
||||||
|
+ arrange(m);
|
||||||
|
+ focus(NULL);
|
||||||
|
+ updateclientlist();
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
@@ -2047,6 +2138,136 @@ view(const Arg *arg)
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
|
+pid_t
|
||||||
|
+winpid(Window w)
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+ pid_t result = 0;
|
||||||
|
+
|
||||||
|
+#ifdef __linux__
|
||||||
|
+ xcb_res_client_id_spec_t spec = {0};
|
||||||
|
+ spec.client = w;
|
||||||
|
+ spec.mask = XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID;
|
||||||
|
+
|
||||||
|
+ xcb_generic_error_t *e = NULL;
|
||||||
|
+ xcb_res_query_client_ids_cookie_t c = xcb_res_query_client_ids(xcon, 1, &spec);
|
||||||
|
+ xcb_res_query_client_ids_reply_t *r = xcb_res_query_client_ids_reply(xcon, c, &e);
|
||||||
|
+
|
||||||
|
+ if (!r)
|
||||||
|
+ return (pid_t)0;
|
||||||
|
+
|
||||||
|
+ xcb_res_client_id_value_iterator_t i = xcb_res_query_client_ids_ids_iterator(r);
|
||||||
|
+ for (; i.rem; xcb_res_client_id_value_next(&i)) {
|
||||||
|
+ spec = i.data->spec;
|
||||||
|
+ if (spec.mask & XCB_RES_CLIENT_ID_MASK_LOCAL_CLIENT_PID) {
|
||||||
|
+ uint32_t *t = xcb_res_client_id_value_value(i.data);
|
||||||
|
+ result = *t;
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(r);
|
||||||
|
+
|
||||||
|
+ if (result == (pid_t)-1)
|
||||||
|
+ result = 0;
|
||||||
|
+
|
||||||
|
+#endif /* __linux__ */
|
||||||
|
+
|
||||||
|
+#ifdef __OpenBSD__
|
||||||
|
+ Atom type;
|
||||||
|
+ int format;
|
||||||
|
+ unsigned long len, bytes;
|
||||||
|
+ unsigned char *prop;
|
||||||
|
+ pid_t ret;
|
||||||
|
+
|
||||||
|
+ if (XGetWindowProperty(dpy, w, XInternAtom(dpy, "_NET_WM_PID", 0), 0, 1, False, AnyPropertyType, &type, &format, &len, &bytes, &prop) != Success || !prop)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ ret = *(pid_t*)prop;
|
||||||
|
+ XFree(prop);
|
||||||
|
+ result = ret;
|
||||||
|
+
|
||||||
|
+#endif /* __OpenBSD__ */
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+pid_t
|
||||||
|
+getparentprocess(pid_t p)
|
||||||
|
+{
|
||||||
|
+ unsigned int v = 0;
|
||||||
|
+
|
||||||
|
+#ifdef __linux__
|
||||||
|
+ FILE *f;
|
||||||
|
+ char buf[256];
|
||||||
|
+ snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
|
||||||
|
+
|
||||||
|
+ if (!(f = fopen(buf, "r")))
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ fscanf(f, "%*u %*s %*c %u", &v);
|
||||||
|
+ fclose(f);
|
||||||
|
+#endif /* __linux__*/
|
||||||
|
+
|
||||||
|
+#ifdef __OpenBSD__
|
||||||
|
+ int n;
|
||||||
|
+ kvm_t *kd;
|
||||||
|
+ struct kinfo_proc *kp;
|
||||||
|
+
|
||||||
|
+ kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, NULL);
|
||||||
|
+ if (!kd)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ kp = kvm_getprocs(kd, KERN_PROC_PID, p, sizeof(*kp), &n);
|
||||||
|
+ v = kp->p_ppid;
|
||||||
|
+#endif /* __OpenBSD__ */
|
||||||
|
+
|
||||||
|
+ return (pid_t)v;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+isdescprocess(pid_t p, pid_t c)
|
||||||
|
+{
|
||||||
|
+ while (p != c && c != 0)
|
||||||
|
+ c = getparentprocess(c);
|
||||||
|
+
|
||||||
|
+ return (int)c;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+termforwin(const Client *w)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ Monitor *m;
|
||||||
|
+
|
||||||
|
+ if (!w->pid || w->isterminal)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ for (m = mons; m; m = m->next) {
|
||||||
|
+ for (c = m->clients; c; c = c->next) {
|
||||||
|
+ if (c->isterminal && !c->swallowing && c->pid && isdescprocess(c->pid, w->pid))
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+Client *
|
||||||
|
+swallowingclient(Window w)
|
||||||
|
+{
|
||||||
|
+ Client *c;
|
||||||
|
+ Monitor *m;
|
||||||
|
+
|
||||||
|
+ for (m = mons; m; m = m->next) {
|
||||||
|
+ for (c = m->clients; c; c = c->next) {
|
||||||
|
+ if (c->swallowing && c->swallowing->win == w)
|
||||||
|
+ return c;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return NULL;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
Client *
|
||||||
|
wintoclient(Window w)
|
||||||
|
{
|
||||||
|
@@ -2138,10 +2359,12 @@ main(int argc, char *argv[])
|
||||||
|
fputs("warning: no locale support\n", stderr);
|
||||||
|
if (!(dpy = XOpenDisplay(NULL)))
|
||||||
|
die("dwm: cannot open display");
|
||||||
|
+ if (!(xcon = XGetXCBConnection(dpy)))
|
||||||
|
+ die("dwm: cannot get xcb connection\n");
|
||||||
|
checkotherwm();
|
||||||
|
setup();
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
- if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||||
|
+ if (pledge("stdio rpath proc exec ps", NULL) == -1)
|
||||||
|
die("pledge");
|
||||||
|
#endif /* __OpenBSD__ */
|
||||||
|
scan();
|
||||||
|
--
|
||||||
|
2.28.0
|
||||||
|
|
|
@ -0,0 +1,240 @@
|
||||||
|
From f30583c6e2ab5e7de6ef4ebf156076ac0f6e69fc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jack Bird <jack.bird@durham.ac.uk>
|
||||||
|
Date: Fri, 27 Aug 2021 00:53:14 +0100
|
||||||
|
Subject: [PATCH] xresources updated for 138b405
|
||||||
|
|
||||||
|
---
|
||||||
|
config.def.h | 61 ++++++++++++++++++++++++++++++--------------
|
||||||
|
drw.c | 2 +-
|
||||||
|
drw.h | 2 +-
|
||||||
|
dwm.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
4 files changed, 116 insertions(+), 21 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index a2ac963..87ac198 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -1,21 +1,23 @@
|
||||||
|
/* 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[] = { "monospace:size=10" };
|
||||||
|
-static const char dmenufont[] = "monospace:size=10";
|
||||||
|
-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 *colors[][3] = {
|
||||||
|
- /* fg bg border */
|
||||||
|
- [SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
|
||||||
|
- [SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||||
|
+static unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+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";
|
||||||
|
+static char normfgcolor[] = "#bbbbbb";
|
||||||
|
+static char selfgcolor[] = "#eeeeee";
|
||||||
|
+static char selbordercolor[] = "#005577";
|
||||||
|
+static char selbgcolor[] = "#005577";
|
||||||
|
+static char *colors[][3] = {
|
||||||
|
+ /* fg bg border */
|
||||||
|
+ [SchemeNorm] = { normfgcolor, normbgcolor, normbordercolor },
|
||||||
|
+ [SchemeSel] = { selfgcolor, selbgcolor, selbordercolor },
|
||||||
|
};
|
||||||
|
|
||||||
|
/* tagging */
|
||||||
|
@@ -32,9 +34,9 @@ static const Rule rules[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 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 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 const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
|
|
||||||
|
static const Layout layouts[] = {
|
||||||
|
@@ -57,9 +59,30 @@ 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", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
|
+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 };
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * Xresources preferences to load at startup
|
||||||
|
+ */
|
||||||
|
+ResourcePref resources[] = {
|
||||||
|
+ { "font", STRING, &font },
|
||||||
|
+ { "dmenufont", STRING, &dmenufont },
|
||||||
|
+ { "normbgcolor", STRING, &normbgcolor },
|
||||||
|
+ { "normbordercolor", STRING, &normbordercolor },
|
||||||
|
+ { "normfgcolor", STRING, &normfgcolor },
|
||||||
|
+ { "selbgcolor", STRING, &selbgcolor },
|
||||||
|
+ { "selbordercolor", STRING, &selbordercolor },
|
||||||
|
+ { "selfgcolor", STRING, &selfgcolor },
|
||||||
|
+ { "borderpx", INTEGER, &borderpx },
|
||||||
|
+ { "snap", INTEGER, &snap },
|
||||||
|
+ { "showbar", INTEGER, &showbar },
|
||||||
|
+ { "topbar", INTEGER, &topbar },
|
||||||
|
+ { "nmaster", INTEGER, &nmaster },
|
||||||
|
+ { "resizehints", INTEGER, &resizehints },
|
||||||
|
+ { "mfact", FLOAT, &mfact },
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
static Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
diff --git a/drw.c b/drw.c
|
||||||
|
index 4cdbcbe..8f1059e 100644
|
||||||
|
--- a/drw.c
|
||||||
|
+++ b/drw.c
|
||||||
|
@@ -208,7 +208,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
|
||||||
|
/* Wrapper to create color schemes. The caller has to call free(3) on the
|
||||||
|
* returned color scheme when done using it. */
|
||||||
|
Clr *
|
||||||
|
-drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount)
|
||||||
|
+drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount)
|
||||||
|
{
|
||||||
|
size_t i;
|
||||||
|
Clr *ret;
|
||||||
|
diff --git a/drw.h b/drw.h
|
||||||
|
index 4bcd5ad..42b04ce 100644
|
||||||
|
--- a/drw.h
|
||||||
|
+++ b/drw.h
|
||||||
|
@@ -39,7 +39,7 @@ void drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned in
|
||||||
|
|
||||||
|
/* Colorscheme abstraction */
|
||||||
|
void drw_clr_create(Drw *drw, Clr *dest, const char *clrname);
|
||||||
|
-Clr *drw_scm_create(Drw *drw, const char *clrnames[], size_t clrcount);
|
||||||
|
+Clr *drw_scm_create(Drw *drw, char *clrnames[], size_t clrcount);
|
||||||
|
|
||||||
|
/* Cursor abstraction */
|
||||||
|
Cur *drw_cur_create(Drw *drw, int shape);
|
||||||
|
diff --git a/dwm.c b/dwm.c
|
||||||
|
index 5e4d494..2214b19 100644
|
||||||
|
--- a/dwm.c
|
||||||
|
+++ b/dwm.c
|
||||||
|
@@ -36,6 +36,7 @@
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xproto.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
|
+#include <X11/Xresource.h>
|
||||||
|
#ifdef XINERAMA
|
||||||
|
#include <X11/extensions/Xinerama.h>
|
||||||
|
#endif /* XINERAMA */
|
||||||
|
@@ -141,6 +142,19 @@ typedef struct {
|
||||||
|
int monitor;
|
||||||
|
} Rule;
|
||||||
|
|
||||||
|
+/* Xresources preferences */
|
||||||
|
+enum resource_type {
|
||||||
|
+ STRING = 0,
|
||||||
|
+ INTEGER = 1,
|
||||||
|
+ FLOAT = 2
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+typedef struct {
|
||||||
|
+ char *name;
|
||||||
|
+ enum resource_type type;
|
||||||
|
+ void *dst;
|
||||||
|
+} ResourcePref;
|
||||||
|
+
|
||||||
|
/* function declarations */
|
||||||
|
static void applyrules(Client *c);
|
||||||
|
static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
|
||||||
|
@@ -234,6 +248,8 @@ static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
|
static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||||
|
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||||
|
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);
|
||||||
|
|
||||||
|
/* variables */
|
||||||
|
static const char broken[] = "broken";
|
||||||
|
@@ -2127,6 +2143,60 @@ zoom(const Arg *arg)
|
||||||
|
pop(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
+void
|
||||||
|
+resource_load(XrmDatabase db, char *name, enum resource_type rtype, void *dst)
|
||||||
|
+{
|
||||||
|
+ char *sdst = NULL;
|
||||||
|
+ int *idst = NULL;
|
||||||
|
+ float *fdst = NULL;
|
||||||
|
+
|
||||||
|
+ sdst = dst;
|
||||||
|
+ idst = dst;
|
||||||
|
+ fdst = dst;
|
||||||
|
+
|
||||||
|
+ char fullname[256];
|
||||||
|
+ char *type;
|
||||||
|
+ XrmValue ret;
|
||||||
|
+
|
||||||
|
+ snprintf(fullname, sizeof(fullname), "%s.%s", "dwm", name);
|
||||||
|
+ fullname[sizeof(fullname) - 1] = '\0';
|
||||||
|
+
|
||||||
|
+ XrmGetResource(db, fullname, "*", &type, &ret);
|
||||||
|
+ if (!(ret.addr == NULL || strncmp("String", type, 64)))
|
||||||
|
+ {
|
||||||
|
+ switch (rtype) {
|
||||||
|
+ case STRING:
|
||||||
|
+ strcpy(sdst, ret.addr);
|
||||||
|
+ break;
|
||||||
|
+ case INTEGER:
|
||||||
|
+ *idst = strtoul(ret.addr, NULL, 10);
|
||||||
|
+ break;
|
||||||
|
+ case FLOAT:
|
||||||
|
+ *fdst = strtof(ret.addr, NULL);
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+load_xresources(void)
|
||||||
|
+{
|
||||||
|
+ Display *display;
|
||||||
|
+ char *resm;
|
||||||
|
+ XrmDatabase db;
|
||||||
|
+ ResourcePref *p;
|
||||||
|
+
|
||||||
|
+ display = XOpenDisplay(NULL);
|
||||||
|
+ resm = XResourceManagerString(display);
|
||||||
|
+ if (!resm)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ db = XrmGetStringDatabase(resm);
|
||||||
|
+ for (p = resources; p < resources + LENGTH(resources); p++)
|
||||||
|
+ resource_load(db, p->name, p->type, p->dst);
|
||||||
|
+ XCloseDisplay(display);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int
|
||||||
|
main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
@@ -2139,6 +2209,8 @@ main(int argc, char *argv[])
|
||||||
|
if (!(dpy = XOpenDisplay(NULL)))
|
||||||
|
die("dwm: cannot open display");
|
||||||
|
checkotherwm();
|
||||||
|
+ XrmInitialize();
|
||||||
|
+ load_xresources();
|
||||||
|
setup();
|
||||||
|
#ifdef __OpenBSD__
|
||||||
|
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
|
@ -0,0 +1,354 @@
|
||||||
|
From 0ea912d5a5808003b572d4d9bc08f985bf1ab7ae Mon Sep 17 00:00:00 2001
|
||||||
|
From: David JULIEN <swytch@mailo.com>
|
||||||
|
Date: Sat, 23 Apr 2022 15:57:35 +0200
|
||||||
|
Subject: [PATCH] feat: personnal config
|
||||||
|
|
||||||
|
---
|
||||||
|
Makefile | 2 +-
|
||||||
|
config.def.h | 96 +++++++++++++++++++++++++++-------------------------
|
||||||
|
dwm.1 | 78 +++++++++++++++++++++---------------------
|
||||||
|
3 files changed, 89 insertions(+), 87 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 77bcbc0..c05dbdd 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -26,7 +26,7 @@ dwm: ${OBJ}
|
||||||
|
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||||
|
|
||||||
|
clean:
|
||||||
|
- rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||||
|
+ rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz config.h
|
||||||
|
|
||||||
|
dist: clean
|
||||||
|
mkdir -p dwm-${VERSION}
|
||||||
|
diff --git a/config.def.h b/config.def.h
|
||||||
|
index 5b00ea3..7aaece5 100644
|
||||||
|
--- a/config.def.h
|
||||||
|
+++ b/config.def.h
|
||||||
|
@@ -1,14 +1,15 @@
|
||||||
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
|
/* appearance */
|
||||||
|
-static unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
-static unsigned int gappx = 5; /* gaps between windows */
|
||||||
|
-static unsigned int snap = 32; /* snap pixel */
|
||||||
|
-static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
|
-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 unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
+static unsigned int gappx = 5; /* gaps between windows */
|
||||||
|
+static unsigned int snap = 32; /* snap pixel */
|
||||||
|
+static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
|
+static int showbar = 1; /* 0 means no bar */
|
||||||
|
+static int topbar = 1; /* 0 means bottom bar */
|
||||||
|
+static char font[] = "monospace:size=10";
|
||||||
|
+static char symbols[] = "monospace:size=10";
|
||||||
|
+static char dmenufont[] = "monospace:size=10";
|
||||||
|
static const char *fonts[] = { font };
|
||||||
|
static char normbgcolor[] = "#222222";
|
||||||
|
static char normbordercolor[] = "#444444";
|
||||||
|
@@ -31,10 +32,11 @@ static const Rule rules[] = {
|
||||||
|
* WM_NAME(STRING) = title
|
||||||
|
*/
|
||||||
|
/* class instance title tags mask iscentered isfloating isterminal noswallow monitor */
|
||||||
|
- { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 },
|
||||||
|
- { "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1, -1 },
|
||||||
|
- { "St", NULL, NULL, 0, 0, 0, 1, 0, -1 },
|
||||||
|
- { NULL, NULL, "Event Tester", 0, 0, 0, 0, 1, -1 }, /* xev */
|
||||||
|
+// { "Gimp", NULL, NULL, 0, 0, 1, 0, 0, -1 },
|
||||||
|
+// { "Firefox", NULL, NULL, 1 << 8, 0, 0, 0, -1, -1 },
|
||||||
|
+ { "St", NULL, NULL, 0, 0, 0, 1, -1, -1 },
|
||||||
|
+ { "floating",NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||||
|
+ { NULL, NULL, "Event Tester", 0, 0, 1, 0, 1, -1 }, /* xev */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
@@ -51,7 +53,7 @@ static const Layout layouts[] = {
|
||||||
|
};
|
||||||
|
|
||||||
|
/* 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} }, \
|
||||||
|
@@ -63,7 +65,7 @@ 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 *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-p", "run:", NULL };
|
||||||
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
|
/*
|
||||||
|
@@ -71,59 +73,61 @@ static const char *termcmd[] = { "st", NULL };
|
||||||
|
*/
|
||||||
|
ResourcePref resources[] = {
|
||||||
|
{ "font", STRING, &font },
|
||||||
|
+ { "symbols", STRING, &symbols },
|
||||||
|
{ "dmenufont", STRING, &dmenufont },
|
||||||
|
- { "normbgcolor", STRING, &normbgcolor },
|
||||||
|
- { "normbordercolor", STRING, &normbordercolor },
|
||||||
|
- { "normfgcolor", STRING, &normfgcolor },
|
||||||
|
- { "selbgcolor", STRING, &selbgcolor },
|
||||||
|
- { "selbordercolor", STRING, &selbordercolor },
|
||||||
|
- { "selfgcolor", STRING, &selfgcolor },
|
||||||
|
+ { "background", STRING, &normbgcolor },
|
||||||
|
+ { "background", STRING, &normbordercolor },
|
||||||
|
+ { "normforeground", STRING, &normfgcolor },
|
||||||
|
+ { "selbackground", STRING, &selbgcolor },
|
||||||
|
+ { "color2", STRING, &selbordercolor },
|
||||||
|
+ { "selforeground", STRING, &selfgcolor },
|
||||||
|
{ "borderpx", INTEGER, &borderpx },
|
||||||
|
- { "snap", INTEGER, &snap },
|
||||||
|
- { "showbar", INTEGER, &showbar },
|
||||||
|
- { "topbar", INTEGER, &topbar },
|
||||||
|
- { "nmaster", INTEGER, &nmaster },
|
||||||
|
- { "resizehints", INTEGER, &resizehints },
|
||||||
|
- { "mfact", FLOAT, &mfact },
|
||||||
|
+ { "gappx", INTEGER, &gappx },
|
||||||
|
+ { "snap", INTEGER, &snap },
|
||||||
|
+ { "showbar", INTEGER, &showbar },
|
||||||
|
+ { "topbar", INTEGER, &topbar },
|
||||||
|
+ { "nmaster", INTEGER, &nmaster },
|
||||||
|
+ { "resizehints", INTEGER, &resizehints },
|
||||||
|
+ { "mfact", FLOAT, &mfact },
|
||||||
|
};
|
||||||
|
|
||||||
|
static Key keys[] = {
|
||||||
|
/* modifier key function argument */
|
||||||
|
- { MODKEY, XK_p, spawn, {.v = dmenucmd } },
|
||||||
|
- { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
|
||||||
|
+ // { 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_o, incnmaster, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_i, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
- { MODKEY, XK_Return, zoom, {0} },
|
||||||
|
+ { MODKEY, XK_space, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
- { MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
+ { MODKEY, XK_q, 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, 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_agrave, view, {.ui = ~0 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_agrave, 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 } },
|
||||||
|
- { MODKEY, XK_minus, setgaps, {.i = -1 } },
|
||||||
|
- { MODKEY, XK_equal, setgaps, {.i = +1 } },
|
||||||
|
+ { MODKEY, XK_less, setgaps, {.i = -1 } },
|
||||||
|
+ { MODKEY|ShiftMask, XK_less, setgaps, {.i = +1 } },
|
||||||
|
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||||
|
- 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)
|
||||||
|
+ TAGKEYS( XK_ampersand, 0)
|
||||||
|
+ TAGKEYS( XK_eacute, 1)
|
||||||
|
+ TAGKEYS( XK_quotedbl, 2)
|
||||||
|
+ TAGKEYS( XK_apostrophe, 3)
|
||||||
|
+ TAGKEYS( XK_parenleft, 4)
|
||||||
|
+ TAGKEYS( XK_minus, 5)
|
||||||
|
+ TAGKEYS( XK_egrave, 6)
|
||||||
|
+ TAGKEYS( XK_underscore, 7)
|
||||||
|
+ TAGKEYS( XK_ccedilla, 8)
|
||||||
|
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/dwm.1 b/dwm.1
|
||||||
|
index 85b3438..230bf30 100644
|
||||||
|
--- a/dwm.1
|
||||||
|
+++ b/dwm.1
|
||||||
|
@@ -25,9 +25,7 @@ layout, the title of the focused window, and the text read from the root window
|
||||||
|
name property, if the screen is focused. A floating window is indicated with an
|
||||||
|
empty square and a maximised floating window is indicated with a filled square
|
||||||
|
before the windows title. The selected tags are indicated with a different
|
||||||
|
-color. The tags of the focused window are indicated with a filled square in the
|
||||||
|
-top left corner. The tags which are applied to one or more windows are
|
||||||
|
-indicated with an empty square in the top left corner.
|
||||||
|
+color.
|
||||||
|
.P
|
||||||
|
dwm draws a small border around windows to indicate the focus state.
|
||||||
|
.SH OPTIONS
|
||||||
|
@@ -49,118 +47,118 @@ label toggles between tiled and floating layout.
|
||||||
|
.B Button3
|
||||||
|
click on a tag label adds/removes all windows with that tag to/from the view.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Button1
|
||||||
|
+.B Mod4\-Button1
|
||||||
|
click on a tag label applies that tag to the focused window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Button3
|
||||||
|
+.B Mod4\-Button3
|
||||||
|
click on a tag label adds/removes that tag to/from the focused window.
|
||||||
|
.SS Keyboard commands
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-Return
|
||||||
|
+.B Mod4\-Shift\-Return
|
||||||
|
Start
|
||||||
|
.BR st(1).
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-p
|
||||||
|
+.B Mod4\-d
|
||||||
|
Spawn
|
||||||
|
.BR dmenu(1)
|
||||||
|
for launching other programs.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-,
|
||||||
|
+.B Mod4\-,
|
||||||
|
Focus previous screen, if any.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-.
|
||||||
|
+.B Mod4\-.
|
||||||
|
Focus next screen, if any.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-,
|
||||||
|
+.B Mod4\-Shift\-,
|
||||||
|
Send focused window to previous screen, if any.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-.
|
||||||
|
+.B Mod4\-Shift\-.
|
||||||
|
Send focused window to next screen, if any.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-b
|
||||||
|
+.B Mod4\-b
|
||||||
|
Toggles bar on and off.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-t
|
||||||
|
+.B Mod4\-t
|
||||||
|
Sets tiled layout.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-f
|
||||||
|
+.B Mod4\-f
|
||||||
|
Sets floating layout.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-m
|
||||||
|
+.B Mod4\-m
|
||||||
|
Sets monocle layout.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-space
|
||||||
|
-Toggles between current and previous layout.
|
||||||
|
+.\" .B Mod4\-space
|
||||||
|
+.\" Toggles between current and previous layout.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-j
|
||||||
|
+.B Mod4\-j
|
||||||
|
Focus next window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-k
|
||||||
|
+.B Mod4\-k
|
||||||
|
Focus previous window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-i
|
||||||
|
+.B Mod4\-o
|
||||||
|
Increase number of windows in master area.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-d
|
||||||
|
+.B Mod4\-i
|
||||||
|
Decrease number of windows in master area.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-l
|
||||||
|
+.B Mod4\-l
|
||||||
|
Increase master area size.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-h
|
||||||
|
+.B Mod4\-h
|
||||||
|
Decrease master area size.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Return
|
||||||
|
+.B Mod4\-space
|
||||||
|
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-c
|
||||||
|
+.B Mod4\-q
|
||||||
|
Close focused window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-space
|
||||||
|
+.B Mod4\-Shift\-space
|
||||||
|
Toggle focused window between tiled and floating state.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Tab
|
||||||
|
+.B Mod4\-Tab
|
||||||
|
Toggles to the previously selected tags.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-[1..n]
|
||||||
|
+.B Mod4\-Shift\-[1..n]
|
||||||
|
Apply nth tag to focused window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-0
|
||||||
|
+.B Mod4\-Shift\-0
|
||||||
|
Apply all tags to focused window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Control\-Shift\-[1..n]
|
||||||
|
+.B Mod4\-Control\-Shift\-[1..n]
|
||||||
|
Add/remove nth tag to/from focused window.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-[1..n]
|
||||||
|
+.B Mod4\-[1..n]
|
||||||
|
View all windows with nth tag.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-0
|
||||||
|
+.B Mod4\-0
|
||||||
|
View all windows with any tag.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Control\-[1..n]
|
||||||
|
+.B Mod4\-Control\-[1..n]
|
||||||
|
Add/remove all windows with nth tag to/from the view.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\--
|
||||||
|
+.B Mod4\-<
|
||||||
|
Decrease the gaps around windows.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-=
|
||||||
|
+.B Mod4\->
|
||||||
|
Increase the gaps around windows.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift-=
|
||||||
|
+.B Mod4\-Shift-=
|
||||||
|
Reset the gaps around windows to
|
||||||
|
.BR 0 .
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Shift\-q
|
||||||
|
+.B Mod4\-Shift\-q
|
||||||
|
Quit dwm.
|
||||||
|
.SS Mouse commands
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Button1
|
||||||
|
+.B Mod4\-Button1
|
||||||
|
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Button2
|
||||||
|
+.B Mod4\-Button2
|
||||||
|
Toggles focused window between floating and tiled state.
|
||||||
|
.TP
|
||||||
|
-.B Mod1\-Button3
|
||||||
|
+.B Mod4\-Button3
|
||||||
|
Resize focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||||
|
.SH CUSTOMIZATION
|
||||||
|
dwm is customized by creating a custom config.h and (re)compiling the source
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
23
util.c
23
util.c
|
@ -6,18 +6,9 @@
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
void *
|
|
||||||
ecalloc(size_t nmemb, size_t size)
|
|
||||||
{
|
|
||||||
void *p;
|
|
||||||
|
|
||||||
if (!(p = calloc(nmemb, size)))
|
|
||||||
die("calloc:");
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
die(const char *fmt, ...) {
|
die(const char *fmt, ...)
|
||||||
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
@ -33,3 +24,13 @@ die(const char *fmt, ...) {
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *
|
||||||
|
ecalloc(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
void *p;
|
||||||
|
|
||||||
|
if (!(p = calloc(nmemb, size)))
|
||||||
|
die("calloc:");
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue