Compare commits
19 Commits
Author | SHA1 | Date |
---|---|---|
David JULIEN | 0bc8adf77d | |
David JULIEN | 74962441df | |
David JULIEN | 7ec4c7f257 | |
David JULIEN | 4003db56b3 | |
David | 5737a571f7 | |
David | 1862e61846 | |
David | 0fcae098e8 | |
David | 926e456d74 | |
swytch | 2b430fd267 | |
swytch | 263182ac75 | |
swytch | e3628b783e | |
swytch | 7de0fb34aa | |
swytch | 047a2845be | |
swytch | 9c08b51e34 | |
swytch | fa2aa52e77 | |
swytch | ee18cbef48 | |
swytch | d13b8977b1 | |
swytch | dc31e57692 | |
swytch | 6b9ad72848 |
1
LICENSE
1
LICENSE
|
@ -17,7 +17,6 @@ MIT/X Consortium License
|
|||
© 2015-2016 Quentin Rameau <quinq@fifth.space>
|
||||
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
|
||||
© 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
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
|
|
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@ dwm: ${OBJ}
|
|||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz config.h
|
||||
rm -f dwm config.h ${OBJ} dwm-${VERSION}.tar.gz
|
||||
|
||||
dist: clean
|
||||
mkdir -p dwm-${VERSION}
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
Swy7ch' fork of dwm
|
||||
===================
|
||||
|
||||
This is my fork of suckless' dynamic window manager, [dwm](https://dwm.suckless.org/). It is tweaked to match my needs and come with just a few patches:
|
||||
|
||||
* [dwm-fullgaps](https://dwm.suckless.org/patches/fullgaps/)
|
||||
* [dwm-hide_vacant_tags](https://dwm.suckless.org/patches/hide_vacant_tags/)
|
||||
* [dwm-swallow](https://dwm.suckless.org/patches/swallow/)
|
||||
|
||||
That's it!
|
||||
----------
|
||||
|
||||
No need for anything else. I also changed the colors and the keybindings, along with setting particular tabs for particular apps. Enjoy!
|
||||
|
||||
---
|
||||
|
||||
dwm - dynamic window manager
|
||||
============================
|
||||
dwm is an extremely fast, small, and dynamic window manager for X.
|
78
config.def.h
78
config.def.h
|
@ -1,19 +1,15 @@
|
|||
/* See LICENSE file for copyright and license details. */
|
||||
|
||||
#define SESSION_FILE "/tmp/dwm-session"
|
||||
|
||||
/* appearance */
|
||||
static unsigned int borderpx = 1; /* border pixel of windows */
|
||||
static unsigned int gappx = 5; /* gaps between windows */
|
||||
static unsigned int borderpx = 3; /* border pixel of windows */
|
||||
static unsigned int snap = 32; /* snap pixel */
|
||||
static int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||
static const unsigned int gappx = 25; /* gaps between windows */
|
||||
static const 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 japan[] = "monospace:size=10";
|
||||
static char dmenufont[] = "monospace:size=10";
|
||||
static const char *fonts[] = { font, symbols, japan };
|
||||
static char font2[] = "monospace:size=10";
|
||||
static const char *fonts[] = { font, font2 };
|
||||
static char normbgcolor[] = "#222222";
|
||||
static char normbordercolor[] = "#444444";
|
||||
static char normfgcolor[] = "#bbbbbb";
|
||||
|
@ -28,27 +24,26 @@ static char *colors[][3] = {
|
|||
|
||||
/* tagging */
|
||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
||||
//static const char *tags[] = { "1 ", "2 ", "3 ", "4 ", "5 ", "6 ", "7 ", "8 ", "9 " };
|
||||
|
||||
static const Rule rules[] = {
|
||||
/* xprop(1):
|
||||
* WM_CLASS(STRING) = instance, class
|
||||
* 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, -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 */
|
||||
};
|
||||
/* class instance title tags mask isfloating iscentered isterminal noswallow monitor */
|
||||
{ "firefox", NULL, NULL, 0, 0, 0, 0, -1, -1 },
|
||||
{ "st", NULL, NULL, 0, 0, 0, 1, -1, -1 },
|
||||
{ "floating", NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||
{ "ncmpcpp", NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||
{ "neomutt", NULL, NULL, 0, 1, 1, 1, -1, -1 },
|
||||
{ "transmission", NULL,NULL, 0, 1, 1, 1, -1, -1 },
|
||||
{ NULL, NULL, "Event Tester", 0, 1, 0, 0, 1, -1 }, /* xev */};
|
||||
|
||||
/* layout(s) */
|
||||
static float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||
static int nmaster = 1; /* number of clients in master area */
|
||||
static int resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||
|
||||
static const Layout layouts[] = {
|
||||
/* symbol arrange function */
|
||||
|
@ -58,7 +53,7 @@ static const Layout layouts[] = {
|
|||
};
|
||||
|
||||
/* key definitions */
|
||||
#define MODKEY Mod4Mask
|
||||
#define MODKEY Mod4Mask /* SUPER */
|
||||
#define TAGKEYS(KEY,TAG) \
|
||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
|
||||
|
@ -78,29 +73,27 @@ static const char *termcmd[] = { "st", NULL };
|
|||
*/
|
||||
ResourcePref resources[] = {
|
||||
{ "font", STRING, &font },
|
||||
{ "symbols", STRING, &symbols },
|
||||
{ "japan", STRING, &japan },
|
||||
{ "dmenufont", STRING, &dmenufont },
|
||||
{ "symbols", STRING, &font2 },
|
||||
{ "dmenufont", STRING, &font },
|
||||
{ "background", STRING, &normbgcolor },
|
||||
{ "normforeground", STRING, &normbordercolor },
|
||||
{ "background", STRING, &normbordercolor },
|
||||
{ "normforeground", STRING, &normfgcolor },
|
||||
{ "selbackground", STRING, &selbgcolor },
|
||||
{ "selborder", STRING, &selbordercolor },
|
||||
{ "color2", 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 },
|
||||
{ "snap", INTEGER, &snap },
|
||||
{ "showbar", INTEGER, &showbar },
|
||||
{ "topbar", INTEGER, &topbar },
|
||||
{ "nmaster", INTEGER, &nmaster },
|
||||
{ "resizehints", INTEGER, &resizehints },
|
||||
{ "mfact", FLOAT, &mfact },
|
||||
};
|
||||
|
||||
static const Key keys[] = {
|
||||
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 } },
|
||||
|
@ -114,17 +107,17 @@ static const Key keys[] = {
|
|||
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
|
||||
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
|
||||
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
|
||||
// { MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
|
||||
//{ MODKEY, XK_space, setlayout, {0} },
|
||||
{ MODKEY|ControlMask, XK_space, togglefloating, {0} },
|
||||
{ MODKEY, XK_agrave, view, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_agrave, tag, {.ui = ~0 } },
|
||||
{ MODKEY|ShiftMask, XK_a, 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_less, setgaps, {.i = -1 } },
|
||||
{ MODKEY|ShiftMask, XK_less, setgaps, {.i = +1 } },
|
||||
{ MODKEY|ShiftMask, XK_equal, setgaps, {.i = 0 } },
|
||||
{ MODKEY, XK_less, setgaps, {.i = -5 } },
|
||||
{ MODKEY|ShiftMask, XK_less, setgaps, {.i = +5 } },
|
||||
{ MODKEY, XK_equal, setgaps, {.i = 0 } },
|
||||
TAGKEYS( XK_ampersand, 0)
|
||||
TAGKEYS( XK_eacute, 1)
|
||||
TAGKEYS( XK_quotedbl, 2)
|
||||
|
@ -135,12 +128,11 @@ static const Key keys[] = {
|
|||
TAGKEYS( XK_underscore, 7)
|
||||
TAGKEYS( XK_ccedilla, 8)
|
||||
{ MODKEY|ShiftMask, XK_q, quit, {0} },
|
||||
{ MODKEY|Mod1Mask, XK_q, quit, {1} },
|
||||
};
|
||||
|
||||
/* button definitions */
|
||||
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
|
||||
static const Button buttons[] = {
|
||||
static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# dwm version
|
||||
VERSION = 6.4
|
||||
VERSION = 6.2
|
||||
|
||||
# Customize below to fit your system
|
||||
|
||||
|
@ -19,12 +19,10 @@ FREETYPELIBS = -lfontconfig -lXft
|
|||
FREETYPEINC = /usr/include/freetype2
|
||||
# OpenBSD (uncomment)
|
||||
#FREETYPEINC = ${X11INC}/freetype2
|
||||
#KVMLIB = -lkvm
|
||||
#MANPREFIX = ${PREFIX}/man
|
||||
|
||||
# includes and libs
|
||||
INCS = -I${X11INC} -I${FREETYPEINC}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res ${KVMLIB}
|
||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res
|
||||
|
||||
# flags
|
||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||
|
|
106
drw.c
106
drw.c
|
@ -133,6 +133,19 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
|
|||
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->xfont = xfont;
|
||||
font->pattern = pattern;
|
||||
|
@ -238,10 +251,12 @@ drw_rect(Drw *drw, int x, int y, unsigned int w, unsigned int h, int filled, int
|
|||
int
|
||||
drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lpad, const char *text, int invert)
|
||||
{
|
||||
int i, ty, ellipsis_x = 0;
|
||||
unsigned int tmpw, ew, ellipsis_w = 0, ellipsis_len;
|
||||
char buf[1024];
|
||||
int ty;
|
||||
unsigned int ew;
|
||||
XftDraw *d = NULL;
|
||||
Fnt *usedfont, *curfont, *nextfont;
|
||||
size_t i, len;
|
||||
int utf8strlen, utf8charlen, render = x || y || w || h;
|
||||
long utf8codepoint = 0;
|
||||
const char *utf8str;
|
||||
|
@ -249,17 +264,13 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
FcPattern *fcpattern;
|
||||
FcPattern *match;
|
||||
XftResult result;
|
||||
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;
|
||||
int charexists = 0;
|
||||
|
||||
if (!drw || (render && (!drw->scheme || !w)) || !text || !drw->fonts)
|
||||
if (!drw || (render && !drw->scheme) || !text || !drw->fonts)
|
||||
return 0;
|
||||
|
||||
if (!render) {
|
||||
w = invert ? invert : ~invert;
|
||||
w = ~w;
|
||||
} else {
|
||||
XSetForeground(drw->dpy, drw->gc, drw->scheme[invert ? ColFg : ColBg].pixel);
|
||||
XFillRectangle(drw->dpy, drw->drawable, drw->gc, x, y, w, h);
|
||||
|
@ -271,10 +282,8 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
}
|
||||
|
||||
usedfont = drw->fonts;
|
||||
if (!ellipsis_width && render)
|
||||
ellipsis_width = drw_fontset_getwidth(drw, "...");
|
||||
while (1) {
|
||||
ew = ellipsis_len = utf8strlen = 0;
|
||||
utf8strlen = 0;
|
||||
utf8str = text;
|
||||
nextfont = NULL;
|
||||
while (*text) {
|
||||
|
@ -282,27 +291,9 @@ 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) {
|
||||
charexists = charexists || XftCharExists(drw->dpy, curfont->xfont, utf8codepoint);
|
||||
if (charexists) {
|
||||
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) {
|
||||
if (curfont == usedfont) {
|
||||
utf8strlen += utf8charlen;
|
||||
text += utf8charlen;
|
||||
ew += tmpw;
|
||||
} else {
|
||||
nextfont = curfont;
|
||||
}
|
||||
|
@ -310,25 +301,36 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
}
|
||||
}
|
||||
|
||||
if (overflow || !charexists || nextfont)
|
||||
if (!charexists || nextfont)
|
||||
break;
|
||||
else
|
||||
charexists = 0;
|
||||
}
|
||||
|
||||
if (utf8strlen) {
|
||||
if (render) {
|
||||
ty = y + (h - usedfont->h) / 2 + usedfont->xfont->ascent;
|
||||
XftDrawStringUtf8(d, &drw->scheme[invert ? ColBg : ColFg],
|
||||
usedfont->xfont, x, ty, (XftChar8 *)utf8str, utf8strlen);
|
||||
}
|
||||
x += ew;
|
||||
w -= ew;
|
||||
}
|
||||
if (render && overflow)
|
||||
drw_text(drw, ellipsis_x, y, ellipsis_w, h, 0, "...", invert);
|
||||
drw_font_getexts(usedfont, utf8str, utf8strlen, &ew, NULL);
|
||||
/* shorten text if necessary */
|
||||
for (len = MIN(utf8strlen, sizeof(buf) - 1); len && ew > w; len--)
|
||||
drw_font_getexts(usedfont, utf8str, len, &ew, NULL);
|
||||
|
||||
if (!*text || overflow) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
if (!*text) {
|
||||
break;
|
||||
} else if (nextfont) {
|
||||
charexists = 0;
|
||||
|
@ -338,12 +340,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
* character must be drawn. */
|
||||
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();
|
||||
FcCharSetAddChar(fccharset, utf8codepoint);
|
||||
|
||||
|
@ -355,6 +351,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
fcpattern = FcPatternDuplicate(drw->fonts->pattern);
|
||||
FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
|
||||
FcPatternAddBool(fcpattern, FC_SCALABLE, FcTrue);
|
||||
FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
|
||||
|
||||
FcConfigSubstitute(NULL, fcpattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(fcpattern);
|
||||
|
@ -371,8 +368,6 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
|
|||
curfont->next = usedfont;
|
||||
} else {
|
||||
xfont_free(usedfont);
|
||||
nomatches.codepoint[++nomatches.idx % nomatches_len] = utf8codepoint;
|
||||
no_match:
|
||||
usedfont = drw->fonts;
|
||||
}
|
||||
}
|
||||
|
@ -402,15 +397,6 @@ drw_fontset_getwidth(Drw *drw, const char *text)
|
|||
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
|
||||
drw_font_getexts(Fnt *font, const char *text, unsigned int len, unsigned int *w, unsigned int *h)
|
||||
{
|
||||
|
|
1
drw.h
1
drw.h
|
@ -35,7 +35,6 @@ void drw_free(Drw *drw);
|
|||
Fnt *drw_fontset_create(Drw* drw, const char *fonts[], size_t fontcount);
|
||||
void drw_fontset_free(Fnt* set);
|
||||
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);
|
||||
|
||||
/* Colorscheme abstraction */
|
||||
|
|
115
dwm.1
115
dwm.1
|
@ -1,6 +1,6 @@
|
|||
.TH DWM 1 dwm\-VERSION
|
||||
.SH NAME
|
||||
dwm \- dynamic window manager
|
||||
dwm \- dynamic window manager (swy7ch' build)
|
||||
.SH SYNOPSIS
|
||||
.B dwm
|
||||
.RB [ \-v ]
|
||||
|
@ -20,14 +20,23 @@ layout applied.
|
|||
Windows are grouped by tags. Each window can be tagged with one or multiple
|
||||
tags. Selecting certain tags displays all windows with these tags.
|
||||
.P
|
||||
Each screen contains a small status bar which displays all available tags, the
|
||||
Each screen contains a small status bar which displays all used tags, the
|
||||
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.
|
||||
.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. Gaps are added around windows.
|
||||
.P
|
||||
.B !!! ATTENTION !!!
|
||||
My [swy7ch] keyboard being an AZERTY layout, numbers are not sent by the keys
|
||||
of the special characters row (one needs to press
|
||||
.B Shift
|
||||
to get them); instead, those special characters are sent:
|
||||
please check
|
||||
.B config[.def].h
|
||||
to change the keybindings
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-v
|
||||
|
@ -47,132 +56,122 @@ 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 Mod4\-Button1
|
||||
.B SUPER\-Button1
|
||||
click on a tag label applies that tag to the focused window.
|
||||
.TP
|
||||
.B Mod4\-Button3
|
||||
.B SUPER\-Button3
|
||||
click on a tag label adds/removes that tag to/from the focused window.
|
||||
.SS Keyboard commands
|
||||
.\".TP
|
||||
.\".B SUPER\-Shift\-Return
|
||||
.\"Start
|
||||
.\".BR st(1).
|
||||
.\".TP
|
||||
.\".B SUPER\-p
|
||||
.\"Spawn
|
||||
.\".BR dmenu(1)
|
||||
.\"for launching other programs.
|
||||
.TP
|
||||
.B Mod4\-Shift\-Return
|
||||
Start
|
||||
.BR st(1).
|
||||
.TP
|
||||
.B Mod4\-d
|
||||
Spawn
|
||||
.BR dmenu(1)
|
||||
for launching other programs.
|
||||
.TP
|
||||
.B Mod4\-,
|
||||
.B SUPER\-,
|
||||
Focus previous screen, if any.
|
||||
.TP
|
||||
.B Mod4\-.
|
||||
.B SUPER\-.
|
||||
Focus next screen, if any.
|
||||
.TP
|
||||
.B Mod4\-Shift\-,
|
||||
.B SUPER\-Shift\-,
|
||||
Send focused window to previous screen, if any.
|
||||
.TP
|
||||
.B Mod4\-Shift\-.
|
||||
.B SUPER\-Shift\-.
|
||||
Send focused window to next screen, if any.
|
||||
.TP
|
||||
.B Mod4\-b
|
||||
.B SUPER\-b
|
||||
Toggles bar on and off.
|
||||
.TP
|
||||
.B Mod4\-t
|
||||
.B SUPER\-t
|
||||
Sets tiled layout.
|
||||
.TP
|
||||
.B Mod4\-f
|
||||
.B SUPER\-f
|
||||
Sets floating layout.
|
||||
.TP
|
||||
.B Mod4\-m
|
||||
.B SUPER\-m
|
||||
Sets monocle layout.
|
||||
.\".TP
|
||||
.\".B SUPER\-space
|
||||
.\"Toggles between current and previous layout.
|
||||
.TP
|
||||
.\" .B Mod4\-space
|
||||
.\" Toggles between current and previous layout.
|
||||
.TP
|
||||
.B Mod4\-j
|
||||
.B SUPER\-j
|
||||
Focus next window.
|
||||
.TP
|
||||
.B Mod4\-k
|
||||
.B SUPER\-k
|
||||
Focus previous window.
|
||||
.TP
|
||||
.B Mod4\-o
|
||||
.B SUPER\-o
|
||||
Increase number of windows in master area.
|
||||
.TP
|
||||
.B Mod4\-i
|
||||
.B SUPER\-i
|
||||
Decrease number of windows in master area.
|
||||
.TP
|
||||
.B Mod4\-l
|
||||
.B SUPER\-l
|
||||
Increase master area size.
|
||||
.TP
|
||||
.B Mod4\-h
|
||||
.B SUPER\-h
|
||||
Decrease master area size.
|
||||
.TP
|
||||
.B Mod4\-space
|
||||
.B SUPER\-space
|
||||
Zooms/cycles focused window to/from master area (tiled layouts only).
|
||||
.TP
|
||||
.B Mod4\-q
|
||||
.B SUPER\-q
|
||||
Close focused window.
|
||||
.TP
|
||||
.B Mod4\-Shift\-space
|
||||
.B SUPER\-Shift\-space
|
||||
Toggle focused window between tiled and floating state.
|
||||
.TP
|
||||
.B Mod4\-Tab
|
||||
.B SUPER\-Tab
|
||||
Toggles to the previously selected tags.
|
||||
.TP
|
||||
.B Mod4\-Shift\-[1..n]
|
||||
.B SUPER\-Shift\-[1..n]
|
||||
Apply nth tag to focused window.
|
||||
.TP
|
||||
.B Mod4\-Shift\-0
|
||||
.B SUPER\-Shift\-0
|
||||
Apply all tags to focused window.
|
||||
.TP
|
||||
.B Mod4\-Control\-Shift\-[1..n]
|
||||
.B SUPER\-Control\-Shift\-[1..n]
|
||||
Add/remove nth tag to/from focused window.
|
||||
.TP
|
||||
.B Mod4\-[1..n]
|
||||
.B SUPER\-[1..n]
|
||||
View all windows with nth tag.
|
||||
.TP
|
||||
.B Mod4\-0
|
||||
.B SUPER\-0
|
||||
View all windows with any tag.
|
||||
.TP
|
||||
.B Mod4\-Control\-[1..n]
|
||||
.B SUPER\-Control\-[1..n]
|
||||
Add/remove all windows with nth tag to/from the view.
|
||||
.TP
|
||||
.B Mod4\-<
|
||||
.B SUPER\-<
|
||||
Decrease the gaps around windows.
|
||||
.TP
|
||||
.B Mod4\->
|
||||
.B SUPER\->
|
||||
Increase the gaps around windows.
|
||||
.TP
|
||||
.B Mod4\-Shift-=
|
||||
.B SUPER\-=
|
||||
Reset the gaps around windows to
|
||||
.BR 0 .
|
||||
.TP
|
||||
.B Mod4\-Shift\-q
|
||||
.B SUPER\-Shift\-q
|
||||
Quit dwm.
|
||||
.TP
|
||||
.B Mod4\-Mod1\-q
|
||||
Restart dwm.
|
||||
.SS Mouse commands
|
||||
.TP
|
||||
.B Mod4\-Button1
|
||||
.B SUPER\-Button1
|
||||
Move focused window while dragging. Tiled windows will be toggled to the floating state.
|
||||
.TP
|
||||
.B Mod4\-Button2
|
||||
.B SUPER\-Button2
|
||||
Toggles focused window between floating and tiled state.
|
||||
.TP
|
||||
.B Mod4\-Button3
|
||||
.B SUPER\-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
|
||||
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)
|
||||
|
|
369
dwm.c
369
dwm.c
|
@ -43,10 +43,6 @@
|
|||
#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"
|
||||
|
@ -56,8 +52,7 @@
|
|||
#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 ISVISIBLEONTAG(C, T) ((C->tags & T))
|
||||
#define ISVISIBLE(C) ISVISIBLEONTAG(C, C->mon->tagset[C->mon->seltags])
|
||||
#define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags]))
|
||||
#define LENGTH(X) (sizeof X / sizeof X[0])
|
||||
#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
|
||||
#define WIDTH(X) ((X)->w + 2 * (X)->bw)
|
||||
|
@ -97,7 +92,7 @@ struct Client {
|
|||
float mina, maxa;
|
||||
int x, y, w, h;
|
||||
int oldx, oldy, oldw, oldh;
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
int isfixed, iscentered, isfloating, isurgent, neverfocus, oldstate, isfullscreen, isterminal, noswallow;
|
||||
|
@ -174,7 +169,6 @@ 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);
|
||||
|
@ -212,9 +206,8 @@ 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 *c);
|
||||
static void pop(Client *);
|
||||
static void propertynotify(XEvent *e);
|
||||
static void quit(const Arg *arg);
|
||||
static Monitor *recttomon(int x, int y, int w, int h);
|
||||
|
@ -236,12 +229,10 @@ 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);
|
||||
static void tile(Monitor *m);
|
||||
static void tile(Monitor *);
|
||||
static void togglebar(const Arg *arg);
|
||||
static void togglefloating(const Arg *arg);
|
||||
static void toggletag(const Arg *arg);
|
||||
|
@ -278,9 +269,10 @@ static pid_t winpid(Window w);
|
|||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
static int scanner;
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh; /* bar height */
|
||||
static int bh, blw = 0; /* bar geometry */
|
||||
static int lrpad; /* sum of left and right padding for text */
|
||||
static int (*xerrorxlib)(Display *, XErrorEvent *);
|
||||
static unsigned int numlockmask = 0;
|
||||
|
@ -301,7 +293,6 @@ 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;
|
||||
|
@ -329,6 +320,7 @@ applyrules(Client *c)
|
|||
XClassHint ch = { NULL, NULL };
|
||||
|
||||
/* rule matching */
|
||||
c->noswallow = -1;
|
||||
c->iscentered = 0;
|
||||
c->isfloating = 0;
|
||||
c->tags = 0;
|
||||
|
@ -392,8 +384,6 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
|
|||
if (*w < bh)
|
||||
*w = bh;
|
||||
if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
|
||||
if (!c->hintsvalid)
|
||||
updatesizehints(c);
|
||||
/* see last two sentences in ICCCM 4.1.2.3 */
|
||||
baseismin = c->basew == c->minw && c->baseh == c->minh;
|
||||
if (!baseismin) { /* temporarily remove base dimensions */
|
||||
|
@ -456,17 +446,6 @@ 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)
|
||||
{
|
||||
|
@ -477,10 +456,11 @@ attachstack(Client *c)
|
|||
void
|
||||
swallow(Client *p, Client *c)
|
||||
{
|
||||
Client *s;
|
||||
|
||||
if (c->noswallow || c->isterminal)
|
||||
if (c->noswallow > 0 || c->isterminal)
|
||||
return;
|
||||
if (c->noswallow && !swallowfloating && c->isfloating)
|
||||
if (c->noswallow < 0 && !swallowfloating && c->isfloating)
|
||||
return;
|
||||
|
||||
detach(c);
|
||||
|
@ -495,8 +475,13 @@ swallow(Client *p, Client *c)
|
|||
Window w = p->win;
|
||||
p->win = c->win;
|
||||
c->win = w;
|
||||
|
||||
XChangeProperty(dpy, c->win, netatom[NetClientList], XA_WINDOW, 32, PropModeReplace,
|
||||
(unsigned char *) &(p->win), 1);
|
||||
|
||||
updatetitle(p);
|
||||
XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
|
||||
s = scanner ? c : p;
|
||||
XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w, s->h);
|
||||
arrange(p->mon);
|
||||
configure(p);
|
||||
updateclientlist();
|
||||
|
@ -510,6 +495,8 @@ unswallow(Client *c)
|
|||
free(c->swallowing);
|
||||
c->swallowing = NULL;
|
||||
|
||||
XDeleteProperty(dpy, c->win, netatom[NetClientList]);
|
||||
|
||||
/* unfullscreen the client */
|
||||
setfullscreen(c, 0);
|
||||
updatetitle(c);
|
||||
|
@ -524,7 +511,7 @@ unswallow(Client *c)
|
|||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
unsigned int i, x, click;
|
||||
unsigned int i, x, click, occ = 0;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
|
@ -539,11 +526,10 @@ buttonpress(XEvent *e)
|
|||
}
|
||||
if (ev->window == selmon->barwin) {
|
||||
i = x = 0;
|
||||
unsigned int occ = 0;
|
||||
for(c = m->clients; c; c=c->next)
|
||||
occ |= c->tags;
|
||||
for (c = m->clients; c; c = c->next)
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
do {
|
||||
/* Do not reserve space for vacant tags */
|
||||
/* do not reserve space for vacant tags */
|
||||
if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
continue;
|
||||
x += TEXTW(tags[i]);
|
||||
|
@ -551,7 +537,7 @@ buttonpress(XEvent *e)
|
|||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
} else if (ev->x < x + TEXTW(selmon->ltsymbol))
|
||||
} else if (ev->x < x + blw)
|
||||
click = ClkLtSymbol;
|
||||
else
|
||||
click = ClkStatusText;
|
||||
|
@ -598,7 +584,6 @@ cleanup(void)
|
|||
drw_cur_free(drw, cursor[i]);
|
||||
for (i = 0; i < LENGTH(colors); i++)
|
||||
free(scheme[i]);
|
||||
free(scheme);
|
||||
XDestroyWindow(dpy, wmcheckwin);
|
||||
drw_free(drw);
|
||||
XSync(dpy, False);
|
||||
|
@ -813,14 +798,9 @@ void
|
|||
drawbar(Monitor *m)
|
||||
{
|
||||
int x, w, tw = 0;
|
||||
int boxs = drw->fonts->h / 9;
|
||||
int boxw = drw->fonts->h / 6 + 2;
|
||||
unsigned int i, occ = 0, urg = 0;
|
||||
Client *c;
|
||||
|
||||
if (!m->showbar)
|
||||
return;
|
||||
|
||||
/* draw status first so it can be overdrawn by tags later */
|
||||
if (m == selmon) { /* status is only drawn on selected monitor */
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
|
@ -829,27 +809,28 @@ drawbar(Monitor *m)
|
|||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
occ |= c->tags;
|
||||
occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
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;
|
||||
/* 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);
|
||||
x += w;
|
||||
}
|
||||
w = TEXTW(m->ltsymbol);
|
||||
w = blw = TEXTW(m->ltsymbol);
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
x = drw_text(drw, x, 0, w, bh, lrpad / 2, m->ltsymbol, 0);
|
||||
|
||||
if ((w = m->ww - tw - x) > bh) {
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||
drw_rect(drw, x, 0, w, bh, 1, 1);
|
||||
}
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
|
@ -946,7 +927,7 @@ focusstack(const Arg *arg)
|
|||
{
|
||||
Client *c = NULL, *i;
|
||||
|
||||
if (!selmon->sel || (selmon->sel->isfullscreen && lockfullscreen))
|
||||
if (!selmon->sel)
|
||||
return;
|
||||
if (arg->i > 0) {
|
||||
for (c = selmon->sel->next; c && !ISVISIBLE(c); c = c->next);
|
||||
|
@ -1023,11 +1004,13 @@ gettextprop(Window w, Atom atom, char *text, unsigned int size)
|
|||
text[0] = '\0';
|
||||
if (!XGetTextProperty(dpy, w, &name, atom) || !name.nitems)
|
||||
return 0;
|
||||
if (name.encoding == XA_STRING) {
|
||||
if (name.encoding == XA_STRING)
|
||||
strncpy(text, (char *)name.value, size - 1);
|
||||
} else if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
|
||||
strncpy(text, *list, size - 1);
|
||||
XFreeStringList(list);
|
||||
else {
|
||||
if (XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success && n > 0 && *list) {
|
||||
strncpy(text, *list, size - 1);
|
||||
XFreeStringList(list);
|
||||
}
|
||||
}
|
||||
text[size - 1] = '\0';
|
||||
XFree(name.value);
|
||||
|
@ -1060,26 +1043,16 @@ grabkeys(void)
|
|||
{
|
||||
updatenumlockmask();
|
||||
{
|
||||
unsigned int i, j, k;
|
||||
unsigned int i, j;
|
||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||
int start, end, skip;
|
||||
KeySym *syms;
|
||||
KeyCode code;
|
||||
|
||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||
XDisplayKeycodes(dpy, &start, &end);
|
||||
syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip);
|
||||
if (!syms)
|
||||
return;
|
||||
for (k = start; k <= end; k++)
|
||||
for (i = 0; i < LENGTH(keys); i++)
|
||||
/* skip modifier codes, we do that ourselves */
|
||||
if (keys[i].keysym == syms[(k - start) * skip])
|
||||
for (j = 0; j < LENGTH(modifiers); j++)
|
||||
XGrabKey(dpy, k,
|
||||
keys[i].mod | modifiers[j],
|
||||
root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
XFree(syms);
|
||||
for (i = 0; i < LENGTH(keys); i++)
|
||||
if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
|
||||
for (j = 0; j < LENGTH(modifiers); j++)
|
||||
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
|
||||
True, GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1161,12 +1134,14 @@ manage(Window w, XWindowAttributes *wa)
|
|||
term = termforwin(c);
|
||||
}
|
||||
|
||||
if (c->x + WIDTH(c) > c->mon->wx + c->mon->ww)
|
||||
c->x = c->mon->wx + c->mon->ww - WIDTH(c);
|
||||
if (c->y + HEIGHT(c) > c->mon->wy + c->mon->wh)
|
||||
c->y = c->mon->wy + c->mon->wh - HEIGHT(c);
|
||||
c->x = MAX(c->x, c->mon->wx);
|
||||
c->y = MAX(c->y, c->mon->wy);
|
||||
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
|
||||
c->x = c->mon->mx + c->mon->mw - WIDTH(c);
|
||||
if (c->y + HEIGHT(c) > c->mon->my + c->mon->mh)
|
||||
c->y = c->mon->my + c->mon->mh - HEIGHT(c);
|
||||
c->x = MAX(c->x, c->mon->mx);
|
||||
/* only fix client y-offset, if the client center might cover the bar */
|
||||
c->y = MAX(c->y, ((c->mon->by == c->mon->my) && (c->x + (c->w / 2) >= c->mon->wx)
|
||||
&& (c->x + (c->w / 2) < c->mon->wx + c->mon->ww)) ? bh : c->mon->my);
|
||||
c->bw = borderpx;
|
||||
|
||||
wc.border_width = c->bw;
|
||||
|
@ -1186,7 +1161,7 @@ manage(Window w, XWindowAttributes *wa)
|
|||
c->isfloating = c->oldstate = trans != None || c->isfixed;
|
||||
if (c->isfloating)
|
||||
XRaiseWindow(dpy, c->win);
|
||||
attachaside(c);
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
XChangeProperty(dpy, root, netatom[NetClientList], XA_WINDOW, 32, PropModeAppend,
|
||||
(unsigned char *) &(c->win), 1);
|
||||
|
@ -1218,7 +1193,9 @@ maprequest(XEvent *e)
|
|||
static XWindowAttributes wa;
|
||||
XMapRequestEvent *ev = &e->xmaprequest;
|
||||
|
||||
if (!XGetWindowAttributes(dpy, ev->window, &wa) || wa.override_redirect)
|
||||
if (!XGetWindowAttributes(dpy, ev->window, &wa))
|
||||
return;
|
||||
if (wa.override_redirect)
|
||||
return;
|
||||
if (!wintoclient(ev->window))
|
||||
manage(ev->window, &wa);
|
||||
|
@ -1316,16 +1293,6 @@ 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)
|
||||
{
|
||||
|
@ -1362,7 +1329,7 @@ propertynotify(XEvent *e)
|
|||
arrange(c->mon);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
c->hintsvalid = 0;
|
||||
updatesizehints(c);
|
||||
break;
|
||||
case XA_WM_HINTS:
|
||||
updatewmhints(c);
|
||||
|
@ -1376,63 +1343,10 @@ 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 *
|
||||
|
@ -1466,14 +1380,6 @@ 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);
|
||||
|
@ -1575,7 +1481,9 @@ run(void)
|
|||
void
|
||||
scan(void)
|
||||
{
|
||||
scanner = 1;
|
||||
unsigned int i, num;
|
||||
char swin[256];
|
||||
Window d1, d2, *wins = NULL;
|
||||
XWindowAttributes wa;
|
||||
|
||||
|
@ -1586,6 +1494,8 @@ scan(void)
|
|||
continue;
|
||||
if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)
|
||||
manage(wins[i], &wa);
|
||||
else if (gettextprop(wins[i], netatom[NetClientList], swin, sizeof swin))
|
||||
manage(wins[i], &wa);
|
||||
}
|
||||
for (i = 0; i < num; i++) { /* now the transients */
|
||||
if (!XGetWindowAttributes(dpy, wins[i], &wa))
|
||||
|
@ -1597,6 +1507,7 @@ scan(void)
|
|||
if (wins)
|
||||
XFree(wins);
|
||||
}
|
||||
scanner = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1609,7 +1520,7 @@ sendmon(Client *c, Monitor *m)
|
|||
detachstack(c);
|
||||
c->mon = m;
|
||||
c->tags = m->tagset[m->seltags]; /* assign tags of target monitor */
|
||||
attachaside(c);
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
focus(NULL);
|
||||
arrange(NULL);
|
||||
|
@ -1738,9 +1649,6 @@ setup(void)
|
|||
/* clean up any zombies immediately */
|
||||
sigchld(0);
|
||||
|
||||
signal(SIGHUP, sighup);
|
||||
signal(SIGTERM, sigterm);
|
||||
|
||||
/* init screen */
|
||||
screen = DefaultScreen(dpy);
|
||||
sw = DisplayWidth(dpy, screen);
|
||||
|
@ -1801,6 +1709,7 @@ setup(void)
|
|||
focus(NULL);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
seturgent(Client *c, int urg)
|
||||
{
|
||||
|
@ -1840,20 +1749,6 @@ sigchld(int unused)
|
|||
while (0 < waitpid(-1, NULL, WNOHANG));
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -1864,7 +1759,9 @@ spawn(const Arg *arg)
|
|||
close(ConnectionNumber(dpy));
|
||||
setsid();
|
||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
|
||||
fprintf(stderr, "dwm: execvp %s", ((char **)arg->v)[0]);
|
||||
perror(" failed");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2003,7 +1900,6 @@ unmanage(Client *c, int destroyed)
|
|||
wc.border_width = c->oldbw;
|
||||
XGrabServer(dpy); /* avoid race conditions */
|
||||
XSetErrorHandler(xerrordummy);
|
||||
XSelectInput(dpy, c->win, NoEventMask);
|
||||
XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
|
||||
setclientstate(c, WithdrawnState);
|
||||
|
@ -2104,42 +2000,42 @@ updategeom(void)
|
|||
memcpy(&unique[j++], &info[i], sizeof(XineramaScreenInfo));
|
||||
XFree(info);
|
||||
nn = j;
|
||||
|
||||
/* new monitors if nn > n */
|
||||
for (i = n; i < nn; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = createmon();
|
||||
else
|
||||
mons = createmon();
|
||||
}
|
||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
||||
if (i >= n
|
||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||
{
|
||||
dirty = 1;
|
||||
m->num = i;
|
||||
m->mx = m->wx = unique[i].x_org;
|
||||
m->my = m->wy = unique[i].y_org;
|
||||
m->mw = m->ww = unique[i].width;
|
||||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
if (n <= nn) { /* new monitors available */
|
||||
for (i = 0; i < (nn - n); i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
if (m)
|
||||
m->next = createmon();
|
||||
else
|
||||
mons = createmon();
|
||||
}
|
||||
/* removed monitors if n > nn */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
while ((c = m->clients)) {
|
||||
dirty = 1;
|
||||
m->clients = c->next;
|
||||
detachstack(c);
|
||||
c->mon = mons;
|
||||
attachaside(c);
|
||||
attachstack(c);
|
||||
for (i = 0, m = mons; i < nn && m; m = m->next, i++)
|
||||
if (i >= n
|
||||
|| unique[i].x_org != m->mx || unique[i].y_org != m->my
|
||||
|| unique[i].width != m->mw || unique[i].height != m->mh)
|
||||
{
|
||||
dirty = 1;
|
||||
m->num = i;
|
||||
m->mx = m->wx = unique[i].x_org;
|
||||
m->my = m->wy = unique[i].y_org;
|
||||
m->mw = m->ww = unique[i].width;
|
||||
m->mh = m->wh = unique[i].height;
|
||||
updatebarpos(m);
|
||||
}
|
||||
} else { /* less monitors available nn < n */
|
||||
for (i = nn; i < n; i++) {
|
||||
for (m = mons; m && m->next; m = m->next);
|
||||
while ((c = m->clients)) {
|
||||
dirty = 1;
|
||||
m->clients = c->next;
|
||||
detachstack(c);
|
||||
c->mon = mons;
|
||||
attach(c);
|
||||
attachstack(c);
|
||||
}
|
||||
if (m == selmon)
|
||||
selmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
if (m == selmon)
|
||||
selmon = mons;
|
||||
cleanupmon(m);
|
||||
}
|
||||
free(unique);
|
||||
} else
|
||||
|
@ -2218,7 +2114,6 @@ updatesizehints(Client *c)
|
|||
} else
|
||||
c->maxa = c->mina = 0.0;
|
||||
c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh);
|
||||
c->hintsvalid = 1;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2286,10 +2181,8 @@ view(const Arg *arg)
|
|||
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;
|
||||
|
@ -2315,24 +2208,6 @@ winpid(Window w)
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -2341,31 +2216,25 @@ getparentprocess(pid_t p)
|
|||
{
|
||||
unsigned int v = 0;
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
FILE *f;
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
|
||||
|
||||
if (!(f = fopen(buf, "r")))
|
||||
return 0;
|
||||
return (pid_t)0;
|
||||
|
||||
fscanf(f, "%*u %*s %*c %u", &v);
|
||||
if (fscanf(f, "%*u %*s %*c %u", (unsigned *)&v) != 1)
|
||||
v = (pid_t)0;
|
||||
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__ */
|
||||
#elif defined(__FreeBSD__)
|
||||
struct kinfo_proc *proc = kinfo_getproc(p);
|
||||
if (!proc)
|
||||
return (pid_t)0;
|
||||
|
||||
v = proc->ki_ppid;
|
||||
free(proc);
|
||||
#endif
|
||||
return (pid_t)v;
|
||||
}
|
||||
|
||||
|
@ -2484,10 +2353,12 @@ zoom(const Arg *arg)
|
|||
{
|
||||
Client *c = selmon->sel;
|
||||
|
||||
if (!selmon->lt[selmon->sellt]->arrange || !c || c->isfloating)
|
||||
return;
|
||||
if (c == nexttiled(selmon->clients) && !(c = nexttiled(c->next)))
|
||||
if (!selmon->lt[selmon->sellt]->arrange
|
||||
|| (selmon->sel && selmon->sel->isfloating))
|
||||
return;
|
||||
if (c == nexttiled(selmon->clients))
|
||||
if (!c || !(c = nexttiled(c->next)))
|
||||
return;
|
||||
pop(c);
|
||||
}
|
||||
|
||||
|
@ -2563,13 +2434,11 @@ main(int argc, char *argv[])
|
|||
load_xresources();
|
||||
setup();
|
||||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath proc exec ps", NULL) == -1)
|
||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||
die("pledge");
|
||||
#endif /* __OpenBSD__ */
|
||||
scan();
|
||||
restoreSession();
|
||||
run();
|
||||
if(restart) execvp(argv[0], argv);
|
||||
cleanup();
|
||||
XCloseDisplay(dpy);
|
||||
return EXIT_SUCCESS;
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,8 +1,7 @@
|
|||
From 7b7773458c072e4b24d6ea32d0364a8e402e4a43 Mon Sep 17 00:00:00 2001
|
||||
From 3833e813b101b84f380f7c10e33fe02a896f8c76 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
|
||||
Date: Mon, 4 May 2020 03:53:40 +0200
|
||||
Subject: [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
|
||||
|
@ -39,20 +38,20 @@ index 1c0b587..38d2f6c 100644
|
|||
TAGKEYS( XK_2, 1)
|
||||
TAGKEYS( XK_3, 2)
|
||||
diff --git a/dwm.1 b/dwm.1
|
||||
index 13b3729..0202d96 100644
|
||||
index 13b3729..445a697 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\--
|
||||
+.B Mod1\-<
|
||||
+Decrease the gaps around windows.
|
||||
+.TP
|
||||
+.B Mod1\-=
|
||||
+.B Mod1\->
|
||||
+Increase the gaps around windows.
|
||||
+.TP
|
||||
+.B Mod1\-Shift-=
|
||||
+.B Mod1\-=
|
||||
+Reset the gaps around windows to
|
||||
+.BR 0 .
|
||||
+.TP
|
|
@ -1,17 +1,25 @@
|
|||
diff --git a/dwm.c b/dwm.c
|
||||
index a96f33c..f2da729 100644
|
||||
index 4465af1..c4aa3de 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -432,9 +432,15 @@ buttonpress(XEvent *e)
|
||||
@@ -416,7 +416,7 @@ attachstack(Client *c)
|
||||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
- unsigned int i, x, click;
|
||||
+ unsigned int i, x, click, occ = 0;
|
||||
Arg arg = {0};
|
||||
Client *c;
|
||||
Monitor *m;
|
||||
@@ -431,9 +431,14 @@ 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;
|
||||
+ for (c = m->clients; c; c = c->next)
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
+ do {
|
||||
+ /* Do not reserve space for vacant tags */
|
||||
+ /* do not reserve space for vacant tags */
|
||||
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
|
||||
+ continue;
|
||||
x += TEXTW(tags[i]);
|
||||
|
@ -20,13 +28,21 @@ index a96f33c..f2da729 100644
|
|||
if (i < LENGTH(tags)) {
|
||||
click = ClkTagBar;
|
||||
arg.ui = 1 << i;
|
||||
@@ -719,13 +725,12 @@ drawbar(Monitor *m)
|
||||
@@ -709,19 +714,19 @@ drawbar(Monitor *m)
|
||||
}
|
||||
|
||||
for (c = m->clients; c; c = c->next) {
|
||||
- occ |= c->tags;
|
||||
+ occ |= c->tags == 255 ? 0 : c->tags;
|
||||
if (c->isurgent)
|
||||
urg |= c->tags;
|
||||
}
|
||||
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;
|
||||
+ /* 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);
|
|
@ -1,31 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
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#
|
||||
From 969dbbc548f16da5d94630e3d54e9c96c5296520 Mon Sep 17 00:00:00 2001
|
||||
From: Ryan Kes <alrayyes@gmail.com>
|
||||
Date: Thu, 28 Mar 2019 14:36:07 +0100
|
||||
Subject: [PATCH] dwm-notitle-6.2
|
||||
|
||||
---
|
||||
config.def.h | 1 -
|
||||
|
@ -9,10 +9,10 @@ Subject: [PATCH] notitle patch applied#
|
|||
2 files changed, 4 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a2ac963..eac20b4 100644
|
||||
index 1c0b587..19330cd 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -103,7 +103,6 @@ static Button buttons[] = {
|
||||
@@ -102,7 +102,6 @@ static Button buttons[] = {
|
||||
/* click event mask button function argument */
|
||||
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
|
||||
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
|
||||
|
@ -21,7 +21,7 @@ index a2ac963..eac20b4 100644
|
|||
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
|
||||
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 5e4d494..6cd9fb7 100644
|
||||
index 4465af1..bcf5cb1 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -64,8 +64,8 @@ enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
|
||||
|
@ -35,11 +35,11 @@ index 5e4d494..6cd9fb7 100644
|
|||
|
||||
typedef union {
|
||||
int i;
|
||||
@@ -440,10 +440,8 @@ buttonpress(XEvent *e)
|
||||
@@ -439,10 +439,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))
|
||||
- else if (ev->x > selmon->ww - TEXTW(stext))
|
||||
- click = ClkStatusText;
|
||||
else
|
||||
- click = ClkWinTitle;
|
||||
|
@ -47,10 +47,10 @@ index 5e4d494..6cd9fb7 100644
|
|||
} else if ((c = wintoclient(ev->window))) {
|
||||
focus(c);
|
||||
restack(selmon);
|
||||
@@ -730,15 +728,8 @@ drawbar(Monitor *m)
|
||||
@@ -729,15 +727,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 ((w = m->ww - sw - 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);
|
||||
|
@ -63,7 +63,7 @@ index 5e4d494..6cd9fb7 100644
|
|||
}
|
||||
drw_map(drw, m->barwin, 0, 0, m->ww, bh);
|
||||
}
|
||||
@@ -1236,11 +1227,8 @@ propertynotify(XEvent *e)
|
||||
@@ -1235,11 +1226,8 @@ propertynotify(XEvent *e)
|
||||
drawbars();
|
||||
break;
|
||||
}
|
||||
|
@ -77,5 +77,5 @@ index 5e4d494..6cd9fb7 100644
|
|||
updatewindowtype(c);
|
||||
}
|
||||
--
|
||||
2.32.0
|
||||
2.21.0
|
||||
|
|
@ -1,139 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
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
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
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
|
||||
From 7accbcf7db35995d4c26c5cd69338aafa6feb89a Mon Sep 17 00:00:00 2001
|
||||
From: wtl <wtl144000@gmail.com>
|
||||
Date: Fri, 22 May 2020 22:38:38 +0300
|
||||
Subject: [PATCH] swallow X windows from the terminal
|
||||
|
||||
---
|
||||
config.def.h | 9 +-
|
||||
config.mk | 3 +-
|
||||
dwm.c | 235 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
3 files changed, 237 insertions(+), 10 deletions(-)
|
||||
config.def.h | 9 ++-
|
||||
config.mk | 2 +-
|
||||
dwm.c | 218 +++++++++++++++++++++++++++++++++++++++++++++++++--
|
||||
3 files changed, 220 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 1c0b587..fe51476 100644
|
||||
index 1c0b587..4c0b25c 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -3,6 +3,7 @@
|
||||
|
@ -31,46 +31,38 @@ index 1c0b587..fe51476 100644
|
|||
+ /* 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 */
|
||||
+ { "st", NULL, NULL, 0, 0, 1, -1, -1 },
|
||||
+ { NULL, NULL, "Event Tester", 0, 1, 0, 1, -1 }, /* xev */
|
||||
};
|
||||
|
||||
/* layout(s) */
|
||||
diff --git a/config.mk b/config.mk
|
||||
index 7084c33..ff9e508 100644
|
||||
index 7084c33..b77641d 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
|
||||
@@ -22,7 +22,7 @@ FREETYPEINC = /usr/include/freetype2
|
||||
|
||||
# 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}
|
||||
+LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS} -lX11-xcb -lxcb -lxcb-res
|
||||
|
||||
# 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
|
||||
index 9fd0286..1befee4 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -40,6 +40,12 @@
|
||||
@@ -40,6 +40,8 @@
|
||||
#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 {
|
||||
@@ -92,9 +94,11 @@ struct Client {
|
||||
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
|
||||
int bw, oldbw;
|
||||
unsigned int tags;
|
||||
|
@ -83,7 +75,7 @@ index 664c527..0b20086 100644
|
|||
Monitor *mon;
|
||||
Window win;
|
||||
};
|
||||
@@ -138,6 +146,8 @@ typedef struct {
|
||||
@@ -138,6 +142,8 @@ typedef struct {
|
||||
const char *title;
|
||||
unsigned int tags;
|
||||
int isfloating;
|
||||
|
@ -92,7 +84,7 @@ index 664c527..0b20086 100644
|
|||
int monitor;
|
||||
} Rule;
|
||||
|
||||
@@ -235,6 +245,12 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
@@ -235,9 +241,16 @@ static int xerrordummy(Display *dpy, XErrorEvent *ee);
|
||||
static int xerrorstart(Display *dpy, XErrorEvent *ee);
|
||||
static void zoom(const Arg *arg);
|
||||
|
||||
|
@ -105,7 +97,11 @@ index 664c527..0b20086 100644
|
|||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static char stext[256];
|
||||
@@ -269,6 +285,8 @@ static Drw *drw;
|
||||
+static int scanner;
|
||||
static int screen;
|
||||
static int sw, sh; /* X display screen geometry width, height */
|
||||
static int bh, blw = 0; /* bar geometry */
|
||||
@@ -269,6 +282,8 @@ static Drw *drw;
|
||||
static Monitor *mons, *selmon;
|
||||
static Window root, wmcheckwin;
|
||||
|
||||
|
@ -114,7 +110,15 @@ index 664c527..0b20086 100644
|
|||
/* configuration, allows nested code to access above variables */
|
||||
#include "config.h"
|
||||
|
||||
@@ -298,6 +316,8 @@ applyrules(Client *c)
|
||||
@@ -286,6 +301,7 @@ applyrules(Client *c)
|
||||
XClassHint ch = { NULL, NULL };
|
||||
|
||||
/* rule matching */
|
||||
+ c->noswallow = -1;
|
||||
c->isfloating = 0;
|
||||
c->tags = 0;
|
||||
XGetClassHint(dpy, c->win, &ch);
|
||||
@@ -298,6 +314,8 @@ applyrules(Client *c)
|
||||
&& (!r->class || strstr(class, r->class))
|
||||
&& (!r->instance || strstr(instance, r->instance)))
|
||||
{
|
||||
|
@ -123,17 +127,18 @@ index 664c527..0b20086 100644
|
|||
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)
|
||||
@@ -414,6 +432,61 @@ attachstack(Client *c)
|
||||
c->mon->stack = c;
|
||||
}
|
||||
|
||||
+void
|
||||
+swallow(Client *p, Client *c)
|
||||
+{
|
||||
+ Client *s;
|
||||
+
|
||||
+ if (c->noswallow || c->isterminal)
|
||||
+ if (c->noswallow > 0 || c->isterminal)
|
||||
+ return;
|
||||
+ if (c->noswallow && !swallowfloating && c->isfloating)
|
||||
+ if (c->noswallow < 0 && !swallowfloating && c->isfloating)
|
||||
+ return;
|
||||
+
|
||||
+ detach(c);
|
||||
|
@ -148,8 +153,13 @@ index 664c527..0b20086 100644
|
|||
+ Window w = p->win;
|
||||
+ p->win = c->win;
|
||||
+ c->win = w;
|
||||
+
|
||||
+ XChangeProperty(dpy, c->win, netatom[NetClientList], XA_WINDOW, 32, PropModeReplace,
|
||||
+ (unsigned char *) &(p->win), 1);
|
||||
+
|
||||
+ updatetitle(p);
|
||||
+ XMoveResizeWindow(dpy, p->win, p->x, p->y, p->w, p->h);
|
||||
+ s = scanner ? c : p;
|
||||
+ XMoveResizeWindow(dpy, p->win, s->x, s->y, s->w, s->h);
|
||||
+ arrange(p->mon);
|
||||
+ configure(p);
|
||||
+ updateclientlist();
|
||||
|
@ -163,6 +173,8 @@ index 664c527..0b20086 100644
|
|||
+ free(c->swallowing);
|
||||
+ c->swallowing = NULL;
|
||||
+
|
||||
+ XDeleteProperty(dpy, c->win, netatom[NetClientList]);
|
||||
+
|
||||
+ /* unfullscreen the client */
|
||||
+ setfullscreen(c, 0);
|
||||
+ updatetitle(c);
|
||||
|
@ -177,7 +189,7 @@ index 664c527..0b20086 100644
|
|||
void
|
||||
buttonpress(XEvent *e)
|
||||
{
|
||||
@@ -653,6 +720,9 @@ destroynotify(XEvent *e)
|
||||
@@ -653,6 +726,9 @@ destroynotify(XEvent *e)
|
||||
|
||||
if ((c = wintoclient(ev->window)))
|
||||
unmanage(c, 1);
|
||||
|
@ -187,7 +199,7 @@ index 664c527..0b20086 100644
|
|||
}
|
||||
|
||||
void
|
||||
@@ -1018,12 +1088,13 @@ killclient(const Arg *arg)
|
||||
@@ -1018,12 +1094,13 @@ killclient(const Arg *arg)
|
||||
void
|
||||
manage(Window w, XWindowAttributes *wa)
|
||||
{
|
||||
|
@ -202,7 +214,7 @@ index 664c527..0b20086 100644
|
|||
/* geometry */
|
||||
c->x = c->oldx = wa->x;
|
||||
c->y = c->oldy = wa->y;
|
||||
@@ -1038,6 +1109,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||
@@ -1038,6 +1115,7 @@ manage(Window w, XWindowAttributes *wa)
|
||||
} else {
|
||||
c->mon = selmon;
|
||||
applyrules(c);
|
||||
|
@ -210,7 +222,7 @@ index 664c527..0b20086 100644
|
|||
}
|
||||
|
||||
if (c->x + WIDTH(c) > c->mon->mx + c->mon->mw)
|
||||
@@ -1074,6 +1146,8 @@ manage(Window w, XWindowAttributes *wa)
|
||||
@@ -1074,6 +1152,8 @@ manage(Window w, XWindowAttributes *wa)
|
||||
c->mon->sel = c;
|
||||
arrange(c->mon);
|
||||
XMapWindow(dpy, c->win);
|
||||
|
@ -219,7 +231,34 @@ index 664c527..0b20086 100644
|
|||
focus(NULL);
|
||||
}
|
||||
|
||||
@@ -1768,6 +1842,20 @@ unmanage(Client *c, int destroyed)
|
||||
@@ -1384,7 +1464,9 @@ run(void)
|
||||
void
|
||||
scan(void)
|
||||
{
|
||||
+ scanner = 1;
|
||||
unsigned int i, num;
|
||||
+ char swin[256];
|
||||
Window d1, d2, *wins = NULL;
|
||||
XWindowAttributes wa;
|
||||
|
||||
@@ -1395,6 +1477,8 @@ scan(void)
|
||||
continue;
|
||||
if (wa.map_state == IsViewable || getstate(wins[i]) == IconicState)
|
||||
manage(wins[i], &wa);
|
||||
+ else if (gettextprop(wins[i], netatom[NetClientList], swin, sizeof swin))
|
||||
+ manage(wins[i], &wa);
|
||||
}
|
||||
for (i = 0; i < num; i++) { /* now the transients */
|
||||
if (!XGetWindowAttributes(dpy, wins[i], &wa))
|
||||
@@ -1406,6 +1490,7 @@ scan(void)
|
||||
if (wins)
|
||||
XFree(wins);
|
||||
}
|
||||
+ scanner = 0;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -1768,6 +1853,20 @@ unmanage(Client *c, int destroyed)
|
||||
Monitor *m = c->mon;
|
||||
XWindowChanges wc;
|
||||
|
||||
|
@ -240,7 +279,7 @@ index 664c527..0b20086 100644
|
|||
detach(c);
|
||||
detachstack(c);
|
||||
if (!destroyed) {
|
||||
@@ -1782,9 +1870,12 @@ unmanage(Client *c, int destroyed)
|
||||
@@ -1782,9 +1881,12 @@ unmanage(Client *c, int destroyed)
|
||||
XUngrabServer(dpy);
|
||||
}
|
||||
free(c);
|
||||
|
@ -256,17 +295,15 @@ index 664c527..0b20086 100644
|
|||
}
|
||||
|
||||
void
|
||||
@@ -2047,6 +2138,136 @@ view(const Arg *arg)
|
||||
@@ -2047,6 +2149,110 @@ 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;
|
||||
|
@ -292,24 +329,6 @@ index 664c527..0b20086 100644
|
|||
+
|
||||
+ 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;
|
||||
+}
|
||||
+
|
||||
|
@ -318,31 +337,25 @@ index 664c527..0b20086 100644
|
|||
+{
|
||||
+ unsigned int v = 0;
|
||||
+
|
||||
+#ifdef __linux__
|
||||
+#if defined(__linux__)
|
||||
+ FILE *f;
|
||||
+ char buf[256];
|
||||
+ snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
|
||||
+
|
||||
+ if (!(f = fopen(buf, "r")))
|
||||
+ return 0;
|
||||
+ return (pid_t)0;
|
||||
+
|
||||
+ fscanf(f, "%*u %*s %*c %u", &v);
|
||||
+ if (fscanf(f, "%*u %*s %*c %u", (unsigned *)&v) != 1)
|
||||
+ v = (pid_t)0;
|
||||
+ 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__ */
|
||||
+#elif defined(__FreeBSD__)
|
||||
+ struct kinfo_proc *proc = kinfo_getproc(p);
|
||||
+ if (!proc)
|
||||
+ return (pid_t)0;
|
||||
+
|
||||
+ v = proc->ki_ppid;
|
||||
+ free(proc);
|
||||
+#endif
|
||||
+ return (pid_t)v;
|
||||
+}
|
||||
+
|
||||
|
@ -393,7 +406,7 @@ index 664c527..0b20086 100644
|
|||
Client *
|
||||
wintoclient(Window w)
|
||||
{
|
||||
@@ -2138,10 +2359,12 @@ main(int argc, char *argv[])
|
||||
@@ -2138,6 +2344,8 @@ main(int argc, char *argv[])
|
||||
fputs("warning: no locale support\n", stderr);
|
||||
if (!(dpy = XOpenDisplay(NULL)))
|
||||
die("dwm: cannot open display");
|
||||
|
@ -402,11 +415,6 @@ index 664c527..0b20086 100644
|
|||
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
|
||||
2.26.2
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
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
|
||||
From d28a26439326d7566a43459e1ef00b5b7c7f5b11 Mon Sep 17 00:00:00 2001
|
||||
From: David JULIEN <swy7ch@protonmail.com>
|
||||
Date: Sun, 14 Mar 2021 18:19:17 +0100
|
||||
Subject: [PATCH] [PATCH] feat: manage font through xrdb
|
||||
|
||||
add font management to the dwm-resources patch, enabling to manage fonts
|
||||
by sourcing $XRESOURCES
|
||||
---
|
||||
config.def.h | 61 ++++++++++++++++++++++++++++++--------------
|
||||
drw.c | 2 +-
|
||||
|
@ -11,7 +13,7 @@ Subject: [PATCH] xresources updated for 138b405
|
|||
4 files changed, 116 insertions(+), 21 deletions(-)
|
||||
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index a2ac963..87ac198 100644
|
||||
index 1c0b587..db7b7bb 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -1,21 +1,23 @@
|
||||
|
@ -63,10 +65,10 @@ index a2ac963..87ac198 100644
|
|||
+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[] = {
|
||||
/* symbol arrange function */
|
||||
@@ -56,9 +58,30 @@ static const Layout layouts[] = {
|
||||
|
||||
/* commands */
|
||||
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||
|
@ -125,7 +127,7 @@ index 4bcd5ad..42b04ce 100644
|
|||
/* Cursor abstraction */
|
||||
Cur *drw_cur_create(Drw *drw, int shape);
|
||||
diff --git a/dwm.c b/dwm.c
|
||||
index 5e4d494..2214b19 100644
|
||||
index 664c527..17bb21e 100644
|
||||
--- a/dwm.c
|
||||
+++ b/dwm.c
|
||||
@@ -36,6 +36,7 @@
|
||||
|
@ -236,5 +238,5 @@ index 5e4d494..2214b19 100644
|
|||
#ifdef __OpenBSD__
|
||||
if (pledge("stdio rpath proc exec", NULL) == -1)
|
||||
--
|
||||
2.33.0
|
||||
2.30.2
|
||||
|
|
@ -1,354 +0,0 @@
|
|||
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,9 +6,18 @@
|
|||
|
||||
#include "util.h"
|
||||
|
||||
void
|
||||
die(const char *fmt, ...)
|
||||
void *
|
||||
ecalloc(size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
if (!(p = calloc(nmemb, size)))
|
||||
die("calloc:");
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...) {
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
|
@ -24,13 +33,3 @@ die(const char *fmt, ...)
|
|||
|
||||
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