summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/window-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/window-client.c')
-rw-r--r--usr.bin/tmux/window-client.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/usr.bin/tmux/window-client.c b/usr.bin/tmux/window-client.c
index 564481d3013..6a6e109eeef 100644
--- a/usr.bin/tmux/window-client.c
+++ b/usr.bin/tmux/window-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: window-client.c,v 1.21 2019/03/18 20:53:33 nicm Exp $ */
+/* $OpenBSD: window-client.c,v 1.22 2019/05/12 08:58:09 nicm Exp $ */
/*
* Copyright (c) 2017 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -40,6 +40,16 @@ static void window_client_key(struct window_mode_entry *,
"session #{session_name} " \
"(#{client_width}x#{client_height}, #{t:client_activity})"
+#define WINDOW_CLIENT_MENU \
+ "Detach,d,|" \
+ "Detach Tagged,D,|" \
+ "|" \
+ "Tag,t,|" \
+ "Tag All,C-t,|" \
+ "Tag None,T,|" \
+ "|" \
+ "Cancel,q,"
+
const struct window_mode window_client_mode = {
.name = "client-mode",
.default_format = WINDOW_CLIENT_DEFAULT_FORMAT,
@@ -68,6 +78,8 @@ struct window_client_itemdata {
};
struct window_client_modedata {
+ struct window_pane *wp;
+
struct mode_tree_data *data;
char *format;
char *command;
@@ -249,6 +261,19 @@ window_client_draw(__unused void *modedata, void *itemdata,
screen_write_fast_copy(ctx, &c->status.screen, 0, 0, sx, lines);
}
+static void
+window_client_menu(void *modedata, struct client *c, key_code key)
+{
+ struct window_client_modedata *data = modedata;
+ struct window_pane *wp = data->wp;
+ struct window_mode_entry *wme;
+
+ wme = TAILQ_FIRST(&wp->modes);
+ if (wme == NULL || wme->data != modedata)
+ return;
+ window_client_key(wme, c, NULL, NULL, key, NULL);
+}
+
static struct screen *
window_client_init(struct window_mode_entry *wme,
__unused struct cmd_find_state *fs, struct args *args)
@@ -258,6 +283,7 @@ window_client_init(struct window_mode_entry *wme,
struct screen *s;
wme->data = data = xcalloc(1, sizeof *data);
+ data->wp = wp;
if (args == NULL || !args_has(args, 'F'))
data->format = xstrdup(WINDOW_CLIENT_DEFAULT_FORMAT);
@@ -269,7 +295,8 @@ window_client_init(struct window_mode_entry *wme,
data->command = xstrdup(args->argv[0]);
data->data = mode_tree_start(wp, args, window_client_build,
- window_client_draw, NULL, data, window_client_sort_list,
+ window_client_draw, NULL, window_client_menu, data,
+ WINDOW_CLIENT_MENU, window_client_sort_list,
nitems(window_client_sort_list), &s);
mode_tree_zoom(data->data, args);