Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Commit 4f396fd

Browse files
committed
first commit
0 parents  commit 4f396fd

27 files changed

+6531
-0
lines changed

LICENSE

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
MIT/X Consortium License
2+
3+
© 2006-2019 Anselm R Garbe <anselm@garbe.ca>
4+
© 2006-2009 Jukka Salmi <jukka at salmi dot ch>
5+
© 2006-2007 Sander van Dijk <a dot h dot vandijk at gmail dot com>
6+
© 2007-2011 Peter Hartlich <sgkkr at hartlich dot com>
7+
© 2007-2009 Szabolcs Nagy <nszabolcs at gmail dot com>
8+
© 2007-2009 Christof Musik <christof at sendfax dot de>
9+
© 2007-2009 Premysl Hruby <dfenze at gmail dot com>
10+
© 2007-2008 Enno Gottox Boland <gottox at s01 dot de>
11+
© 2008 Martin Hurton <martin dot hurton at gmail dot com>
12+
© 2008 Neale Pickett <neale dot woozle dot org>
13+
© 2009 Mate Nagy <mnagy at port70 dot net>
14+
© 2010-2016 Hiltjo Posthuma <hiltjo@codemadness.org>
15+
© 2010-2012 Connor Lane Smith <cls@lubutu.com>
16+
© 2011 Christoph Lohmann <20h@r-36.net>
17+
© 2015-2016 Quentin Rameau <quinq@fifth.space>
18+
© 2015-2016 Eric Pruitt <eric.pruitt@gmail.com>
19+
© 2016-2017 Markus Teich <markus.teich@stusta.mhn.de>
20+
21+
Permission is hereby granted, free of charge, to any person obtaining a
22+
copy of this software and associated documentation files (the "Software"),
23+
to deal in the Software without restriction, including without limitation
24+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
25+
and/or sell copies of the Software, and to permit persons to whom the
26+
Software is furnished to do so, subject to the following conditions:
27+
28+
The above copyright notice and this permission notice shall be included in
29+
all copies or substantial portions of the Software.
30+
31+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
34+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
36+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
37+
DEALINGS IN THE SOFTWARE.

Makefile

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# dwm - dynamic window manager
2+
# See LICENSE file for copyright and license details.
3+
4+
include config.mk
5+
6+
SRC = drw.c dwm.c util.c
7+
OBJ = ${SRC:.c=.o}
8+
9+
all: options dwm
10+
11+
options:
12+
@echo dwm build options:
13+
@echo "CFLAGS = ${CFLAGS}"
14+
@echo "LDFLAGS = ${LDFLAGS}"
15+
@echo "CC = ${CC}"
16+
17+
.c.o:
18+
${CC} -c ${CFLAGS} $<
19+
20+
${OBJ}: config.h config.mk
21+
22+
config.h:
23+
cp config.def.h $@
24+
25+
dwm: ${OBJ}
26+
${CC} -o $@ ${OBJ} ${LDFLAGS}
27+
28+
clean:
29+
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
30+
31+
dist: clean
32+
mkdir -p dwm-${VERSION}
33+
cp -R LICENSE Makefile README config.def.h config.mk\
34+
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
35+
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
36+
gzip dwm-${VERSION}.tar
37+
rm -rf dwm-${VERSION}
38+
39+
install: all
40+
mkdir -p ${DESTDIR}${PREFIX}/bin
41+
cp -f dwm ${DESTDIR}${PREFIX}/bin
42+
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
43+
mkdir -p ${DESTDIR}${MANPREFIX}/man1
44+
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
45+
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
46+
47+
uninstall:
48+
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
49+
${DESTDIR}${MANPREFIX}/man1/dwm.1
50+
51+
.PHONY: all options clean dist install uninstall

README

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
dwm - dynamic window manager
2+
============================
3+
dwm is an extremely fast, small, and dynamic window manager for X.
4+
5+
6+
Requirements
7+
------------
8+
In order to build dwm you need the Xlib header files.
9+
10+
11+
Installation
12+
------------
13+
Edit config.mk to match your local setup (dwm is installed into
14+
the /usr/local namespace by default).
15+
16+
Afterwards enter the following command to build and install dwm (if
17+
necessary as root):
18+
19+
make clean install
20+
21+
22+
Running dwm
23+
-----------
24+
Add the following line to your .xinitrc to start dwm using startx:
25+
26+
exec dwm
27+
28+
In order to connect dwm to a specific display, make sure that
29+
the DISPLAY environment variable is set correctly, e.g.:
30+
31+
DISPLAY=foo.bar:1 exec dwm
32+
33+
(This will start dwm on display :1 of the host foo.bar.)
34+
35+
In order to display status info in the bar, you can do something
36+
like this in your .xinitrc:
37+
38+
while xsetroot -name "`date` `uptime | sed 's/.*,//'`"
39+
do
40+
sleep 1
41+
done &
42+
exec dwm
43+
44+
45+
Configuration
46+
-------------
47+
The configuration of dwm is done by creating a custom config.h
48+
and (re)compiling the source code.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
A DWM setup that looks & works fine but I think I could reduce idle RAM usage to <400MB.
2+
3+
Note to self: Remove patches I don't think I need anymore.

