diff -upP dwm-5.7.2/config.def.h dwm-5.7.2.mt/config.def.h --- dwm-5.7.2/config.def.h 2009-09-27 21:20:23.000000000 +0200 +++ dwm-5.7.2.mt/config.def.h 2010-01-11 15:50:14.000000000 +0100 @@ -1,40 +1,111 @@ /* See LICENSE file for copyright and license details. */ +/* my personal configuration */ +#include "my_settings.h" + /* appearance */ -static const char font[] = "-*-*-medium-*-*-*-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"; + +/* examples of fonts: + "-*-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*" + "-adobe-courier-medium-r-normal--14-100-100-100-m-90-iso8859-1" + "-adobe-courier-medium-r-normal--14-140-75-75-m-90-iso8859-1" + "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1" + "-adobe-courier-bold-r-normal--14-140-75-75-m-90-iso8859-1" + "-misc-fixed-medium-r-normal-*-14-*-*-*-*-*-iso8859-*" + "-misc-fixed-bold-r-normal-*-14-*-*-*-*-*-iso8859-*" + "7x14" + "7x14bold" + "8x13" + "9x15" + "9x15bold" + "10x20" + "fixed" +*/ +static const char font[] = "fixed"; +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 const unsigned int borderpx = 1; /* border pixel of windows */ -static const unsigned int snap = 32; /* snap pixel */ -static const Bool showbar = True; /* False means no bar */ -static const Bool topbar = True; /* False means bottom bar */ +static unsigned int borderpx = 1; /* border pixel of windows */ +static unsigned int snap = 32; /* snap pixel */ +static Bool showbar = True; /* False means no bar */ +static Bool topbar = True; /* False means bottom bar */ + +/*static Bool usegrab = False;*/ /* True means grabbing the X server + during mouse-based resizals */ /* tagging */ -static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" }; +/*static const char tags[][MAXTAGLEN] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "d", "g", "s", "w", "x" };*/ +static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "d", "e", "g", "s", "w", "x" }; + +/*static unsigned int tagset[] = {1, 1};*/ /* after start, first tag is selected */ -static const Rule rules[] = { - /* class instance title tags mask isfloating monitor */ - { "Gimp", NULL, NULL, 0, True, -1 }, - { "Firefox", NULL, NULL, 1 << 8, False, -1 }, +static Rule rules[] = { + /* class instance title tags mask isfloating monitor */ + { "Gimp", NULL, NULL, 1 << 11, True, -1 }, + { "Skype", NULL, NULL, 1 << 12, True, -1 }, + { "Firefox", NULL, NULL, 1 << 13, True, -1 }, + { "Firefox-bin", NULL, NULL, 1 << 13, True, -1 }, + { "Mozilla", NULL, NULL, 1 << 13, True, -1 }, + { "Mozilla-bin", NULL, NULL, 1 << 13, True, -1 }, + { "opera", NULL, NULL, 1 << 13, True, -1 }, + { "File-roller", NULL, NULL, 1 << 13, True, -1 }, + { "XMMS", NULL, NULL, 1 << 14, True, -1 }, + { "Xmms", NULL, NULL, 1 << 14, True, -1 }, + { "xmms", NULL, NULL, 1 << 14, True, -1 }, + { "Acroread", NULL, NULL, 0, True, -1 }, + { "Adobe Reader", NULL, NULL, 0, True, -1 }, + { "Amule", NULL, NULL, 0, True, -1 }, + { "amule", NULL, NULL, 0, True, -1 }, + { "asclock", NULL, NULL, 0, True, -1 }, + { "Aumix", NULL, NULL, 0, True, -1 }, + { "aumix", NULL, NULL, 0, True, -1 }, + { "Blender", NULL, NULL, 0, True, -1 }, + { "Conky", NULL, NULL, ~0, True, -1 }, + { "Display", NULL, NULL, 0, True, -1 }, + { "display", NULL, NULL, 0, True, -1 }, + { "DjView", NULL, NULL, 0, True, -1 }, + { "Fig", NULL, NULL, 0, True, -1 }, + { "Gnuplot", NULL, NULL, 0, True, -1 }, + { "GQview", NULL, NULL, 0, True, -1 }, + { "GV", NULL, NULL, 0, True, -1 }, + { "ImageMagick", NULL, NULL, 0, True, -1 }, + { "Kmix", NULL, NULL, 1 << 14, True, -1 }, + { "lt-djview", NULL, NULL, 0, True, -1 }, + { "magicpoint", NULL, NULL, 0, True, -1 }, + { "MPlayer", NULL, NULL, 0, True, -1 }, + { "pointless", NULL, NULL, 0, True, -1 }, + { "root", NULL, NULL, 0, True, -1 }, + { "Scribus", NULL, NULL, 1 << 9, True, -1 }, + { "Smplayer", NULL, NULL, 0, True, -1 }, + { "XBoard", NULL, NULL, 0, True, -1 }, + { "Xdvi", NULL, NULL, 0, True, -1 }, + { "XDvi", NULL, NULL, 0, True, -1 }, + { "Xpdf", NULL, NULL, 0, True, -1 }, + { "xmag", NULL, NULL, 0, True, -1 }, + { "xmessage", NULL, NULL, 0, True, -1 }, + { "Zenity", NULL, NULL, 0, True, -1 }, + { "rxvt", NULL, NULL, 0, False, -1 }, + { "XTerm", NULL, NULL, 0, False, -1 }, }; /* layout(s) */ -static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */ -static const Bool resizehints = True; /* True means respect size hints in tiled resizals */ +static float mfact = 0.60; /* factor of master area size [0.05..0.95] */ +static Bool resizehints = True; /* True means respect size hints in tiled resizals */ -static const Layout layouts[] = { +static Layout layouts[] = { /* symbol arrange function */ - { "[]=", tile }, /* first entry is default */ + /*{ "-|=", tile2 },*/ /* first entry is default */ + { "[]=", tile }, { "><>", NULL }, /* no layout function means floating behavior */ + { "-|=", tile2 }, { "[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} }, \ @@ -46,31 +117,45 @@ static const Layout layouts[] = { /* 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[] = { "uxterm", NULL };*/ static Key keys[] = { /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { MODKEY, XK_p, spawn, SHCMD("dmenu < " DMENU_LIST) }, + { MODKEY|ShiftMask, XK_p, spawn, {.v = dmenucmd } }, + { MODKEY|ShiftMask, XK_Return, spawn, SHCMD(MY_FIRST_TERM " -bg `choose_color.sh -d -r -l`") }, + { MODKEY|ShiftMask, XK_y, spawn, SHCMD(MY_FIRST_TERM " -bg black -fg white") }, + { MODKEY|ShiftMask, XK_u, spawn, SHCMD("uxterm") }, + { MODKEY|ShiftMask, XK_f, spawn, SHCMD("firefox") }, { 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|ControlMask, XK_Tab, focusstack, {.i = +1 } }, + { MODKEY|ShiftMask, XK_Tab, focusstack, {.i = -1 } },*/ + { MODKEY, XK_Down, focusstack, {.i = +1 } }, + { MODKEY, XK_Up, focusstack, {.i = -1 } }, + { MODKEY|ShiftMask, XK_Down, setmfact, {.f = -0.05} }, + { MODKEY|ShiftMask, XK_Up, setmfact, {.f = +0.05} }, { MODKEY, XK_Return, zoom, {0} }, { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { MODKEY|ShiftMask, XK_Tab, tag, {0} }, + { MODKEY, XK_Left, prevview, {0} }, + { MODKEY, XK_Right, nextview, {0} }, + { MODKEY|ShiftMask, XK_Left, prevtag, {0} }, + { MODKEY|ShiftMask, XK_Right, nexttag, {0} }, + { MODKEY, XK_c, killclient, {0} }, + { MODKEY, XK_v, setlayout, {.v = &layouts[0]} }, { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { MODKEY, XK_h, 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 } }, { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, +#ifdef XINERAMA { 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 } }, +#endif TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -80,7 +165,38 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + TAGKEYS( XK_d, 9) + TAGKEYS( XK_e, 10) + TAGKEYS( XK_g, 11) + TAGKEYS( XK_s, 12) + TAGKEYS( XK_w, 13) + TAGKEYS( XK_x, 14) +/* { MODKEY, 0x1008ff11, spawn, SHCMD("my_change_vol -") }, + { MODKEY, 0x1008ff13, spawn, SHCMD("my_change_vol +") },*/ + { 0, 0x1008ff11, spawn, SHCMD("my_change_vol -") }, + { 0, 0x1008ff13, spawn, SHCMD("my_change_vol +") }, + { 0, 0x1008ff12, spawn, SHCMD("my_change_vol m") }, + { MODKEY, XK_Print, spawn, SHCMD("dwm_print") }, + { MODKEY|ShiftMask, XK_Print, spawn, SHCMD("dwm_print -root") }, +/* { MODKEY, XK_Scroll_Lock, spawn, SHCMD("xrefresh") }, + { MODKEY|ShiftMask, XK_Scroll_Lock, spawn, SHCMD("my_load_background") },*/ + { MODKEY, XK_F1, spawn, SHCMD(SCRSVRCMD) }, + { MODKEY|ShiftMask, XK_F12, spawn, SHCMD("my_load_background") }, + { MODKEY|ShiftMask, XK_Pause, spawn, SHCMD(SCRSVRCMD) }, + { MODKEY|ShiftMask, XK_Escape, spawn, SHCMD("rotate_screen") }, + { MODKEY|ShiftMask, XK_BackSpace, spawn, SHCMD("dwm_kill") }, + { MODKEY|ShiftMask, XK_r, restart, {0} }, + { MODKEY, XK_r, quit, {0} }, + { MODKEY|ShiftMask, XK_q, quit, SHCMD("dwm_quit") }, + { MODKEY|ShiftMask, XK_a, quit, SHCMD("dwm_quit poweroff") }, + { MODKEY|ShiftMask, XK_z, quit, SHCMD("dwm_quit reboot") }, +/* { MODKEY, XK_q, quit, {0} }, + { MODKEY, XK_a, quit, {.v = (const char *[]){ "dwm_quit poweroff", NULL } } }, + { MODKEY, XK_z, quit, {.v = (const char *[]){ "dwm_quit reboot", NULL } } },*/ +/* { MODKEY|ShiftMask, XK_a, quit, {.v = (const char*[]){ "poweroff" } } }, + { MODKEY|ShiftMask, XK_z, quit, {.v = (const char*[]){ "reboot" } } },*/ +/* { MODKEY, XK_, spawn, SHCMD("my_change_vol +") }, + { MODKEY, XK_, spawn, SHCMD("my_change_vol -") }, */ }; /* button definitions */ @@ -90,7 +206,9 @@ 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, Button1, spawn, SHCMD("dwm_quit") }, + { ClkStatusText, 0, Button2, spawn, SHCMD(MY_FIRST_TERM) }, + { ClkStatusText, 0, Button3, spawn, SHCMD("conky -q -x 1000 -y 20") }, { ClkClientWin, MODKEY, Button1, movemouse, {0} }, { ClkClientWin, MODKEY, Button2, togglefloating, {0} }, { ClkClientWin, MODKEY, Button3, resizemouse, {0} }, diff -upP dwm-5.7.2/config.mk dwm-5.7.2.mt/config.mk --- dwm-5.7.2/config.mk 2009-09-27 21:20:23.000000000 +0200 +++ dwm-5.7.2.mt/config.mk 2009-10-28 18:24:45.000000000 +0100 @@ -1,18 +1,21 @@ # dwm version -VERSION = 5.7.2 +VERSION = 5.7.2.mt +PRECVER = 4.7.mt + # Customize below to fit your system +PLACE = _TRAVEL_ # paths -PREFIX = /usr/local +PREFIX = ${HOME}/.usr MANPREFIX = ${PREFIX}/share/man -X11INC = /usr/X11R6/include +X11INC = /usr/X11R6/include X11LIB = /usr/X11R6/lib # Xinerama, un-comment if you want it -XINERAMALIBS = -L${X11LIB} -lXinerama -XINERAMAFLAGS = -DXINERAMA +#XINERAMALIBS = -L${X11LIB} -lXinerama +#XINERAMAFLAGS = -DXINERAMA # includes and libs INCS = -I. -I/usr/include -I${X11INC} @@ -20,9 +23,7 @@ LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 # flags CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} -#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS} CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -#LDFLAGS = -g ${LIBS} LDFLAGS = -s ${LIBS} # Solaris @@ -30,4 +31,4 @@ LDFLAGS = -s ${LIBS} #LDFLAGS = ${LIBS} # compiler and linker -CC = cc +CC = gcc diff -upP dwm-5.7.2/dwm.c dwm-5.7.2.mt/dwm.c --- dwm-5.7.2/dwm.c 2009-09-27 21:20:23.000000000 +0200 +++ dwm-5.7.2.mt/dwm.c 2010-01-11 13:45:13.000000000 +0100 @@ -37,9 +37,13 @@ #include #include #ifdef XINERAMA -#include + #include #endif /* XINERAMA */ +#ifndef SRC_PATH + #define SRC_PATH "unknown" +#endif + /* macros */ #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) #define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) @@ -169,7 +173,9 @@ static void destroynotify(XEvent *e); static void detach(Client *c); static void detachstack(Client *c); static void die(const char *errstr, ...); -static Monitor *dirtomon(int dir); +#ifdef XINERAMA + static Monitor *dirtomon(int dir); +#endif static void drawbar(Monitor *m); static void drawbars(void); static void drawsquare(Bool filled, Bool empty, Bool invert, unsigned long col[ColLast]); @@ -178,7 +184,9 @@ static void enternotify(XEvent *e); static void expose(XEvent *e); static void focus(Client *c); static void focusin(XEvent *e); -static void focusmon(const Arg *arg); +#ifdef XINERAMA + static void focusmon(const Arg *arg); +#endif static void focusstack(const Arg *arg); static unsigned long getcolor(const char *colstr); static Bool getrootptr(int *x, int *y); @@ -213,7 +221,9 @@ static void showhide(Client *c); static void sigchld(int unused); static void spawn(const Arg *arg); static void tag(const Arg *arg); -static void tagmon(const Arg *arg); +#ifdef XINERAMA + static void tagmon(const Arg *arg); +#endif static int textnw(const char *text, unsigned int len); static void tile(Monitor *); static void togglebar(const Arg *arg); @@ -239,6 +249,15 @@ static int xerrordummy(Display *dpy, XEr static int xerrorstart(Display *dpy, XErrorEvent *ee); static void zoom(const Arg *arg); +/* my_patch functions */ +static void nextview(const Arg *arg); /* switch view to next tag */ +static void prevview(const Arg *arg); /* switch view to previous tag */ +static void nexttag(const Arg *arg); /* assign next tag to client */ +static void prevtag(const Arg *arg); /* assign previous tag to client */ +static void restart(const Arg *arg); /* force dwm to restart (modified exit status and xsession) */ +static void tile2(Monitor *); /* similar to tile but with 2 clients in the main window */ + + /* variables */ static const char broken[] = "broken"; static char stext[256]; @@ -270,6 +289,8 @@ static DC dc; static Monitor *mons = NULL, *selmon = NULL; static Window root; +int exitstatus = 2; + /* configuration, allows nested code to access above variables */ #include "config.h" @@ -286,7 +307,9 @@ applyrules(Client *c) { XClassHint ch = { 0 }; /* rule matching */ - c->isfloating = c->tags = 0; + /* c->isfloating = c->tags = 0; */ + c->isfloating = 1; /* default layout for a new window is floating */ + c->tags = 0; if(XGetClassHint(dpy, c->win, &ch)) { class = ch.res_class ? ch.res_class : broken; instance = ch.res_name ? ch.res_name : broken; @@ -659,6 +682,7 @@ die(const char *errstr, ...) { exit(EXIT_FAILURE); } +#ifdef XINERAMA Monitor * dirtomon(int dir) { Monitor *m = NULL; @@ -675,6 +699,7 @@ dirtomon(int dir) { } return m; } +#endif void drawbar(Monitor *m) { @@ -841,6 +866,7 @@ focusin(XEvent *e) { /* there are some b XSetInputFocus(dpy, selmon->sel->win, RevertToPointerRoot, CurrentTime); } +#ifdef XINERAMA void focusmon(const Arg *arg) { Monitor *m = NULL; @@ -852,6 +878,7 @@ focusmon(const Arg *arg) { selmon = m; focus(NULL); } +#endif void focusstack(const Arg *arg) { @@ -1290,9 +1317,55 @@ propertynotify(XEvent *e) { } } + +/* ------------------------------------------------------------------- + * Arg: i > 0 i == 0 + * ------------------------------------------------------------------- + * NULL (mai) esce (exitstatus 0) esce (exitstatus 2) + * dwm_quit esegue dwm_quit esce (exitstatus 2) + * dwm_quit reboot esegue dwm_quit reboot == + * dwm_quit poweroff esegue dwm_quit poweroff == + * dwm_quit suspend esegue dwm_quit suspend == + * ------------------------------------------------------------------- */ void quit(const Arg *arg) { - running = False; + Client *c; + Monitor *m; + int i = 0; + //int n; + + for (m = mons; m; m = m->next) + for(c = m->clients; c; c = c->next) + i++; + + if (arg && arg->v){ + //if (!strcmp(((char **)arg->v)[0], "dwm_quit")){ + //argvp = &(((char **) arg->v)[0]) + 2; + //if (argvp[0] != NULL && !strcmp(argvp[0], "dwm_quit")){ + //n = sizeof((char **)((*arg).v))/sizeof(((char **)((*arg).v))[0]); + //if (n >= 3 && !strcmp(((char **)arg->v)[2], "dwm_quit")){ + if (!strcmp(((char **)arg->v)[2], "dwm_quit")){ + if (i > 0){ + printf("dwm: Chiamata a quit con finestre aperte\n"); + spawn(arg); + } + else { + running = False; + exitstatus = 2; + return; + } + } else { + //printf("dwm: Chiamata irregolare a quit (%d argomenti)\n", n); + spawn(arg); + } + } else { + /* potrebbe essere usato al posto di restart */ + running = False; + if (i > 0) + exitstatus = 0; + else + exitstatus = 2; + } } void @@ -1564,18 +1637,28 @@ spawn(const Arg *arg) { void tag(const Arg *arg) { - if(selmon->sel && arg->ui & TAGMASK) { + /*if(selmon->sel && arg->ui & TAGMASK) { selmon->sel->tags = arg->ui & TAGMASK; arrange(selmon); + }*/ + if(selmon->sel){ + if (arg->ui & TAGMASK) + selmon->sel->tags = arg->ui & TAGMASK; + else + /*if (!arg)*/ + selmon->sel->tags = selmon->tagset[selmon->seltags ^ 1]; } + arrange(selmon); } +#ifdef XINERAMA void tagmon(const Arg *arg) { if(!selmon->sel || !mons->next) return; sendmon(selmon->sel, dirtomon(arg->i)); } +#endif int textnw(const char *text, unsigned int len) { @@ -1998,10 +2081,116 @@ zoom(const Arg *arg) { arrange(c->mon); } +void +restart(const Arg *arg) { + running = False; + exitstatus = 0; +} + +void +tile2(Monitor *m) { + int x, y, h, w, mw; + unsigned int i, n; + Client *c; + + for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++); + if(n == 0) + return; + /* master */ + c = nexttiled(m->clients); + mw = m->mfact * m->ww; + if (n == 1) { + resize(c, m->wx, m->wy, (n == 1 ? m->ww : mw) - 2 * c->bw, m->wh - 2 * c->bw, False); + } else { + resize(c, m->wx, m->wy, (n == 2 ? m->ww : mw) - 2 * c->bw, m->wh/2 - 2 * c->bw, False); + y = c->y + c->h + 2 * c->bw; + c = nexttiled(c->next); + mw = m->mfact * m->ww; /* inutile */ + resize(c, m->wx, y, (n == 2 ? m->ww : mw) - 2 * c->bw, m->wh/2 - 2 * c->bw, False); + n--; + } + if(--n == 0) + return; + /* tile stack */ + x = (m->wx + mw > c->x + c->w) ? c->x + c->w + 2 * c->bw : m->wx + mw; + y = m->wy; + w = (m->wx + mw > c->x + c->w) ? m->wx + m->ww - x : m->ww - mw; + h = m->wh / n; + if(h < bh) + h = m->wh; + for(i = 0, c = nexttiled(c->next); c; c = nexttiled(c->next), i++) { + resize(c, x, y, w - 2 * c->bw, /* remainder */ ((i + 1 == n) + ? m->wy + m->wh - y - 2 * c->bw : h - 2 * c->bw), False); + if(h != m->wh) + y = c->y + HEIGHT(c); + } +} + +void +nextview(const Arg *arg) { + unsigned int mask; + + + if (selmon->tagset[selmon->seltags] >= (1 << (LENGTH(tags)-1))) + mask = 1 & TAGMASK; + else + mask = (selmon->tagset[selmon->seltags] << 1) & TAGMASK; + + selmon->seltags ^= 1; /* toggle sel tagset */ + + selmon->tagset[selmon->seltags] = mask; + + arrange(selmon); +} + +void +prevview(const Arg *arg) { + unsigned int mask; + + if (selmon->tagset[selmon->seltags] <= 1) + mask = (1 << (LENGTH(tags) - 1)) & TAGMASK; + else + mask = (selmon->tagset[selmon->seltags] >> 1) & TAGMASK; + + selmon->seltags ^= 1; /* toggle sel tagset */ + + selmon->tagset[selmon->seltags] = mask; + //(selmon->tagset[selmon->seltags] >> 1) & TAGMASK; + + arrange(selmon); +} + +void +nexttag(const Arg *arg) { + if(selmon->sel) { + if (selmon->sel->tags < (1 << (LENGTH(tags)-1))) + selmon->sel->tags = (selmon->sel->tags << 1) & TAGMASK; + else + selmon->sel->tags = 1 & TAGMASK; + + arrange(selmon); + } +} + +void +prevtag(const Arg *arg) { + if(selmon->sel) { + if (selmon->sel->tags > 1) + selmon->sel->tags = (selmon->sel->tags >> 1) & TAGMASK; + else + selmon->sel->tags = (1 << (LENGTH(tags) - 1)) & TAGMASK; + + arrange(selmon); + } +} + + int main(int argc, char *argv[]) { if(argc == 2 && !strcmp("-v", argv[1])) - die("dwm-"VERSION", © 2006-2009 dwm engineers, see LICENSE for details\n"); + die("dwm-"VERSION", (C) 2006-2009 dwm engineers, see LICENSE for details\n"); + else if(argc == 2 && !strcmp("--src-path", argv[1])) + die(SRC_PATH"\n"); else if(argc != 1) die("usage: dwm [-v]\n"); if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) @@ -2014,5 +2203,5 @@ main(int argc, char *argv[]) { run(); cleanup(); XCloseDisplay(dpy); - return 0; + return exitstatus; } diff -upP dwm-5.7.2/Makefile dwm-5.7.2.mt/Makefile --- dwm-5.7.2/Makefile 2009-09-27 21:20:23.000000000 +0200 +++ dwm-5.7.2.mt/Makefile 2009-10-27 16:09:58.000000000 +0100 @@ -3,29 +3,45 @@ include config.mk + SRC = dwm.c +PLACEFLAG=-D${PLACE} +SRCFLAG = -DSRC_PATH=\"${PWD}\" 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 "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" + @echo + @echo "CC = ${CC}" + @#echo "PLACE = ${PLACE}" + @#echo "SRC_PATH = ${SRCFLAGS}" + @echo "CFLAGS = ${CFLAGS} ${PLACEFLAG} ${SRCFLAG}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "PREFIX = ${DESTDIR}${PREFIX}" + @echo "MANPREFIX = ${DESTDIR}${MANPREFIX}" + @echo .c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< + @echo ${CC} $< + @${CC} -c ${CFLAGS} ${PLACEFLAG} ${SRCFLAG} $< -${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,25 +52,36 @@ 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 + @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 - @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + @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 @chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1 uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @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-${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 diff -upP dwm-5.7.2/my_settings.h dwm-5.7.2.mt/my_settings.h --- dwm-5.7.2/my_settings.h 1970-01-01 01:00:00.000000000 +0100 +++ dwm-5.7.2.mt/my_settings.h 2009-12-09 14:12:48.000000000 +0100 @@ -0,0 +1,16 @@ + +#if defined(_TRAVEL_) + #define MY_FIRST_TERM "xterm" + #define MY_SECOND_TERM "rxvt" + #define MODKEY Mod4Mask + #define DMENU_LIST "/home/harlock/.usr/share/dmenu/dmenu_list" + /*#define SCRSVRCMD "xscreensaver-command -lock"*/ + /*#define SCRSVRCMD "gnome-screensaver-command -l"*/ + #define SCRSVRCMD "xscreensaver-command -lock" +#else + #define MY_FIRST_TERM "rxvt" + #define MY_SECOND_TERM "xterm" + #define MODKEY Mod1Mask + #define DMENU_LIST "/usr/share/dmenu/dmenu_list" + #define SCRSVRCMD "gnome-screensaver-command -l" +#endif