#define KEYS \
static Key key[] = { \
- /* modifier key function arguments */ \
- { MODKEY, XK_1, view, { .i = 0 } }, \
- { MODKEY, XK_2, view, { .i = 1 } }, \
- { MODKEY, XK_3, view, { .i = 2 } }, \
- { MODKEY, XK_h, viewprev, { 0 } }, \
- { MODKEY, XK_j, focusnext, { 0 } }, \
- { MODKEY, XK_k, focusprev, { 0 } }, \
- { MODKEY, XK_l, viewnext, { 0 } }, \
- { MODKEY, XK_m, togglemax, { 0 } }, \
- { MODKEY, XK_p, spawn, \
+ /* modifier key function arguments */ \
+ { MODKEY, XK_1, view, { .i = 0 } }, \
+ { MODKEY, XK_2, view, { .i = 1 } }, \
+ { MODKEY, XK_3, view, { .i = 2 } }, \
+ { MODKEY, XK_h, viewprev, { 0 } }, \
+ { MODKEY, XK_j, focusnext, { 0 } }, \
+ { MODKEY, XK_k, focusprev, { 0 } }, \
+ { MODKEY, XK_l, viewnext, { 0 } }, \
+ { MODKEY, XK_m, togglemax, { 0 } }, \
+ { MODKEY, XK_p, spawn, \
{ .cmd = "exec `ls -lL /usr/bin /usr/local/bin 2>/dev/null | " \
"awk 'NF>2 && $1 ~ /^[^d].*x/ {print $NF}' | sort | uniq | dmenu`" } }, \
- { MODKEY, XK_space, togglemode, { 0 } }, \
- { MODKEY, XK_Return, zoom, { 0 } }, \
- { MODKEY|ControlMask, XK_1, appendtag, { .i = 0 } }, \
- { MODKEY|ControlMask, XK_2, appendtag, { .i = 1 } }, \
- { MODKEY|ControlMask, XK_3, appendtag, { .i = 2 } }, \
- { MODKEY|ShiftMask, XK_1, replacetag, { .i = 0 } }, \
- { MODKEY|ShiftMask, XK_2, replacetag, { .i = 1 } }, \
- { MODKEY|ShiftMask, XK_3, replacetag, { .i = 2 } }, \
- { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
- { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
- { MODKEY|ShiftMask, XK_Return, spawn, \
+ { MODKEY, XK_space, togglemode, { 0 } }, \
+ { MODKEY, XK_Return, zoom, { 0 } }, \
+ { MODKEY|ControlMask, XK_1, appendtag, { .i = 0 } }, \
+ { MODKEY|ControlMask, XK_2, appendtag, { .i = 1 } }, \
+ { MODKEY|ControlMask, XK_3, appendtag, { .i = 2 } }, \
+ { MODKEY|ShiftMask, XK_1, replacetag, { .i = 0 } }, \
+ { MODKEY|ShiftMask, XK_2, replacetag, { .i = 1 } }, \
+ { MODKEY|ShiftMask, XK_3, replacetag, { .i = 2 } }, \
+ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
+ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
+ { MODKEY|ShiftMask, XK_Return, spawn, \
{ .cmd = "exec urxvt +sb -tr -bg black -fg '#eeeeee' -cr '#eeeeee' +sb " \
"-fn '-*-terminus-medium-*-*-*-12-*-*-*-*-*-iso10646-*'" } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_1, viewextend, { .i = 0 } }, \
+ { MODKEY|ShiftMask, XK_2, viewextend, { .i = 1 } }, \
+ { MODKEY|ShiftMask, XK_3, viewextend, { .i = 2 } }, \
};
#define RULES \
#define KEYS \
static Key key[] = { \
- /* modifier key function arguments */ \
- { MODKEY, XK_0, view, { .i = 0 } }, \
- { MODKEY, XK_1, view, { .i = 1 } }, \
- { MODKEY, XK_2, view, { .i = 2 } }, \
- { MODKEY, XK_3, view, { .i = 3 } }, \
- { MODKEY, XK_4, view, { .i = 4 } }, \
- { MODKEY, XK_h, viewprev, { 0 } }, \
- { MODKEY, XK_j, focusnext, { 0 } }, \
- { MODKEY, XK_k, focusprev, { 0 } }, \
- { MODKEY, XK_l, viewnext, { 0 } }, \
- { MODKEY, XK_m, togglemax, { 0 } }, \
- { MODKEY, XK_space, togglemode, { 0 } }, \
- { MODKEY, XK_Return, zoom, { 0 } }, \
- { MODKEY|ControlMask, XK_0, appendtag, { .i = 0 } }, \
- { MODKEY|ControlMask, XK_1, appendtag, { .i = 1 } }, \
- { MODKEY|ControlMask, XK_2, appendtag, { .i = 2 } }, \
- { MODKEY|ControlMask, XK_3, appendtag, { .i = 3 } }, \
- { MODKEY|ControlMask, XK_4, appendtag, { .i = 4 } }, \
- { MODKEY|ShiftMask, XK_0, replacetag, { .i = 0 } }, \
- { MODKEY|ShiftMask, XK_1, replacetag, { .i = 1 } }, \
- { MODKEY|ShiftMask, XK_2, replacetag, { .i = 2 } }, \
- { MODKEY|ShiftMask, XK_3, replacetag, { .i = 3 } }, \
- { MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \
- { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
- { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
- { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \
+ /* modifier key function arguments */ \
+ { MODKEY, XK_0, view, { .i = 0 } }, \
+ { MODKEY, XK_1, view, { .i = 1 } }, \
+ { MODKEY, XK_2, view, { .i = 2 } }, \
+ { MODKEY, XK_3, view, { .i = 3 } }, \
+ { MODKEY, XK_4, view, { .i = 4 } }, \
+ { MODKEY, XK_h, viewprev, { 0 } }, \
+ { MODKEY, XK_j, focusnext, { 0 } }, \
+ { MODKEY, XK_k, focusprev, { 0 } }, \
+ { MODKEY, XK_l, viewnext, { 0 } }, \
+ { MODKEY, XK_m, togglemax, { 0 } }, \
+ { MODKEY, XK_space, togglemode, { 0 } }, \
+ { MODKEY, XK_Return, zoom, { 0 } }, \
+ { MODKEY|ControlMask, XK_0, appendtag, { .i = 0 } }, \
+ { MODKEY|ControlMask, XK_1, appendtag, { .i = 1 } }, \
+ { MODKEY|ControlMask, XK_2, appendtag, { .i = 2 } }, \
+ { MODKEY|ControlMask, XK_3, appendtag, { .i = 3 } }, \
+ { MODKEY|ControlMask, XK_4, appendtag, { .i = 4 } }, \
+ { MODKEY|ShiftMask, XK_0, replacetag, { .i = 0 } }, \
+ { MODKEY|ShiftMask, XK_1, replacetag, { .i = 1 } }, \
+ { MODKEY|ShiftMask, XK_2, replacetag, { .i = 2 } }, \
+ { MODKEY|ShiftMask, XK_3, replacetag, { .i = 3 } }, \
+ { MODKEY|ShiftMask, XK_4, replacetag, { .i = 4 } }, \
+ { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, \
+ { MODKEY|ShiftMask, XK_q, quit, { 0 } }, \
+ { MODKEY|ShiftMask, XK_Return, spawn, { .cmd = "exec xterm" } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_0, viewextend, { .i = 0 } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_1, viewextend, { .i = 1 } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_2, viewextend, { .i = 2 } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_3, viewextend, { .i = 3 } }, \
+ { MODKEY|ControlMask|ShiftMask, XK_4, viewextend, { .i = 4 } }, \
};
#define RULES \
dc.x += dc.w;
dc.w = textw(tags[i]);
if(istile)
- drawtext(tags[i], tsel[i]);
+ drawtext(tags[i], seltag[i]);
else
- drawtext(tags[i], !tsel[i]);
+ drawtext(tags[i], !seltag[i]);
}
x = dc.x + dc.w;
dc.w = textw(stext);
.B Standard input
is read and displayed in the status text area.
.TP
-.B Button[1-3]
-click on a tag label focuses that tag.
+.B Button[1,3]
+click on a tag label focuses that
+.B tag.
+.TP
+.B Button2
+click on a tag label (un)extends the current
+.B tag.
.TP
.B Button[1,4]
-click on the bar focuses the previous tag.
+click on the bar focuses the previous
+.B tag.
.TP
.B Button[2,5]
-click on the bar focuses the next tag.
+click on the bar focuses the next
+.B tag.
.SS Keyboard commands
.TP
.B Mod1-Return
.B nth tag
to current
.B window.
+.TP
+.B Mod1-Control-Shift-[0..n]
+(Un)extends
+.B nth tag
+with current
+.B tag.
.SS Mouse commands
.TP
.B Mod1-Button1
extern void (*handler[LASTEvent])(XEvent *);
extern void (*arrange)(Arg *);
extern Atom wmatom[WMLast], netatom[NetLast];
-extern Bool running, issel, *tsel;
+extern Bool running, issel, *seltag;
extern Client *clients, *sel;
extern Cursor cursor[CurLast];
extern DC dc;
extern void settags(Client *c);
extern void togglemode(Arg *arg);
extern void view(Arg *arg);
+extern void viewextend(Arg *arg);
extern void viewnext(Arg *arg);
extern void viewprev(Arg *arg);
for(a.i = 0; a.i < ntags; a.i++) {
x += textw(tags[a.i]);
if(ev->x < x) {
- if(ev->button == Button3) {
- tsel[a.i] = True;
- arrange(NULL);
- drawall();
- }
+ if(ev->button == Button3)
+ viewextend(&a);
else
view(&a);
return;
/* extern */
char stext[1024];
-Bool *tsel;
+Bool *seltag;
int screen, sx, sy, sw, sh, bx, by, bw, bh, mw;
unsigned int ntags;
Atom wmatom[WMLast], netatom[NetLast];
initrregs();
for(ntags = 0; tags[ntags]; ntags++);
- tsel = emallocz(sizeof(Bool) * ntags);
- tsel[DEFTAG] = True;
+ seltag = emallocz(sizeof(Bool) * ntags);
+ seltag[DEFTAG] = True;
/* style */
dc.bg = getcolor(BGCOLOR);
unsigned int i;
for(i = 0; i < ntags; i++)
- if(c->tags[i] && tsel[i])
+ if(c->tags[i] && seltag[i])
return True;
return False;
}
}
if(!matched)
for(i = 0; i < ntags; i++)
- c->tags[i] = tsel[i];
+ c->tags[i] = seltag[i];
}
void
unsigned int i;
for(i = 0; i < ntags; i++)
- tsel[i] = False;
- tsel[arg->i] = True;
+ seltag[i] = False;
+ seltag[arg->i] = True;
+ arrange(NULL);
+ drawall();
+}
+
+void
+viewextend(Arg *arg)
+{
+ unsigned int i;
+
+ seltag[arg->i] = !seltag[arg->i];
+ for(i = 0; !seltag[i] && i < ntags; i++);
+ if(i == ntags)
+ seltag[arg->i] = True; /* cannot toggle last view */
arrange(NULL);
drawall();
}
{
unsigned int i;
- for(i = 0; !tsel[i]; i++);
+ for(i = 0; !seltag[i]; i++);
arg->i = (i < ntags-1) ? i+1 : 0;
view(arg);
}
{
unsigned int i;
- for(i = 0; !tsel[i]; i++);
+ for(i = 0; !seltag[i]; i++);
arg->i = (i > 0) ? i-1 : ntags-1;
view(arg);
}