diff options
| -rw-r--r-- | dwm.h | 1 | ||||
| -rw-r--r-- | event.c | 4 | ||||
| -rw-r--r-- | tag.c | 18 |
3 files changed, 23 insertions, 0 deletions
| @@ -144,6 +144,7 @@ void tag(const char *arg); /* tags sel with arg's index */ | |||
| 144 | void toggletag(const char *arg); /* toggles sel tags with arg's index */ | 144 | void toggletag(const char *arg); /* toggles sel tags with arg's index */ |
| 145 | void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ | 145 | void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ |
| 146 | void view(const char *arg); /* views the tag with arg's index */ | 146 | void view(const char *arg); /* views the tag with arg's index */ |
| 147 | void shiftview(const char *arg); /* views next(1)/previous(-1) tag */ | ||
| 147 | 148 | ||
| 148 | /* util.c */ | 149 | /* util.c */ |
| 149 | void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ | 150 | void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ |
| @@ -135,6 +135,10 @@ buttonpress(XEvent *e) { | |||
| 135 | else | 135 | else |
| 136 | toggleview(buf); | 136 | toggleview(buf); |
| 137 | } | 137 | } |
| 138 | else if(ev->button == Button4) | ||
| 139 | shiftview("-1"); | ||
| 140 | else if(ev->button == Button5) | ||
| 141 | shiftview("1"); | ||
| 138 | return; | 142 | return; |
| 139 | } | 143 | } |
| 140 | } | 144 | } |
| @@ -99,6 +99,24 @@ settags(Client *c, Client *trans) { | |||
| 99 | c->tags[i] = seltag[i]; | 99 | c->tags[i] = seltag[i]; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void | ||
| 103 | shiftview(const char *arg) { | ||
| 104 | int i, j; | ||
| 105 | |||
| 106 | for(i = 0; !seltag[i]; i++); | ||
| 107 | for(j = i + 1; j < ntags && !seltag[j]; j++); | ||
| 108 | if(j < ntags) | ||
| 109 | return; /* more then one tag selected */ | ||
| 110 | seltag[i] = False; | ||
| 111 | i += arg ? atoi(arg) : 0; | ||
| 112 | if(i < 0) | ||
| 113 | i = ntags - 1; | ||
| 114 | else if(i >= ntags) | ||
| 115 | i = 0; | ||
| 116 | seltag[i] = True; | ||
| 117 | lt->arrange(); | ||
| 118 | } | ||
| 119 | |||
| 102 | void | 120 | void |
| 103 | tag(const char *arg) { | 121 | tag(const char *arg) { |
| 104 | int i; | 122 | int i; |
