handle uicb_client_toggletag() with no args or with i > ntags
This commit is contained in:
parent
d46f740a39
commit
51911613c5
27
tag.c
27
tag.c
|
@ -120,16 +120,29 @@ uicb_client_toggletag(awesome_config *awesomeconf,
|
||||||
const char *arg)
|
const char *arg)
|
||||||
{
|
{
|
||||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||||
unsigned int i;
|
int i, j;
|
||||||
int j;
|
|
||||||
|
|
||||||
if(!sel)
|
if(!sel)
|
||||||
return;
|
return;
|
||||||
i = arg ? atoi(arg) - 1 : 0;
|
|
||||||
sel->tags[i] = !sel->tags[i];
|
if(arg)
|
||||||
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
{
|
||||||
if(j == awesomeconf->ntags)
|
i = atoi(arg) - 1;
|
||||||
sel->tags[i] = True;
|
|
||||||
|
if(i >= awesomeconf->ntags)
|
||||||
|
return;
|
||||||
|
|
||||||
|
sel->tags[i] = !sel->tags[i];
|
||||||
|
|
||||||
|
/* check that there's at least one tag selected for this client*/
|
||||||
|
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
||||||
|
if(j == awesomeconf->ntags)
|
||||||
|
sel->tags[i] = True;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
for(i = 0; i < awesomeconf->ntags; i++)
|
||||||
|
sel->tags[i] = True;
|
||||||
|
|
||||||
saveprops(sel, awesomeconf->ntags);
|
saveprops(sel, awesomeconf->ntags);
|
||||||
arrange(awesomeconf);
|
arrange(awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue