From 36c0e0671de9832284377d55ce9b7217e2c0342c Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Wed, 18 Jan 2012 23:33:22 +0100 Subject: [PATCH] Add uicb client move to next/prev tag --- src/config.h | 12 +++++++----- src/tag.c | 29 +++++++++++++++++++++++++++++ src/tag.h | 2 ++ 3 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/config.h b/src/config.h index 9dc8583..e95e411 100644 --- a/src/config.h +++ b/src/config.h @@ -28,11 +28,13 @@ static const struct { char *name; void (*func)(Uicb cmd); } uicb_list[] = { "reload", uicb_reload }, /* Tag */ - { "tag_set", uicb_tag_set }, - { "tag", uicb_tag_set_with_name }, - { "tag_next", uicb_tag_next }, - { "tag_prev", uicb_tag_prev }, - { "tag_client", uicb_tag_client }, + { "tag_set", uicb_tag_set }, + { "tag", uicb_tag_set_with_name }, + { "tag_next", uicb_tag_next }, + { "tag_prev", uicb_tag_prev }, + { "tag_client", uicb_tag_client }, + { "tag_move_client_next", uicb_tag_move_client_next }, + { "tag_move_client_prev", uicb_tag_move_client_prev }, /* Layout */ { "layout_vmirror", uicb_layout_vmirror }, diff --git a/src/tag.c b/src/tag.c index 55bb676..d389b29 100644 --- a/src/tag.c +++ b/src/tag.c @@ -176,6 +176,35 @@ uicb_tag_client(Uicb cmd) tag_client(t, W->client); } +void +uicb_tag_move_client_next(Uicb cmd) +{ + (void)cmd; + struct tag *t; + + /* Remove from current tag */ + tag_client(NULL, W->client); + + if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) + tag_client(t, W->client); + else if( /* CIRCULAR OPTION */ 1) + tag_client(TAILQ_FIRST(&W->screen->tags, tsub), W->client); +} + +void +uicb_tag_move_client_prev(Uicb cmd) +{ + (void)cmd; + struct tag *t; + + /* Remove from current tag */ + tag_client(NULL, W->client); + + if((t = TAILQ_PREV(W->screen->seltag, tsub, next))) + tag_client(t, W->client); + else if( /* CIRCULAR OPTION */ 1) + tag_client(TAILQ_LAST(&W->screen->tags, tsub), W->client); +} static void tag_remove(struct tag *t) diff --git a/src/tag.h b/src/tag.h index 345b98a..0311ad1 100644 --- a/src/tag.h +++ b/src/tag.h @@ -30,6 +30,8 @@ void uicb_tag_set_with_name(Uicb cmd); void uicb_tag_next(Uicb cmd); void uicb_tag_prev(Uicb cmd); void uicb_tag_client(Uicb cmd); +void uicb_tag_move_client_next(Uicb cmd); +void uicb_tag_move_client_prev(Uicb cmd); #endif /* TAG_H */