From 4064cbdfd9cab3b82cbec439f5073b7d3bb181c6 Mon Sep 17 00:00:00 2001 From: Viet Nguyen Quoc Date: Sun, 20 Mar 2011 11:31:31 +0700 Subject: [PATCH] Add client_set_master command The function swaps selected client with the first one (master). --- src/client.c | 24 ++++++++++++++++++++++++ src/config.c | 1 + src/wmfs.h | 1 + 3 files changed, 26 insertions(+) diff --git a/src/client.c b/src/client.c index 7ed498d..0641925 100644 --- a/src/client.c +++ b/src/client.c @@ -1628,3 +1628,27 @@ uicb_client_ignore_tag(uicb_t cmd) return; } + +/** Set current client as master + *\para cmd uicb_t type unused +*/ +void +uicb_client_set_master(uicb_t cmd) +{ + Client *c; + (void)cmd; + + /* get the first client */ + screen_get_sel(); + if(!sel || ishide(sel, selscreen)) + return; + + for(c = clients; c && ishide(c, selscreen); c = c->next); + + if (c && c != sel) + { + client_swap(c, sel); + client_focus(c); + } + return; +} diff --git a/src/config.c b/src/config.c index e452a08..07f4ac3 100644 --- a/src/config.c +++ b/src/config.c @@ -50,6 +50,7 @@ const func_name_list_t func_list[] = {"client_move", uicb_client_move }, {"client_resize", uicb_client_resize }, {"client_ignore_tag", uicb_client_ignore_tag }, + {"client_set_master", uicb_client_set_master }, {"toggle_max", uicb_togglemax }, {"layout_next", uicb_layout_next }, {"layout_prev", uicb_layout_prev }, diff --git a/src/wmfs.h b/src/wmfs.h index d540757..b0c3890 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -201,6 +201,7 @@ void uicb_ignore_next_client_rules(uicb_t cmd); void uicb_clientlist(uicb_t cmd); Bool uicb_checkclist(uicb_t); void uicb_client_ignore_tag(uicb_t); +void uicb_client_set_master(uicb_t); /* ewmh.c */ void ewmh_init_hints(void);