summaryrefslogtreecommitdiffstats
path: root/window-tree.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-11-02 20:01:26 +0000
committerThomas Adam <thomas@xteddy.org>2017-11-02 20:01:26 +0000
commit8c29f7413bd41e0f7afb1b53dc73128dfd42fb6f (patch)
tree2a8ecf685a8f14f673a6b7e1036c7d5ac79032f1 /window-tree.c
parentcf782c4f546fb11f3157de7aecff85845b0dbed9 (diff)
parent17655e5ba65e37787cd9920e1a89aedf6f623957 (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'window-tree.c')
-rw-r--r--window-tree.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/window-tree.c b/window-tree.c
index a58154b8..a1c511de 100644
--- a/window-tree.c
+++ b/window-tree.c
@@ -43,8 +43,10 @@ static void window_tree_key(struct window_pane *,
"#{?#{==:#{window_panes},1}, \"#{pane_title}\",}" \
"," \
"#{session_windows} windows" \
- "#{?session_grouped, (group ,}" \
- "#{session_group}#{?session_grouped,),}" \
+ "#{?session_grouped, " \
+ "(group #{session_group}: " \
+ "#{session_group_list})," \
+ "}" \
"#{?session_attached, (attached),}" \
"}" \
"}"
@@ -91,6 +93,7 @@ struct window_tree_modedata {
struct mode_tree_data *data;
char *format;
char *command;
+ int squash_groups;
struct window_tree_itemdata **item_list;
u_int item_size;
@@ -394,8 +397,11 @@ window_tree_build(void *modedata, u_int sort_type, uint64_t *tag,
{
struct window_tree_modedata *data = modedata;
struct session *s, **l;
+ struct session_group *sg, *current;
u_int n, i;
+ current = session_group_contains(data->fs.s);
+
for (i = 0; i < data->item_size; i++)
window_tree_free_item(data->item_list[i]);
free(data->item_list);
@@ -405,6 +411,12 @@ window_tree_build(void *modedata, u_int sort_type, uint64_t *tag,
l = NULL;
n = 0;
RB_FOREACH(s, sessions, &sessions) {
+ if (data->squash_groups &&
+ (sg = session_group_contains(s)) != NULL) {
+ if ((sg == current && s != data->fs.s) ||
+ (sg != current && s != TAILQ_FIRST(&sg->sessions)))
+ continue;
+ }
l = xreallocarray(l, n + 1, sizeof *l);
l[n++] = s;
}
@@ -805,6 +817,7 @@ window_tree_init(struct window_pane *wp, struct cmd_find_state *fs,
data->command = xstrdup(WINDOW_TREE_DEFAULT_COMMAND);
else
data->command = xstrdup(args->argv[0]);
+ data->squash_groups = !args_has(args, 'G');
data->data = mode_tree_start(wp, args, window_tree_build,
window_tree_draw, window_tree_search, data, window_tree_sort_list,