changed replacetag into toggletag
This commit is contained in:
parent
666fae97e6
commit
19da197f58
12
config.arg.h
12
config.arg.h
|
@ -33,17 +33,17 @@ static Key key[] = { \
|
|||
{ MODKEY|ControlMask, XK_1, toggleview, { .i = 0 } }, \
|
||||
{ MODKEY|ControlMask, XK_2, toggleview, { .i = 1 } }, \
|
||||
{ MODKEY|ControlMask, XK_3, toggleview, { .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_1, tag, { .i = 0 } }, \
|
||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 1 } }, \
|
||||
{ MODKEY|ShiftMask, XK_3, tag, { .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, appendtag, { .i = 0 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_2, appendtag, { .i = 1 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_3, appendtag, { .i = 2 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 0 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 1 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 2 } }, \
|
||||
};
|
||||
|
||||
#define RULES \
|
||||
|
|
|
@ -34,19 +34,19 @@ static Key key[] = { \
|
|||
{ MODKEY|ControlMask, XK_2, toggleview, { .i = 2 } }, \
|
||||
{ MODKEY|ControlMask, XK_3, toggleview, { .i = 3 } }, \
|
||||
{ MODKEY|ControlMask, XK_4, toggleview, { .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_0, tag, { .i = 0 } }, \
|
||||
{ MODKEY|ShiftMask, XK_1, tag, { .i = 1 } }, \
|
||||
{ MODKEY|ShiftMask, XK_2, tag, { .i = 2 } }, \
|
||||
{ MODKEY|ShiftMask, XK_3, tag, { .i = 3 } }, \
|
||||
{ MODKEY|ShiftMask, XK_4, tag, { .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, appendtag, { .i = 0 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_1, appendtag, { .i = 1 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_2, appendtag, { .i = 2 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_3, appendtag, { .i = 3 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_4, appendtag, { .i = 4 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_0, toggletag, { .i = 0 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_1, toggletag, { .i = 1 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_2, toggletag, { .i = 2 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_3, toggletag, { .i = 3 } }, \
|
||||
{ MODKEY|ControlMask|ShiftMask, XK_4, toggletag, { .i = 4 } }, \
|
||||
};
|
||||
|
||||
#define RULES \
|
||||
|
|
6
dwm.h
6
dwm.h
|
@ -116,19 +116,19 @@ extern void sendevent(Window w, Atom a, long value);
|
|||
extern int xerror(Display *dsply, XErrorEvent *ee);
|
||||
|
||||
/* tag.c */
|
||||
extern void appendtag(Arg *arg);
|
||||
extern void dofloat(Arg *arg);
|
||||
extern void dotile(Arg *arg);
|
||||
extern void initrregs();
|
||||
extern Bool isvisible(Client *c);
|
||||
extern Client *getnext(Client *c);
|
||||
extern Client *getprev(Client *c);
|
||||
extern void replacetag(Arg *arg);
|
||||
extern void restack();
|
||||
extern void settags(Client *c);
|
||||
extern void tag(Arg *arg);
|
||||
extern void togglemode(Arg *arg);
|
||||
extern void view(Arg *arg);
|
||||
extern void toggletag(Arg *arg);
|
||||
extern void toggleview(Arg *arg);
|
||||
extern void view(Arg *arg);
|
||||
|
||||
/* util.c */
|
||||
extern void *emallocz(unsigned int size);
|
||||
|
|
77
tag.c
77
tag.c
|
@ -34,16 +34,6 @@ void (*arrange)(Arg *) = DEFMODE;
|
|||
|
||||
/* extern */
|
||||
|
||||
void
|
||||
appendtag(Arg *arg)
|
||||
{
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
sel->tags[arg->i] = True;
|
||||
settitle(sel);
|
||||
}
|
||||
|
||||
void
|
||||
dofloat(Arg *arg)
|
||||
{
|
||||
|
@ -182,19 +172,6 @@ isvisible(Client *c)
|
|||
return False;
|
||||
}
|
||||
|
||||
void
|
||||
replacetag(Arg *arg)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(i = 0; i < ntags; i++)
|
||||
sel->tags[i] = False;
|
||||
appendtag(arg);
|
||||
}
|
||||
|
||||
void
|
||||
restack()
|
||||
{
|
||||
|
@ -280,6 +257,20 @@ settags(Client *c)
|
|||
c->tags[i] = seltag[i];
|
||||
}
|
||||
|
||||
void
|
||||
tag(Arg *arg)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(i = 0; i < ntags; i++)
|
||||
sel->tags[i] = False;
|
||||
sel->tags[arg->i] = True;
|
||||
settitle(sel);
|
||||
}
|
||||
|
||||
void
|
||||
togglemode(Arg *arg)
|
||||
{
|
||||
|
@ -287,6 +278,34 @@ togglemode(Arg *arg)
|
|||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
toggletag(Arg *arg)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
sel->tags[arg->i] = !sel->tags[arg->i];
|
||||
for(i = 0; i < ntags && !sel->tags[i]; i++);
|
||||
if(i == ntags)
|
||||
sel->tags[arg->i] = True;
|
||||
settitle(sel);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
toggleview(Arg *arg)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
seltag[arg->i] = !seltag[arg->i];
|
||||
for(i = 0; i < ntags && !seltag[i]; i++);
|
||||
if(i == ntags)
|
||||
seltag[arg->i] = True; /* cannot toggle last view */
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
view(Arg *arg)
|
||||
{
|
||||
|
@ -297,15 +316,3 @@ view(Arg *arg)
|
|||
seltag[arg->i] = True;
|
||||
arrange(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
toggleview(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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue