renamed setlayout into togglelayout

master
Anselm R Garbe 2008-05-17 14:04:27 +01:00
parent 6dfa7cac56
commit 349d768b57
2 changed files with 97 additions and 98 deletions

View File

@ -19,7 +19,7 @@ Rule rules[] = {
}; };
/* layout(s) */ /* layout(s) */
#define MFACT 0.55 /* master width factor [0.1 .. 0.9] */ #define MFACT 0.55 /* master factor [0.1 .. 0.9] */
#define RESIZEHINTS True /* False - respect size hints in tiled resizals */ #define RESIZEHINTS True /* False - respect size hints in tiled resizals */
#define SNAP 32 /* snap pixel */ #define SNAP 32 /* snap pixel */
@ -34,8 +34,7 @@ Layout layouts[] = {
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
Key keys[] = { Key keys[] = {
/* modifier key function argument */ /* modifier key function argument */
{ MODKEY, XK_p, spawn, { MODKEY, XK_p, spawn, "exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
"exec dmenu_run -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"' -sb '"SELBGCOLOR"' -sf '"SELFGCOLOR"'" },
{ MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" }, { MODKEY|ShiftMask, XK_Return, spawn, "exec uxterm" },
{ MODKEY, XK_j, focusnext, NULL }, { MODKEY, XK_j, focusnext, NULL },
{ MODKEY|ShiftMask, XK_j, focusnext, "exact" }, { MODKEY|ShiftMask, XK_j, focusnext, "exact" },
@ -45,10 +44,10 @@ Key keys[] = {
{ MODKEY, XK_h, setmfact, "-0.05" }, { MODKEY, XK_h, setmfact, "-0.05" },
{ MODKEY, XK_l, setmfact, "+0.05" }, { MODKEY, XK_l, setmfact, "+0.05" },
{ MODKEY, XK_Return, zoom, NULL }, { MODKEY, XK_Return, zoom, NULL },
{ MODKEY, XK_m, setlayout, "<M>" }, { MODKEY, XK_m, togglelayout, "<M>" },
{ MODKEY, XK_Tab, viewprevtag, NULL }, { MODKEY, XK_Tab, viewprevtag, NULL },
{ MODKEY|ShiftMask, XK_c, killclient, NULL }, { MODKEY|ShiftMask, XK_c, killclient, NULL },
{ MODKEY, XK_space, setlayout, NULL }, { MODKEY, XK_space, togglelayout, NULL },
{ MODKEY|ShiftMask, XK_space, togglefloating, NULL }, { MODKEY|ShiftMask, XK_space, togglefloating, NULL },
{ MODKEY, XK_0, view, NULL }, { MODKEY, XK_0, view, NULL },
{ MODKEY, XK_1, view, tags[0] }, { MODKEY, XK_1, view, tags[0] },

48
dwm.c
View File

@ -165,7 +165,6 @@ void restack(void);
void run(void); void run(void);
void scan(void); void scan(void);
void setclientstate(Client *c, long state); void setclientstate(Client *c, long state);
void setlayout(const char *arg);
void setmfact(const char *arg); void setmfact(const char *arg);
void setup(void); void setup(void);
void spawn(const char *arg); void spawn(const char *arg);
@ -179,6 +178,7 @@ void tileresize(Client *c, int x, int y, int w, int h);
void tilev(void); void tilev(void);
void tilevstack(unsigned int n); void tilevstack(unsigned int n);
void togglefloating(const char *arg); void togglefloating(const char *arg);
void togglelayout(const char *arg);
void toggletag(const char *arg); void toggletag(const char *arg);
void toggleview(const char *arg); void toggleview(const char *arg);
void unban(Client *c); void unban(Client *c);
@ -335,7 +335,7 @@ buttonpress(XEvent *e) {
} }
} }
if((ev->x < x + blw) && ev->button == Button1) if((ev->x < x + blw) && ev->button == Button1)
setlayout(NULL); togglelayout(NULL);
} }
else if((c = getclient(ev->window))) { else if((c = getclient(ev->window))) {
focus(c); focus(c);
@ -1375,28 +1375,6 @@ setclientstate(Client *c, long state) {
PropModeReplace, (unsigned char *)data, 2); PropModeReplace, (unsigned char *)data, 2);
} }
void
setlayout(const char *arg) {
unsigned int i;
if(!arg) {
if(++lt == &layouts[LENGTH(layouts)])
lt = &layouts[0];
}
else {
for(i = 0; i < LENGTH(layouts); i++)
if(!strcmp(arg, layouts[i].symbol))
break;
if(i == LENGTH(layouts))
return;
lt = &layouts[i];
}
if(sel)
arrange();
else
drawbar();
}
void void
setmfact(const char *arg) { setmfact(const char *arg) {
double d; double d;
@ -1635,6 +1613,28 @@ togglefloating(const char *arg) {
arrange(); arrange();
} }
void
togglelayout(const char *arg) {
unsigned int i;
if(!arg) {
if(++lt == &layouts[LENGTH(layouts)])
lt = &layouts[0];
}
else {
for(i = 0; i < LENGTH(layouts); i++)
if(!strcmp(arg, layouts[i].symbol))
break;
if(i == LENGTH(layouts))
return;
lt = &layouts[i];
}
if(sel)
arrange();
else
drawbar();
}
void void
toggletag(const char *arg) { toggletag(const char *arg) {
unsigned int i, j; unsigned int i, j;