sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2c3fff235a764f776279b233ac02aae05c9a2920
parent a226e424dd3b90b81f9b814cd9e6ac3f10db346f
Author: Rob Pilling <my name at gmail dot com>
Date:   Fri, 24 Dec 2010 17:17:27 +0000

Added nextprevtag 'patch'
Diffstat:
Adwm.suckless.org/patches/nextprev.md | 30++++++++++++++++++++++++++++++
Adwm.suckless.org/patches/nextprevtag.c | 21+++++++++++++++++++++
2 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dwm.suckless.org/patches/nextprev.md b/dwm.suckless.org/patches/nextprev.md @@ -0,0 +1,30 @@ +# NEXT PREV TAG + +## Description + + * increment or decrement the selected tag + +## Download + + * [nextprevtag.c](nextprevtag.c) + +## Example Usage + + static Key keys[] = { + /* ... */ + { MODKEY, XK_i, view_adjacent, { .i = +1 } }, + { MODKEY, XK_u, view_adjacent, { .i = -1 } }, + /* ... */ + }; + + static Button buttons[] = { + /* ... */ + { ClkTagBar, 0, Button4, view_adjacent, { .i = -1 } }, + { ClkTagBar, 0, Button5, view_adjacent, { .i = +1 } }, + /* ... */ + }; + + +## Author + + * Rob Pilling - robpilling gmail com diff --git a/dwm.suckless.org/patches/nextprevtag.c b/dwm.suckless.org/patches/nextprevtag.c @@ -0,0 +1,21 @@ +void +view_adjacent(const Arg *arg) +{ + int i, curtags; + int seltag = 0; + Arg a; + + curtags = selmon->tagset[selmon->seltags]; + for(i = 0; i < LENGTH(tags); i++) + if(curtags & (1 << i)){ + seltag = i; + break; + } + + seltag = (seltag + arg->i) % (int)LENGTH(tags); + if(seltag < 0) + seltag += LENGTH(tags); + + a.i = (1 << seltag); + view(&a); +}