config.def.h

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
/* See LICENSE file for copyright and license details. */
2+
3+
/* appearance */
4+
static const unsigned int borderpx = 1; /* border pixel of windows */
5+
static const unsigned int snap = 32; /* snap pixel */
6+
static const int showbar = 1; /* 0 means no bar */
7+
static const int topbar = 1; /* 0 means bottom bar */
8+
static const Bool viewontag = True; /* Switch view on tag switch */
9+
static const char *fonts[] = { "monospace:size=10" };
10+
static const char dmenufont[] = "monospace:size=10";
11+
static const char col_gray1[] = "#222222";
12+
static const char col_gray2[] = "#444444";
13+
static const char col_gray3[] = "#bbbbbb";
14+
static const char col_gray4[] = "#eeeeee";
15+
static const char col_cyan[] = "#005577";
16+
static const char *colors[][3] = {
17+
/* fg bg border */
18+
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
19+
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
20+
};
21+
22+
/* tagging */
23+
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
24+
25+
static const Rule rules[] = {
26+
/* xprop(1):
27+
* WM_CLASS(STRING) = instance, class
28+
* WM_NAME(STRING) = title
29+
*/
30+
/* class instance title tags mask switchtotag isfloating monitor */
31+
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
32+
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
33+
};
34+
35+
/* layout(s) */
36+
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
37+
static const int nmaster = 1; /* number of clients in master area */
38+
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
39+
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
40+
41+
#include "fibonacci.c"
42+
static const Layout layouts[] = {
43+
/* symbol arrange function */
44+
{ "[]=", tile }, /* first entry is default */
45+
{ "><>", NULL }, /* no layout function means floating behavior */
46+
{ "[M]", monocle },
47+
{ "[@]", spiral },
48+
{ "[\\]", dwindle },
49+
};
50+
51+
/* key definitions */
52+
#define MODKEY Mod1Mask
53+
#define TAGKEYS(KEY,TAG) \
54+
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
55+
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
56+
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
57+
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
58+
59+
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
60+
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
61+
62+
/* commands */
63+
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
64+
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
65+
static const char *termcmd[] = { "st", NULL };
66+
67+
static Key keys[] = {
68+
/* modifier key function argument */
69+
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
70+
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
71+
{ MODKEY, XK_b, togglebar, {0} },
72+
{ MODKEY, XK_j, focusstack, {.i = +1 } },
73+
{ MODKEY, XK_k, focusstack, {.i = -1 } },
74+
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
75+
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
76+
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
77+
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
78+
{ MODKEY, XK_Return, zoom, {0} },
79+
{ MODKEY, XK_Tab, view, {0} },
80+
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
81+
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
82+
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
83+
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
84+
{ MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
85+
{ MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} },
86+
{ MODKEY, XK_space, setlayout, {0} },
87+
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
88+
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
89+
{ MODKEY, XK_0, view, {.ui = ~0 } },
90+
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
91+
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
92+
{ MODKEY, XK_period, focusmon, {.i = +1 } },
93+
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
94+
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
95+
TAGKEYS( XK_1, 0)
96+
TAGKEYS( XK_2, 1)
97+
TAGKEYS( XK_3, 2)
98+
TAGKEYS( XK_4, 3)
99+
TAGKEYS( XK_5, 4)
100+
TAGKEYS( XK_6, 5)
101+
TAGKEYS( XK_7, 6)
102+
TAGKEYS( XK_8, 7)
103+
TAGKEYS( XK_9, 8)
104+
{ MODKEY|ShiftMask, XK_q, quit, {0} },
105+
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} },
106+
};
107+
108+
/* button definitions */
109+
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
110+
static Button buttons[] = {
111+
/* click event mask button function argument */
112+
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
113+
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
114+
{ ClkWinTitle, 0, Button2, zoom, {0} },
115+
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
116+
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
117+
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
118+
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
119+
{ ClkTagBar, 0, Button1, view, {0} },
120+
{ ClkTagBar, 0, Button3, toggleview, {0} },
121+
{ ClkTagBar, MODKEY, Button1, tag, {0} },
122+
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
123+
};
124+

