diff -up dwm-5.2/config.def.h dwm-5.2_new/config.def.h --- dwm-5.2/config.def.h 2008-09-09 21:46:17.000000000 +0200 +++ dwm-5.2_new/config.def.h 2008-10-31 13:52:44.000000000 +0100 @@ -1,12 +1,16 @@ /* See LICENSE file for copyright and license details. */ +/* my personal configuration */ + +#include "my_settings.h" + /* appearance */ -static const char font[] = "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*"; -static const char normbordercolor[] = "#cccccc"; -static const char normbgcolor[] = "#cccccc"; -static const char normfgcolor[] = "#000000"; -static const char selbordercolor[] = "#0066ff"; -static const char selbgcolor[] = "#0066ff"; +static const char font[] = "-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*"; +static const char normbordercolor[] = "#dddddd"; +static const char normbgcolor[] = "#eeddff"; +static const char normfgcolor[] = "#222222"; +static const char selbordercolor[] = "#ff0000"; +static const char selbgcolor[] = "#5555ff"; static const char selfgcolor[] = "#ffffff"; static unsigned int borderpx = 1; /* border pixel of windows */ static unsigned int snap = 32; /* snap pixel */ @@ -15,28 +19,56 @@ static Bool topbar = Tr static Bool readin = True; /* False means do not read stdin */ /* tagging */ -static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "gimp", "skype", "www" }; static unsigned int tagset[] = {1, 1}; /* after start, first tag is selected */ static Rule rules[] = { /* class instance title tags mask isfloating */ - { "Gimp", NULL, NULL, 0, True }, - { "Firefox", NULL, NULL, 1 << 8, True }, + { "Gimp", NULL, NULL, 1 << 6, True }, + { "Skype", NULL, NULL, 1 << 7, True }, + { "Firefox", NULL, NULL, 1 << 8, True }, + { "Firefox-bin", NULL, NULL, 1 << 8, True }, + { "Mozilla", NULL, NULL, 1 << 8, True }, + { "Mozilla-bin", NULL, NULL, 1 << 8, True }, + { "File-roller", NULL, NULL, 1 << 8, True }, + { "Amule", NULL, NULL, 0, True }, + { "amule", NULL, NULL, 0, True }, + { "MPlayer", NULL, NULL, 0, True }, + { "XMMS", NULL, NULL, 0, True }, + { "Acroread", NULL, NULL, 0, True }, + { "Adobe Reader", NULL, NULL, 0, True }, + { "Xpdf", NULL, NULL, 0, True }, + { "GV", NULL, NULL, 0, True }, + { "Xdvi", NULL, NULL, 0, True }, + { "DjView", NULL, NULL, 0, True }, + { "GQview", NULL, NULL, 0, True }, + { "ImageMagick", NULL, NULL, 0, True }, + { "pointless", NULL, NULL, 0, True }, + { "magicpoint", NULL, NULL, 0, True }, + { "asclock", NULL, NULL, 0, True }, + { "xmessage", NULL, NULL, 0, True }, + { "xmag", NULL, NULL, 0, True }, + { "root", NULL, NULL, 0, True }, + { "rxvt", NULL, NULL, 0, False }, + { "XTerm", NULL, NULL, 0, False }, }; /* layout(s) */ -static float mfact = 0.55; /* factor of master area size [0.05..0.95] */ +static float mfact = 0.60; /* factor of master area size [0.05..0.95] */ static Bool resizehints = True; /* False means respect size hints in tiled resizals */ static Layout layouts[] = { /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ + + /* first entry is default */ + { "-|=", tile2 }, { "><>", NULL }, /* no layout function means floating behavior */ + { "[]=", tile }, { "[M]", monocle }, }; /* key definitions */ -#define MODKEY Mod1Mask +/*#define MODKEY Mod1Mask*/ #define TAGKEYS(KEY,TAG) \ { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ @@ -44,27 +76,36 @@ static Layout layouts[] = { { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ -#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } +#define SHCMD(cmd) { .v = (const char*[]){ "/bin/bash", "-c", cmd, NULL } } /* commands */ static const char *dmenucmd[] = { "dmenu_run", "-fn", font, "-nb", normbgcolor, "-nf", normfgcolor, "-sb", selbgcolor, "-sf", selfgcolor, NULL }; -static const char *termcmd[] = { "uxterm", NULL }; +/*static const char *termcmd[] = { MY_FIRST_TERM, "-bg", "", NULL };*/ +/*static const char *scrsvrcmd[] = { "xscreensaver-command", "-lock", NULL };*/ +/*static const char *printcmd[] = { "print_dwm", "-root", NULL };*/ +/*static const char *killcmd[] = { "kill", "-9", "$session_pid", NULL };*/ static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY|ShiftMask, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_x, spawn, SHCMD(MY_FIRST_TERM) }, + { MODKEY|ShiftMask, XK_Return, spawn, SHCMD(MY_FIRST_TERM " -bg `choose_color.sh -d -r`") }, + { MODKEY|ShiftMask, XK_f, spawn, SHCMD("firefox") }, + { MODKEY|ShiftMask, XK_k, spawn, SHCMD("skype") }, { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, + { MODKEY, XK_Tab, focusstack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_Tab, focusstack, {.i = -1 } }, + { MODKEY, XK_Down, setmfact, {.f = -0.02} }, + { MODKEY, XK_Up, setmfact, {.f = +0.02} }, { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY|ControlMask, XK_Tab, view, {0} }, + { MODKEY, XK_Left, prevview, {0} }, + { MODKEY, XK_Right, nextview, {0} }, + { MODKEY, XK_c, killclient, {0} }, + { MODKEY, XK_h, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_v, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_m, setlayout, {.v = &layouts[3]} }, { MODKEY, XK_space, setlayout, {0} }, { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, { MODKEY, XK_0, view, {.ui = ~0 } }, @@ -78,7 +119,14 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { MODKEY, XK_Print, spawn, SHCMD("print_dwm") }, + { MODKEY|ShiftMask, XK_Print, spawn, SHCMD("print_dwm -root") }, + { MODKEY|ShiftMask, XK_w, spawn, SHCMD("my_load_background") }, + { MODKEY|ShiftMask, XK_Pause, spawn, SHCMD("xscreensaver-command -lock") }, + { MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("rotate") }, + { MODKEY|ShiftMask, XK_BackSpace, spawn, SHCMD("kill_dwm") }, + { MODKEY|ShiftMask, XK_r, restart, {0} }, + { MODKEY|ShiftMask, XK_q, quit, SHCMD("quit_dwm") }, }; /* button definitions */ @@ -89,7 +137,7 @@ static Button buttons[] = { { ClkLtSymbol, 0, Button1, setlayout, {0} }, { ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} }, { ClkWinTitle, 0, Button2, zoom, {0} }, - { ClkStatusText, 0, Button2, spawn, {.v = termcmd } }, + { ClkStatusText, 0, Button2, spawn, SHCMD(MY_FIRST_TERM) }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff -up dwm-5.2/config.mk dwm-5.2_new/config.mk --- dwm-5.2/config.mk 2008-09-09 21:46:17.000000000 +0200 +++ dwm-5.2_new/config.mk 2008-10-31 13:52:44.000000000 +0100 @@ -1,18 +1,24 @@ # dwm version -VERSION = 5.2 +VERSION = 5.2.mt +# Previous stable version +PRECVER = 4.7.mt # Customize below to fit your system +# PLACE = {_INFIS_, _ROOM214_, _HOME_, _DEFAULT_} + +PLACE=_INFIS_ +#PLACE=_ROOM214_ # paths -PREFIX = /usr/local +PREFIX = ${HOME}/.usr/ MANPREFIX = ${PREFIX}/share/man -X11INC = /usr/X11R6/include +X11INC = /usr/include/X11 X11LIB = /usr/X11R6/lib # Xinerama, comment if you don't want it -XINERAMALIBS = -L${X11LIB} -lXinerama -XINERAMAFLAGS = -DXINERAMA +#XINERAMALIBS = -L${X11LIB} -lXinerama +#XINERAMAFLAGS = -DXINERAMA # includes and libs INCS = -I. -I/usr/include -I${X11INC} @@ -28,4 +34,4 @@ LDFLAGS = -s ${LIBS} #LDFLAGS = ${LIBS} # compiler and linker -CC = cc +CC = gcc diff -up dwm-5.2/dwm.c dwm-5.2_new/dwm.c --- dwm-5.2/dwm.c 2008-09-09 21:46:17.000000000 +0200 +++ dwm-5.2_new/dwm.c 2008-10-31 13:52:44.000000000 +0100 @@ -174,6 +174,7 @@ static void quit(const Arg *arg); static void resize(Client *c, int x, int y, int w, int h, Bool sizehints); static void resizemouse(const Arg *arg); static void restack(void); +static void restart(const Arg *arg); static void run(void); static void scan(void); static void setclientstate(Client *c, long state); @@ -185,6 +186,7 @@ static void spawn(const Arg *arg); static void tag(const Arg *arg); static int textnw(const char *text, unsigned int len); static void tile(void); +static void tile2(void); static void togglebar(const Arg *arg); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); @@ -203,6 +205,9 @@ static int xerrordummy(Display *dpy, XEr static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +static void nextview(const Arg *arg); /* switch view to next tag */ +static void prevview(const Arg *arg); /* switch view to prev tag */ + /* variables */ static char stext[256]; static int screen; @@ -229,6 +234,7 @@ static void (*handler[LASTEvent]) (XEven static Atom wmatom[WMLast], netatom[NetLast]; static Bool otherwm; static Bool running = True; +static Bool runningmore = False; static Client *clients = NULL; static Client *sel = NULL; static Client *stack = NULL; @@ -1025,6 +1031,19 @@ propertynotify(XEvent *e) { void quit(const Arg *arg) { + Client *c; + int i; + + for(i = 0, c = clients; c; c = c->next, i++); + if (i > 0) + spawn(arg); + else + readin = running = False; +} + +void +restart(const Arg *arg) { + runningmore = True; readin = running = False; } @@ -1271,6 +1290,9 @@ void setlayout(const Arg *arg) { if(!arg || !arg->v || arg->v != lt[sellt]) sellt ^= 1; + /*lt[sellt] = &layouts[(sellt + 1) % 4];*/ + /*lt[sellt] = &layouts[(++sellt) % 4];*/ + /*sellt = (sellt + 1) % 4;*/ if(arg && arg->v) lt[sellt] = (Layout *)arg->v; if(sel) @@ -1455,6 +1477,57 @@ tile(void) { } } + +void +tile2(void) { + int x, y, h, w, mw; + unsigned int i, n; + Client *c; + + for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + + /* master */ + if (n == 1){ + c = nexttiled(clients); + mw = mfact * ww; + /*resize(c, wx, wy, (n == 1 ? ww : mw) - 2 * c->bw, wh - 2 * c->bw, resizehints);*/ + resize(c, wx, wy, NOBORDER(n == 1 ? ww : mw), NOBORDER(wh), resizehints); + } else { + c = nexttiled(clients); + mw = mfact * ww; + /*resize(c, wx, wy, (n == 2 ? ww : mw) - 2 * c->bw, wh/2 - 2 * c->bw, resizehints);*/ + resize(c, wx, wy, NOBORDER(n == 2 ? ww : mw), NOBORDER(wh/2), resizehints); + y = c->y + c->h + 2 * c->bw; + + c = nexttiled(c->next); + mw = mfact * ww; + /*resize(c, wx, y, (n == 2 ? ww : mw) - 2 * c->bw, wh/2 - 2 * c->bw, resizehints);*/ + resize(c, wx, y, NOBORDER(n == 2 ? ww : mw), NOBORDER(wh/2), resizehints); + + n--; + } + + if(--n == 0) + return; + + /* tile stack */ + x = (wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : wx + mw; + y = wy; + w = (wx + mw > c->x + c->w) ? wx + ww - x : ww - mw; + h = wh / n; + if(h < bh) + h = wh; + + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, NOBORDER(w), /* remainder */ ((i + 1 == n) + ? NOBORDER(wy + wh) - y : h), resizehints); + if(h != wh) + y = c->y + c->h + 2 * c->bw; + } +} + void togglebar(const Arg *arg) { showbar = !showbar; @@ -1718,6 +1791,37 @@ zoom(const Arg *arg) { arrange(); } +void +nextview(const Arg *arg) { + unsigned int mask; + + if (tagset[seltags] >= (1 << (LENGTH(tags)-1))) + mask = 1 & TAGMASK; + else + mask = (tagset[seltags] << 1) & TAGMASK; + + if(mask) { + tagset[seltags] = mask; + arrange(); + } +} + +void +prevview(const Arg *arg) { + unsigned int mask; + + if (tagset[seltags] <= 1) + mask = (1 << (LENGTH(tags) - 1)) & TAGMASK; + else + mask = (tagset[seltags] >> 1) & TAGMASK; + + if(mask) { + tagset[seltags] = mask; + arrange(); + } +} + + int main(int argc, char *argv[]) { if(argc == 2 && !strcmp("-v", argv[1])) @@ -1738,5 +1842,9 @@ main(int argc, char *argv[]) { cleanup(); XCloseDisplay(dpy); - return 0; -} + + if (runningmore) + return 0; + else + return 2; +} diff -up dwm-5.2/Makefile dwm-5.2_new/Makefile --- dwm-5.2/Makefile 2008-09-09 21:46:17.000000000 +0200 +++ dwm-5.2_new/Makefile 2008-10-31 13:52:44.000000000 +0100 @@ -8,24 +8,32 @@ OBJ = ${SRC:.c=.o} all: options dwm +help: + @echo "make : create dwm executable" + @echo "make install : install files in ${PREFIX}" + @echo "make options : show dwm build options" + @echo "make dist : create a .tar.gz package for this dwm version" + @echo "make clean : clean all temporary files and executable" + options: @echo dwm build options: + @echo "CC = ${CC}" + @echo "PLACE = -D${PLACE}" @echo "CFLAGS = ${CFLAGS}" @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" .c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< + @echo ${CC} $< + @${CC} -c ${CFLAGS} -D${PLACE} $< -${OBJ}: config.h config.mk +${OBJ}: config.h config.mk my_settings.h config.h: @echo creating $@ from config.def.h @cp config.def.h $@ dwm: ${OBJ} - @echo CC -o $@ + @echo ${CC} -o $@ @${CC} -o $@ ${OBJ} ${LDFLAGS} clean: @@ -36,16 +44,20 @@ dist: clean @echo creating dist tarball @mkdir -p dwm-${VERSION} @cp -R LICENSE Makefile README config.def.h config.mk \ - dwm.1 ${SRC} dwm-${VERSION} + my_settings.h dwm.1 ${SRC} dwm-${VERSION} @tar -cf dwm-${VERSION}.tar dwm-${VERSION} @gzip dwm-${VERSION}.tar + @md5sum dwm-${VERSION}.tar.gz > dwm-${VERSION}.md5 @rm -rf dwm-${VERSION} install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin @mkdir -p ${DESTDIR}${PREFIX}/bin - @cp -f dwm ${DESTDIR}${PREFIX}/bin - @chmod 755 ${DESTDIR}${PREFIX}/bin/dwm + @cp -f dwm ${DESTDIR}${PREFIX}/bin/dwm-${VERSION} + @chmod 755 ${DESTDIR}${PREFIX}/bin/dwm-${VERSION} + @rm -f ${DESTDIR}${PREFIX}/bin/dwm + @ln -s dwm-${VERSION} ${DESTDIR}${PREFIX}/bin/dwm + @echo @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 @mkdir -p ${DESTDIR}${MANPREFIX}/man1 @sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1 @@ -53,8 +65,7 @@ install: all uninstall: @echo removing executable file from ${DESTDIR}${PREFIX}/bin - @rm -f ${DESTDIR}${PREFIX}/bin/dwm - @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 - @rm -f ${DESTDIR}${MANPREFIX}/man1/dwm.1 + @rm -f ${DESTDIR}${PREFIX}/bin/dwm ${DESTDIR}${PREFIX}/bin/dwm-${VERSION} + @if [ -f ${DESTDIR}${PREFIX}/bin/dwm-${PRECVER} ]; then ln -s dwm-${PRECVER} ${DESTDIR}${PREFIX}/bin/dwm; echo "dwm-${PRECVER} ripristinated"; else echo removing manual page from ${DESTDIR}${MANPREFIX}/man1; rm -f ${DESTDIR}${MANPREFIX}/man1/dwm.1; fi -.PHONY: all options clean dist install uninstall +.PHONY: all help options clean dist install uninstall Only in dwm-5.2_new/: my_settings.h