implemented viewextend and added M-S-C-n shortcuts for extending the current view... updated man page (works great!) nice feature

keyboard
Anselm R.Garbe 19 years ago
parent d7413ffd2d
commit 292ccc4c43
  1. 3
      config.arg.h
  2. 5
      config.default.h
  3. 4
      draw.c
  4. 21
      dwm.1
  5. 3
      dwm.h
  6. 7
      event.c
  7. 6
      main.c
  8. 25
      tag.c

@ -43,6 +43,9 @@ static Key key[] = { \
{ 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 \

@ -44,6 +44,11 @@ static Key key[] = { \
{ 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 \

@ -109,9 +109,9 @@ drawstatus()
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);

21
dwm.1

@ -36,14 +36,21 @@ prints version information to standard output, then exits.
.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
@ -108,6 +115,12 @@ Append
.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

@ -74,7 +74,7 @@ extern unsigned int ntags;
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;
@ -128,6 +128,7 @@ extern void replacetag(Arg *arg);
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);

@ -108,11 +108,8 @@ buttonpress(XEvent *e)
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;

@ -83,7 +83,7 @@ xerrorstart(Display *dsply, XErrorEvent *ee)
/* 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];
@ -213,8 +213,8 @@ main(int argc, char *argv[])
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);

25
tag.c

@ -181,7 +181,7 @@ isvisible(Client *c)
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;
}
@ -229,7 +229,7 @@ settags(Client *c)
}
if(!matched)
for(i = 0; i < ntags; i++)
c->tags[i] = tsel[i];
c->tags[i] = seltag[i];
}
void
@ -245,8 +245,21 @@ view(Arg *arg)
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();
}
@ -256,7 +269,7 @@ viewnext(Arg *arg)
{
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);
}
@ -266,7 +279,7 @@ viewprev(Arg *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);
}

Loading…
Cancel
Save