add tag_view() function
This commit is contained in:
parent
2592d3032c
commit
67c155c0dd
44
tag.c
44
tag.c
|
@ -286,15 +286,16 @@ uicb_tag_toggleview(int screen, char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
tag_view_only(int screen, Tag *target)
|
tag_view_only(Tag *target, int screen)
|
||||||
{
|
{
|
||||||
Tag *tag;
|
Tag *tag;
|
||||||
|
|
||||||
if(!target) return;
|
if(!target) return;
|
||||||
|
|
||||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||||
tag->selected = False;
|
tag_view(tag, False, screen);
|
||||||
target->selected = True;
|
|
||||||
|
tag_view(target, True, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -307,7 +308,16 @@ tag_view_only_byindex(int screen, int dindex)
|
||||||
|
|
||||||
for(tag = globalconf.screens[screen].tags; tag && dindex > 0;
|
for(tag = globalconf.screens[screen].tags; tag && dindex > 0;
|
||||||
tag = tag->next, dindex--);
|
tag = tag->next, dindex--);
|
||||||
tag_view_only(screen, tag);
|
tag_view_only(tag, screen);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
tag_view(Tag *tag, Bool view, int screen)
|
||||||
|
{
|
||||||
|
tag->selected = view;
|
||||||
|
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
||||||
|
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
||||||
|
saveawesomeprops(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View tag
|
/** View tag
|
||||||
|
@ -324,12 +334,9 @@ uicb_tag_view(int screen, char *arg)
|
||||||
tag_view_only_byindex(screen, atoi(arg) - 1);
|
tag_view_only_byindex(screen, atoi(arg) - 1);
|
||||||
else
|
else
|
||||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||||
tag->selected = True;
|
tag_view(tag, True, screen);
|
||||||
|
|
||||||
saveawesomeprops(screen);
|
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View previously selected tags
|
/** View previously selected tags
|
||||||
|
@ -346,13 +353,11 @@ uicb_tag_prev_selected(int screen, char *arg __attribute__ ((unused)))
|
||||||
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
|
||||||
{
|
{
|
||||||
t = tag->selected;
|
t = tag->selected;
|
||||||
tag->selected = tag->was_selected;
|
tag_view(tag, tag->was_selected, screen);
|
||||||
tag->was_selected = t;
|
tag->was_selected = t;
|
||||||
}
|
}
|
||||||
saveawesomeprops(screen);
|
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View next tag
|
/** View next tag
|
||||||
|
@ -370,15 +375,11 @@ uicb_tag_viewnext(int screen, char *arg __attribute__ ((unused)))
|
||||||
else
|
else
|
||||||
tag = globalconf.screens[screen].tags;
|
tag = globalconf.screens[screen].tags;
|
||||||
|
|
||||||
curtags[0]->selected = False;
|
tag_view(curtags[0], False, screen);
|
||||||
tag->selected = True;
|
tag_view(tag, True, screen);
|
||||||
|
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
|
|
||||||
saveawesomeprops(screen);
|
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** View previous tag
|
/** View previous tag
|
||||||
|
@ -393,14 +394,11 @@ uicb_tag_viewprev(int screen, char *arg __attribute__ ((unused)))
|
||||||
|
|
||||||
tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]);
|
tag = tag_list_prev_cycle(&globalconf.screens[screen].tags, curtags[0]);
|
||||||
|
|
||||||
curtags[0]->selected = False;
|
tag_view(curtags[0], False, screen);
|
||||||
tag->selected = True;
|
tag_view(tag, True, screen);
|
||||||
|
|
||||||
p_delete(&curtags);
|
p_delete(&curtags);
|
||||||
saveawesomeprops(screen);
|
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
ewmh_update_net_current_desktop(get_phys_screen(screen));
|
|
||||||
widget_invalidate_cache(screen, WIDGET_CACHE_TAGS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
1
tag.h
1
tag.h
|
@ -28,6 +28,7 @@
|
||||||
#define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen))
|
#define IS_TILED(client, screen) (client && !client->isfloating && client_isvisible(client, screen))
|
||||||
|
|
||||||
Tag * tag_new(const char *, Layout *, double, int, int);
|
Tag * tag_new(const char *, Layout *, double, int, int);
|
||||||
|
void tag_view(Tag *, Bool, int);
|
||||||
void tag_push_to_screen(Tag *, int);
|
void tag_push_to_screen(Tag *, int);
|
||||||
Tag ** get_current_tags(int);
|
Tag ** get_current_tags(int);
|
||||||
void tag_client(Client *, Tag *);
|
void tag_client(Client *, Tag *);
|
||||||
|
|
Loading…
Reference in New Issue