Mercurial > hg > index.fcgi > dwm > dwm-3.6.1-11pba
changeset 1:ba504f41828f
add prev/next control to view_tags() and setlayouts()
author | paulo@localhost |
---|---|
date | Mon, 23 Mar 2009 00:14:48 -0700 |
parents | 7024076fa948 |
children | de6bb7885c97 |
files | config.h dwm.h layout.c tag.c |
diffstat | 4 files changed, 29 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/config.h Sun Mar 22 23:26:35 2009 -0700 1.2 +++ b/config.h Mon Mar 23 00:14:48 2009 -0700 1.3 @@ -83,6 +83,7 @@ 1.4 { MODKEY|ControlMask|ShiftMask, XK_0, toggletag, { .i = 9 } }, \ 1.5 { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \ 1.6 { MODKEY, XK_space, setlayout, { .i = -1 } }, \ 1.7 + { MODKEY|ShiftMask, XK_space, setlayout, { .i = -2 } }, \ 1.8 { MODKEY, XK_F1, setlayout, { .i = 0 } }, \ 1.9 { MODKEY, XK_F2, setlayout, { .i = 1 } }, \ 1.10 { MODKEY, XK_F3, setlayout, { .i = 2 } }, \ 1.11 @@ -90,7 +91,7 @@ 1.12 { MODKEY, XK_F5, setlayout, { .i = 4 } }, \ 1.13 { MODKEY, XK_F6, setlayout, { .i = 5 } }, \ 1.14 { MODKEY, XK_F7, setlayout, { .i = 6 } }, \ 1.15 - { MODKEY|ShiftMask, XK_space, toggleversatile,{ 0 } }, \ 1.16 + { MODKEY|ControlMask, XK_space, toggleversatile,{ 0 } }, \ 1.17 { MODKEY, XK_grave, view, { .i = -1 } }, \ 1.18 { MODKEY, XK_1, view, { .i = 0 } }, \ 1.19 { MODKEY, XK_2, view, { .i = 1 } }, \ 1.20 @@ -102,6 +103,8 @@ 1.21 { MODKEY, XK_8, view, { .i = 7 } }, \ 1.22 { MODKEY, XK_9, view, { .i = 8 } }, \ 1.23 { MODKEY, XK_0, view, { .i = 9 } }, \ 1.24 + { MODKEY, XK_minus, next_view, { .i = -1 } }, \ 1.25 + { MODKEY, XK_equal, next_view, { .i = 1 } }, \ 1.26 { MODKEY, XK_BackSpace, last_view, { 0 } }, \ 1.27 { MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \ 1.28 { MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
2.1 --- a/dwm.h Sun Mar 22 23:26:35 2009 -0700 2.2 +++ b/dwm.h Mon Mar 23 00:14:48 2009 -0700 2.3 @@ -152,6 +152,7 @@ 2.4 extern void toggleview(Arg *arg); /* toggles the tag with arg's index (in)visible */ 2.5 extern void view(Arg *arg); /* views the tag with arg's index */ 2.6 extern void last_view(Arg *arg); /* go to last viewed tag */ 2.7 +extern void next_view(Arg *arg); /* go to next/prev tag */ 2.8 2.9 /* util.c */ 2.10 extern void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */
3.1 --- a/layout.c Sun Mar 22 23:26:35 2009 -0700 3.2 +++ b/layout.c Mon Mar 23 00:14:48 2009 -0700 3.3 @@ -427,14 +427,14 @@ 3.4 3.5 void 3.6 setlayout(Arg *arg) { 3.7 - unsigned int i; 3.8 + int i; 3.9 3.10 - if(arg->i == -1) { 3.11 + if(arg->i < 0) { 3.12 for(i = 0; i < nlayouts && lt != &layout[i]; i++); 3.13 - if(i == nlayouts - 1) 3.14 - lt = &layout[0]; 3.15 - else 3.16 - lt = &layout[++i]; 3.17 + if(arg->i == -1) 3.18 + lt = &layout[(i + 1) % nlayouts]; 3.19 + else if(arg->i == -2) 3.20 + lt = &layout[(i - 1) >= 0 ? i - 1 : nlayouts - 1]; 3.21 } 3.22 else { 3.23 if(arg->i < 0 || arg->i >= nlayouts)
4.1 --- a/tag.c Sun Mar 22 23:26:35 2009 -0700 4.2 +++ b/tag.c Mon Mar 23 00:14:48 2009 -0700 4.3 @@ -164,3 +164,21 @@ 4.4 a.i = lastview; 4.5 view(&a); 4.6 } 4.7 + 4.8 +void 4.9 +next_view(Arg *arg) { 4.10 + int i; 4.11 + Arg a; 4.12 + 4.13 + a.i = 0; 4.14 + setlayout(&a); /* back to default layout */ 4.15 + 4.16 + for(i = 0; i < ntags; i++) { 4.17 + if (seltag[i] == True) { 4.18 + seltag[i] = False; 4.19 + seltag[(i + arg->i) >= 0 ? (i + arg->i) % ntags : ntags - 1] = True; 4.20 + break; 4.21 + } 4.22 + } 4.23 + lt->arrange(); 4.24 +}