Commits

portix committed d275d38

added portix.diff

Comments (0)

Files changed (2)

+diff -up dwm-5.7.2/config.def.h dwm/config.def.h
+--- dwm-5.7.2/config.def.h	2009-09-27 21:20:23.000000000 +0200
++++ dwm/config.def.h	2010-03-30 14:34:12.000000000 +0200
+@@ -1,46 +1,63 @@
+ /* See LICENSE file for copyright and license details. */
+ 
+ /* 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";
+-static const char selfgcolor[]      = "#ffffff";
+-static const unsigned int borderpx  = 1;        /* border pixel of windows */
++static const char font[]            = "-*-fixed-bold-r-*-*-13-*-*-*-*-70-iso10646-*";
++static const char normbordercolor[] = "#292929";
++static const char normbgcolor[]     = "#000000";
++static const char normfgcolor[]     = "#aaaaaa";
++static const char selbordercolor[]  = "#1793d1";
++static const char selbgcolor[]      = "#000000";
++static const char selfgcolor[]      = "#1793d1";
++static const char infocolor[]       = "#ffffff";
++static const unsigned int borderpx  = 2;        /* 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 */
++#define NMASTER
+ 
++#ifdef NMASTER 
++static const int nmaster            = 1;
++#endif
+ /* tagging */
+-static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
++static const char *tags[] = { "main", "web", "less", "edit", "tv"};
++static const int  initlayouts[] = { 0, 0, 0, 1, 1, 1 };
++static const int  initnms[] = { 1, 2, 1, 1, 1, 1 };
+ 
+ static const Rule rules[] = {
+-	/* class      instance    title       tags mask     isfloating   monitor */
+-	{ "Gimp",     NULL,       NULL,       0,            True,        -1 },
+-	{ "Firefox",  NULL,       NULL,       1 << 8,       False,       -1 },
++    /* class      instance    title       tags mask     isfloating   monitor */
++    { "Gimp",     NULL,       NULL,       0,            True,        -1 },
++    { "alsamixer",         NULL,        NULL,       1<<1,            False,       -1 },
+ };
+ 
++#include <functions.h>
++
+ /* 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 const float mfact      = 0.62; /* factor of master area size [0.05..0.95] */
++static const Bool resizehints = False; /* True means respect size hints in tiled resizals */
+ 
+ static const Layout layouts[] = {
+ 	/* symbol     arrange function */
+-	{ "[]=",      tile },    /* first entry is default */
+-	{ "><>",      NULL },    /* no layout function means floating behavior */
++    { "-|=",      ntile },
+ 	{ "[M]",      monocle },
++	{ "><>",      NULL },    /* no layout function means floating behavior */
+ };
+ 
+ /* key definitions */
+ #define MODKEY Mod1Mask
+ #define TAGKEYS(KEY,TAG) \
+-	{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
+-	{ MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \
+-	{ MODKEY|ShiftMask,             KEY,      tag,            {.ui = 1 << TAG} }, \
+-	{ MODKEY|ControlMask|ShiftMask, KEY,      toggletag,      {.ui = 1 << TAG} },
++{ MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
++{ MODKEY|ControlMask,             KEY,      toggleview,     {.ui = 1 << TAG} }, \
++{ MODKEY|Mod4Mask,           KEY,      tag,            {.ui = 1 << TAG} }, \
++{ MODKEY|ShiftMask,             KEY,      toggletag,      {.ui = 1 << TAG} }, \
++{ Mod4Mask,                     KEY,      tagandview,     {.ui = 1 << TAG} }, \
++
++#define MONKEYS(KEY,TAG) \
++{ MODKEY,                       KEY,      viewmon,           {.ui = 1 << TAG} }, \
++{ MODKEY|Mod4Mask,              KEY,      tagnextmon,        {.ui = 1 << TAG} }, \
++{ Mod4Mask,                     KEY,      tagviewnextmon,    {.ui = 1 << TAG} }, \
+ 
++#define FKEYS(KEY,TAG) \
++{ MODKEY,           KEY,      viewall,     {.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 } }
+ 
+@@ -49,54 +66,66 @@ static const char *dmenucmd[] = { "dmenu
+ 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_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_Return, zoom,           {0} },
+-	{ MODKEY,                       XK_Tab,    view,           {0} },
+-	{ MODKEY|ShiftMask,             XK_c,      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|ShiftMask,             XK_space,  togglefloating, {0} },
+-	{ MODKEY,                       XK_0,      view,           {.ui = ~0 } },
+-	{ MODKEY|ShiftMask,             XK_0,      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 } },
+-	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)
+-	{ MODKEY|ShiftMask,             XK_q,      quit,           {0} },
++    /* modifier                     key        function        argument */
++    { 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|Mod4Mask,                       XK_h,      setmfact,       {.f = -0.02} },
++    { MODKEY|Mod4Mask,                       XK_l,      setmfact,       {.f = +0.02} },
++    { MODKEY,                       XK_Return, zoom,           {0} },
++    { MODKEY,                     XK_Tab,    view,           {0} },
++    { MODKEY,                       XK_c,      killclient,     {0} },
++    { MODKEY,                       XK_d,      setlayout,      {.v = &layouts[0]} },
++    { MODKEY,                       XK_m,      setlayout,      {.v = &layouts[1]} },
++    { MODKEY,                       XK_f,      setlayout,      {.v = &layouts[2]} },
++    { MODKEY,                       XK_space,  setlayout,      {0} },
++    { MODKEY|Mod4Mask,             XK_space,  togglefloating, {0} },
++    { Mod4Mask,                     XK_j,  pushdown, {0} },
++    { Mod4Mask,                     XK_k,  pushup, {0} },
++    { MODKEY,                       XK_0,      view,           {.ui = ~0 } },
++    { Mod4Mask,                     XK_0,      tag,            {.ui = ~0 } },
++    { Mod4Mask,                       XK_space,      focusmon,       {.i = +1 } },
++    { MODKEY,                     XK_h,      focusmon,         {.i = -1 } },
++    { MODKEY,                     XK_l,      focusmon,         {.i = +1 } },
++    { Mod4Mask,                     XK_h,      tagmon,         {.i = -1 } },
++    { Mod4Mask,                     XK_l,      tagmon,         {.i = +1 } },
++    { MODKEY,                       XK_plus,    incnmaster,    {.i = +1 } },
++    { MODKEY,                       XK_minus,    incnmaster,    {.i = -1 } },
++    TAGKEYS(                        XK_1,                      0)
++    TAGKEYS(                        XK_2,                      1)
++    TAGKEYS(                        XK_3,                      2)
++    TAGKEYS(                        XK_4,                      3)
++    TAGKEYS(                        XK_5,                      4)
++    MONKEYS(                        XK_q,                      0)
++    MONKEYS(                        XK_w,                      1)
++    MONKEYS(                        XK_e,                      2)
++    MONKEYS(                        XK_r,                      3)
++    MONKEYS(                        XK_t,                      4)
++    FKEYS(                        XK_F1,                      0)
++    FKEYS(                        XK_F2,                      1)
++    FKEYS(                        XK_F3,                      2)
++    FKEYS(                        XK_F4,                      3)
++    FKEYS(                        XK_F5,                      4)
++        { MODKEY|ShiftMask,             XK_q,      quit,           {0} },
+ };
+ 
+ /* button definitions */
+-/* click can be ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
++/* click can be a tag number (starting at 0),
++ * ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
+ static Button buttons[] = {
+-	/* click                event mask      button          function        argument */
+-	{ ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
+-	{ ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
+-	{ ClkWinTitle,          0,              Button2,        zoom,           {0} },
+-	{ ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
+-	{ ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
+-	{ ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
+-	{ ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
+-	{ ClkTagBar,            0,              Button1,        view,           {0} },
+-	{ ClkTagBar,            0,              Button3,        toggleview,     {0} },
+-	{ ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
+-	{ ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
++    /* click                event mask      button          function        argument */
++    { ClkLtSymbol,          0,              Button1,        setlayout,      {0} },
++    { ClkLtSymbol,          0,              Button3,        setlayout,      {.v = &layouts[2]} },
++    { ClkWinTitle,          0,              Button2,        zoom,           {0} },
++    { ClkStatusText,        0,              Button2,        spawn,          {.v = termcmd } },
++    { ClkClientWin,         MODKEY,         Button1,        movemouse,      {0} },
++    { ClkClientWin,         MODKEY,         Button2,        togglefloating, {0} },
++    { ClkClientWin,         MODKEY,         Button3,        resizemouse,    {0} },
++    { ClkTagBar,            0,              Button1,        view,           {0} },
++    { ClkTagBar,            0,              Button3,        toggleview,     {0} },
++    { ClkTagBar,            MODKEY,         Button1,        tag,            {0} },
++    { ClkTagBar,            MODKEY,         Button3,        toggletag,      {0} },
+ };
+ 
+diff -up dwm-5.7.2/dwm.c dwm/dwm.c
+--- dwm-5.7.2/dwm.c	2009-09-27 21:20:23.000000000 +0200
++++ dwm/dwm.c	2010-03-30 14:31:14.000000000 +0200
+@@ -97,6 +97,7 @@ typedef struct {
+ 	int x, y, w, h;
+ 	unsigned long norm[ColLast];
+ 	unsigned long sel[ColLast];
++    unsigned long info[ColLast];
+ 	Drawable drawable;
+ 	GC gc;
+ 	struct {
+@@ -120,26 +121,6 @@ typedef struct {
+ 	void (*arrange)(Monitor *);
+ } Layout;
+ 
+-struct Monitor {
+-	char ltsymbol[16];
+-	float mfact;
+-	int num;
+-	int by;               /* bar geometry */
+-	int mx, my, mw, mh;   /* screen size */
+-	int wx, wy, ww, wh;   /* window area  */
+-	unsigned int seltags;
+-	unsigned int sellt;
+-	unsigned int tagset[2];
+-	Bool showbar;
+-	Bool topbar;
+-	Client *clients;
+-	Client *sel;
+-	Client *stack;
+-	Monitor *next;
+-	Window barwin;
+-	const Layout *lt[2];
+-};
+-
+ typedef struct {
+ 	const char *class;
+ 	const char *instance;
+@@ -215,7 +196,9 @@ static void spawn(const Arg *arg);
+ static void tag(const Arg *arg);
+ static void tagmon(const Arg *arg);
+ static int textnw(const char *text, unsigned int len);
+-static void tile(Monitor *);
++#ifndef NMASTER
++void tile(Monitor *);
++#endif
+ static void togglebar(const Arg *arg);
+ static void togglefloating(const Arg *arg);
+ static void toggletag(const Arg *arg);
+@@ -273,6 +256,36 @@ static Window root;
+ /* configuration, allows nested code to access above variables */
+ #include "config.h"
+ 
++struct Monitor {
++	char ltsymbol[16];
++	float mfact;
++	int num;
++	int by;               /* bar geometry */
++	int mx, my, mw, mh;   /* screen size */
++	int wx, wy, ww, wh;   /* window area  */
++	unsigned int seltags;
++	unsigned int sellt;
++	unsigned int tagset[2];
++	Bool showbar;
++	Bool topbar;
++	Client *clients;
++	Client *sel;
++	Client *stack;
++	Monitor *next;
++	Window barwin;
++	const Layout *lt[2];
++	int curtag;
++	int prevtag;
++	const Layout *lts[LENGTH(tags) + 1];
++	double mfacts[LENGTH(tags) + 1];
++	Bool showbars[LENGTH(tags) + 1];
++#ifdef NMASTER
++    int nmaster;
++    int nmasters[LENGTH(tags) + 1];
++#endif
++};
++
++#include <functions.c>
+ /* compile-time check if all tags fit into an unsigned int bit array. */
+ struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
+ 
+@@ -613,9 +626,10 @@ createmon(void) {
+ 	m->mfact = mfact;
+ 	m->showbar = showbar;
+ 	m->topbar = topbar;
+-	m->lt[0] = &layouts[0];
++	m->lt[0] = &layouts[initlayouts[1]] && initlayouts[1] <  LENGTH(layouts) ? &layouts[initlayouts[1]] : &layouts[0];
+ 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
+-	strncpy(m->ltsymbol, layouts[0].symbol, sizeof m->ltsymbol);
++	strncpy(m->ltsymbol, initlayouts[1] && initlayouts[1] < LENGTH(layouts) ? layouts[initlayouts[1]].symbol : layouts[0].symbol, sizeof m->ltsymbol);
++	//strncpy(m->ltsymbol, layouts[initlayouts[1]].symbol, sizeof m->ltsymbol);
+ 	return m;
+ }
+ 
+@@ -681,8 +695,11 @@ drawbar(Monitor *m) {
+ 	int x;
+ 	unsigned int i, occ = 0, urg = 0;
+ 	unsigned long *col;
++    char mf[4];
++
+ 	Client *c;
+ 
++    sprintf(mf, "%.2f", selmon->mfacts[selmon->curtag]); 
+ 	for(c = m->clients; c; c = c->next) {
+ 		occ |= c->tags;
+ 		if(c->isurgent)
+@@ -701,6 +718,10 @@ drawbar(Monitor *m) {
+ 	drawtext(m->ltsymbol, dc.norm, False);
+ 	dc.x += dc.w;
+ 	x = dc.x;
++    dc.w = TEXTW(mf);
++	drawtext(mf, dc.norm, False);
++	dc.x += dc.w;
++	x = dc.x;
+ 	if(m == selmon) { /* status is only drawn on selected monitor */
+ 		dc.w = TEXTW(stext);
+ 		dc.x = m->ww - dc.w;
+@@ -708,7 +729,7 @@ drawbar(Monitor *m) {
+ 			dc.x = x;
+ 			dc.w = m->ww - x;
+ 		}
+-		drawtext(stext, dc.norm, False);
++		drawtext(stext, dc.info, False);
+ 	}
+ 	else
+ 		dc.x = m->ww;
+@@ -1182,7 +1203,7 @@ monocle(Monitor *m) {
+ 	if(n > 0) /* override layout symbol */
+ 		snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
+ 	for(c = nexttiled(m->clients); c; c = nexttiled(c->next))
+-		resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, False);
++		resize(c, m->wx, m->wy, m->ww - 2*c->bw, m->wh - 2*c->bw, False);
+ }
+ 
+ void
+@@ -1434,7 +1455,8 @@ sendmon(Client *c, Monitor *m) {
+ 	attach(c);
+ 	attachstack(c);
+ 	focus(NULL);
+-	arrange(NULL);
++    arrange(NULL);
++    arrange(m);
+ }
+ 
+ void
+@@ -1450,7 +1472,7 @@ setlayout(const Arg *arg) {
+ 	if(!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
+ 		selmon->sellt ^= 1;
+ 	if(arg && arg->v)
+-		selmon->lt[selmon->sellt] = (Layout *)arg->v;
++		selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag] = (Layout *)arg->v;
+ 	strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
+ 	if(selmon->sel)
+ 		arrange(selmon);
+@@ -1468,13 +1490,15 @@ setmfact(const Arg *arg) {
+ 	f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
+ 	if(f < 0.1 || f > 0.9)
+ 		return;
+-	selmon->mfact = f;
++	selmon->mfact = selmon->mfacts[selmon->curtag] =  f;
+ 	arrange(selmon);
+ }
+ 
+ void
+ setup(void) {
+ 	XSetWindowAttributes wa;
++	Monitor *m;
++	unsigned int i;
+ 
+ 	/* clean up any zombies immediately */
+ 	sigchld(0);
+@@ -1504,12 +1528,39 @@ setup(void) {
+ 	dc.sel[ColBorder] = getcolor(selbordercolor);
+ 	dc.sel[ColBG] = getcolor(selbgcolor);
+ 	dc.sel[ColFG] = getcolor(selfgcolor);
++	dc.info[ColFG] = getcolor(infocolor);
+ 	dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen));
+ 	dc.gc = XCreateGC(dpy, root, 0, NULL);
+ 	XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter);
+ 	if(!dc.font.set)
+ 		XSetFont(dpy, dc.gc, dc.font.xfont->fid);
++	/* init tags */
++	for(m = mons; m; m = m->next)
++		m->curtag = m->prevtag = 1;
++	/* init mfacts */
++	for(m = mons; m; m = m->next) {
++		for(i=0; i < LENGTH(tags) + 1 ; i++) {
++			m->mfacts[i] = m->mfact;
++		}
++	}
++	/* init layouts */
++	for(m = mons; m; m = m->next) {
++		for(i=0; i < LENGTH(tags) + 1; i++) {
++			m->lts[i] = initlayouts[i] && initlayouts[i] < LENGTH(layouts) ? &layouts[initlayouts[i]] : &layouts[0];
++		}
++	}
+ 	/* init bars */
++	for(m = mons; m; m = m->next) {
++		for(i=0; i < LENGTH(tags) + 1; i++) {
++			m->showbars[i] = m->showbar;
++		}
++	}
++    /* init nmaster */
++	for(m = mons; m; m = m->next) {
++		for(i=0; i < LENGTH(tags) + 1; i++) {
++			m->nmasters[i] = initnms[i] && initnms[i] > 0 ? initnms[i] : nmaster;
++		}
++	}
+ 	updatebars();
+ 	updatestatus();
+ 	/* EWMH support per view */
+@@ -1566,6 +1617,8 @@ void
+ tag(const Arg *arg) {
+ 	if(selmon->sel && arg->ui & TAGMASK) {
+ 		selmon->sel->tags = arg->ui & TAGMASK;
++        if(selmon->showbar != selmon->showbars[selmon->curtag])
++            togglebar(NULL);
+ 		arrange(selmon);
+ 	}
+ }
+@@ -1588,6 +1641,7 @@ textnw(const char *text, unsigned int le
+ 	return XTextWidth(dc.font.xfont, text, len);
+ }
+ 
++#ifndef NMASTER
+ void
+ tile(Monitor *m) {
+ 	int x, y, h, w, mw;
+@@ -1617,10 +1671,11 @@ tile(Monitor *m) {
+ 			y = c->y + HEIGHT(c);
+ 	}
+ }
++#endif
+ 
+ void
+ togglebar(const Arg *arg) {
+-	selmon->showbar = !selmon->showbar;
++	selmon->showbar = selmon->showbars[selmon->curtag] = !selmon->showbar;
+ 	updatebarpos(selmon);
+ 	XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh);
+ 	arrange(selmon);
+@@ -1640,12 +1695,27 @@ togglefloating(const Arg *arg) {
+ void
+ toggletag(const Arg *arg) {
+ 	unsigned int newtags;
++	unsigned int i;
+ 
+ 	if(!selmon->sel)
+ 		return;
+ 	newtags = selmon->sel->tags ^ (arg->ui & TAGMASK);
+ 	if(newtags) {
+ 		selmon->sel->tags = newtags;
++		if(newtags == ~0) {
++			selmon->prevtag = selmon->curtag;
++			selmon->curtag = 0;
++		}
++		if(!(newtags & 1 << (selmon->curtag - 1))) {
++			selmon->prevtag = selmon->curtag;
++			for (i=0; !(newtags & 1 << i); i++);
++			selmon->curtag = i + 1;
++		}
++		selmon->sel->tags = newtags;
++		selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
++		selmon->mfact = selmon->mfacts[selmon->curtag];
++		if (selmon->showbar != selmon->showbars[selmon->curtag])
++			togglebar(NULL);
+ 		arrange(selmon);
+ 	}
+ }
+@@ -1912,11 +1982,29 @@ updatewmhints(Client *c) {
+ 
+ void
+ view(const Arg *arg) {
++	unsigned int i;
++
+ 	if((arg->ui & TAGMASK) == selmon->tagset[selmon->seltags])
+ 		return;
+ 	selmon->seltags ^= 1; /* toggle sel tagset */
+-	if(arg->ui & TAGMASK)
++	if(arg->ui & TAGMASK) {
+ 		selmon->tagset[selmon->seltags] = arg->ui & TAGMASK;
++		selmon->prevtag = selmon->curtag;
++		if(arg->ui == ~0)
++			selmon->curtag = 0;
++		else {
++			for (i=0; !(arg->ui & 1 << i); i++);
++			selmon->curtag = i + 1;
++		}
++	} else {
++		selmon->prevtag= selmon->curtag ^ selmon->prevtag;
++		selmon->curtag^= selmon->prevtag;
++		selmon->prevtag= selmon->curtag ^ selmon->prevtag;
++	}
++	selmon->lt[selmon->sellt] = selmon->lts[selmon->curtag];
++	selmon->mfact = selmon->mfacts[selmon->curtag];
++	if(selmon->showbar != selmon->showbars[selmon->curtag])
++		togglebar(NULL);
+ 	arrange(selmon);
+ }
+ 
+Nur in dwm: tags.
 	m->mfact = mfact;
 	m->showbar = showbar;
 	m->topbar = topbar;
-	m->lt[0] = &layouts[0];
+	m->lt[0] = &layouts[initlayouts[1]] && initlayouts[1] <  LENGTH(layouts) ? &layouts[initlayouts[1]] : &layouts[0];
 	m->lt[1] = &layouts[1 % LENGTH(layouts)];
 	strncpy(m->ltsymbol, initlayouts[1] && initlayouts[1] < LENGTH(layouts) ? layouts[initlayouts[1]].symbol : layouts[0].symbol, sizeof m->ltsymbol);
+	//strncpy(m->ltsymbol, layouts[initlayouts[1]].symbol, sizeof m->ltsymbol);
 	return m;
 }