From 3652a4060c98d4583b76948b7115a102ae524cc0 Mon Sep 17 00:00:00 2001 From: Raphael Khaiat Date: Sun, 23 Jan 2011 23:56:21 +0100 Subject: [PATCH] Add feature for following a client that is open in a different tag. Feature requested by anonymous_user on the wmfs thread in the archlinux.org forum --- src/client.c | 3 +++ src/config.c | 17 +++++++++-------- src/structs.h | 1 + wmfsrc | 15 ++++++++------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/client.c b/src/client.c index 0464872..1448a72 100644 --- a/src/client.c +++ b/src/client.c @@ -1107,6 +1107,9 @@ client_set_rules(Client *c) if(!conf.rule[i].ignoretags) tags[c->screen][c->tag].layout.func(c->screen); + + if(conf.rule[i].follow_client) + seltag[c->screen] = c->tag; } } } diff --git a/src/config.c b/src/config.c index f72d42d..5b45b93 100644 --- a/src/config.c +++ b/src/config.c @@ -628,14 +628,15 @@ conf_rule_section(void) for(i = 0; i < conf.nrule; ++i) { - conf.rule[i].class = fetch_opt_first(rule[i], "", "class").str; - conf.rule[i].instance = fetch_opt_first(rule[i], "", "instance").str; - conf.rule[i].role = fetch_opt_first(rule[i], "", "role").str; - conf.rule[i].screen = fetch_opt_first(rule[i], "-1", "screen").num; - conf.rule[i].tag = fetch_opt_first(rule[i], "-1", "tag").num; - conf.rule[i].free = fetch_opt_first(rule[i], "false", "free").bool; - conf.rule[i].max = fetch_opt_first(rule[i], "false", "max").bool; - conf.rule[i].ignoretags = fetch_opt_first(rule[i], "false", "ignoretags").bool; + conf.rule[i].class = fetch_opt_first(rule[i], "", "class").str; + conf.rule[i].instance = fetch_opt_first(rule[i], "", "instance").str; + conf.rule[i].role = fetch_opt_first(rule[i], "", "role").str; + conf.rule[i].screen = fetch_opt_first(rule[i], "-1", "screen").num; + conf.rule[i].tag = fetch_opt_first(rule[i], "-1", "tag").num; + conf.rule[i].free = fetch_opt_first(rule[i], "false", "free").bool; + conf.rule[i].max = fetch_opt_first(rule[i], "false", "max").bool; + conf.rule[i].ignoretags = fetch_opt_first(rule[i], "false", "ignoretags").bool; + conf.rule[i].follow_client = fetch_opt_first(rule[i], "false", "follow_client").bool; } free(rule); diff --git a/src/structs.h b/src/structs.h index 55e7b33..27807d0 100644 --- a/src/structs.h +++ b/src/structs.h @@ -365,6 +365,7 @@ typedef struct Bool free; Bool max; Bool ignoretags; + Bool follow_client; } Rule; /* Configuration structure */ diff --git a/wmfsrc b/wmfsrc index ad8422d..748a865 100644 --- a/wmfsrc +++ b/wmfsrc @@ -211,13 +211,14 @@ [rules] # Example of rule for MPlayer [rule] - instance = "xv" # First part of WM_CLASS - class = "MPlayer" # Seconf part of WM_CLASS, not needed if first part is correct - # role = "" # WM_WINDOW_ROLE - screen = 0 # Screen to use - tag = 2 # Tag number of apps - free = true # Set automatic free client - max = false # Set automatic maximized client + instance = "xv" # First part of WM_CLASS + class = "MPlayer" # Seconf part of WM_CLASS, not needed if first part is correct + # role = "" # WM_WINDOW_ROLE + screen = 0 # Screen to use + tag = 2 # Tag number of apps + free = true # Set automatic free client + max = false # Set automatic maximized client + follow_client = false # follow the client [/rule] [/rules]