config.def.h.orig

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
/* See LICENSE file for copyright and license details. */
2+
3+
/* appearance */
4+
static const unsigned int borderpx = 1; /* border pixel of windows */
5+
static const unsigned int snap = 32; /* snap pixel */
6+
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
7+
static const int showbar = 1; /* 0 means no bar */
8+
static const int topbar = 1; /* 0 means bottom bar */
9+
static const Bool viewontag = True; /* Switch view on tag switch */
10+
static const char *fonts[] = { "monospace:size=10" };
11+
static const char dmenufont[] = "monospace:size=10";
12+
static const char col_gray1[] = "#222222";
13+
static const char col_gray2[] = "#444444";
14+
static const char col_gray3[] = "#bbbbbb";
15+
static const char col_gray4[] = "#eeeeee";
16+
static const char col_cyan[] = "#005577";
17+
static const char *colors[][3] = {
18+
/* fg bg border */
19+
[SchemeNorm] = { col_gray3, col_gray1, col_gray2 },
20+
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
21+
};
22+
23+
/* tagging */
24+
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
25+
26+
static const Rule rules[] = {
27+
/* xprop(1):
28+
* WM_CLASS(STRING) = instance, class
29+
* WM_NAME(STRING) = title
30+
*/
31+
/* class instance title tags mask switchtotag isfloating monitor */
32+
{ "Gimp", NULL, NULL, 0, 0, 1, -1 },
33+
{ "Firefox", NULL, NULL, 1 << 8, 0, 0, -1 },
34+
};
35+
36+
/* layout(s) */
37+
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
38+
static const int nmaster = 1; /* number of clients in master area */
39+
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
40+
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
41+
42+
#include "fibonacci.c"
43+
static const Layout layouts[] = {
44+
/* symbol arrange function */
45+
{ "[]=", tile }, /* first entry is default */
46+
{ "><>", NULL }, /* no layout function means floating behavior */
47+
{ "[M]", monocle },
48+
{ "[@]", spiral },
49+
{ "[\\]", dwindle },
50+
};
51+
52+
/* key definitions */
53+
#define MODKEY Mod1Mask
54+
#define TAGKEYS(KEY,TAG) \
55+
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
56+
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
57+
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
58+
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
59+
60+
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
61+
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
62+
63+
/* commands */
64+
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
65+
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
66+
static const char *termcmd[] = { "st", NULL };
67+
68+
static Key keys[] = {
69+
/* modifier key function argument */
70+
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
71+
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
72+
{ MODKEY, XK_b, togglebar, {0} },
73+
{ MODKEY, XK_j, focusstack, {.i = +1 } },
74+
{ MODKEY, XK_k, focusstack, {.i = -1 } },
75+
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
76+
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
77+
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
78+
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
79+
{ MODKEY, XK_Return, zoom, {0} },
80+
{ MODKEY, XK_Tab, view, {0} },
81+
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
82+
{ MODKEY, XK_t, setlayout, {.v = &layouts[0]} },
83+
{ MODKEY, XK_f, setlayout, {.v = &layouts[1]} },
84+
{ MODKEY, XK_m, setlayout, {.v = &layouts[2]} },
85+
{ MODKEY, XK_r, setlayout, {.v = &layouts[3]} },
86+
{ MODKEY|ShiftMask, XK_r, setlayout, {.v = &layouts[4]} },
87+
{ MODKEY, XK_space, setlayout, {0} },
88+
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
89+
{ MODKEY|ShiftMask, XK_f, togglefullscr, {0} },
90+
{ MODKEY, XK_0, view, {.ui = ~0 } },
91+
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
92+
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
93+
{ MODKEY, XK_period, focusmon, {.i = +1 } },
94+
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
95+
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
96+
TAGKEYS( XK_1, 0)
97+
TAGKEYS( XK_2, 1)
98+
TAGKEYS( XK_3, 2)
99+
TAGKEYS( XK_4, 3)
100+
TAGKEYS( XK_5, 4)
101+
TAGKEYS( XK_6, 5)
102+
TAGKEYS( XK_7, 6)
103+
TAGKEYS( XK_8, 7)
104+
TAGKEYS( XK_9, 8)
105+
{ MODKEY|ShiftMask, XK_q, quit, {0} },
106+
{ MODKEY|ControlMask|ShiftMask, XK_q, quit, {1} },
107+
};
108+
109+
/* button definitions */
110+
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
111+
static Button buttons[] = {
112+
/* click event mask button function argument */
113+
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
114+
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
115+
{ ClkWinTitle, 0, Button2, zoom, {0} },
116+
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
117+
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
118+
{ ClkClientWin, MODKEY, Button2, togglefloating, {0} },
119+
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
120+
{ ClkTagBar, 0, Button1, view, {0} },
121+
{ ClkTagBar, 0, Button3, toggleview, {0} },
122+
{ ClkTagBar, MODKEY, Button1, tag, {0} },
123+
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
124+
};
125+

0 commit comments

Comments
 (0)