summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tmux/cmd-set-option.c8
-rw-r--r--usr.bin/tmux/cmd-show-options.c8
-rw-r--r--usr.bin/tmux/notify.c10
-rw-r--r--usr.bin/tmux/options-table.c44
-rw-r--r--usr.bin/tmux/tmux.133
5 files changed, 60 insertions, 43 deletions
diff --git a/usr.bin/tmux/cmd-set-option.c b/usr.bin/tmux/cmd-set-option.c
index c91f623d665..2e6cdbff235 100644
--- a/usr.bin/tmux/cmd-set-option.c
+++ b/usr.bin/tmux/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-set-option.c,v 1.128 2020/03/17 11:10:12 nicm Exp $ */
+/* $OpenBSD: cmd-set-option.c,v 1.129 2020/04/13 07:25:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -69,10 +69,10 @@ const struct cmd_entry cmd_set_hook_entry = {
.name = "set-hook",
.alias = NULL,
- .args = { "agRt:u", 1, 2 },
- .usage = "[-agRu] " CMD_TARGET_SESSION_USAGE " hook [command]",
+ .args = { "agpRt:uw", 1, 2 },
+ .usage = "[-agpRuw] " CMD_TARGET_PANE_USAGE " hook [command]",
- .target = { 't', CMD_FIND_SESSION, CMD_FIND_CANFAIL },
+ .target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
.flags = CMD_AFTERHOOK,
.exec = cmd_set_option_exec
diff --git a/usr.bin/tmux/cmd-show-options.c b/usr.bin/tmux/cmd-show-options.c
index 11fe12d7f62..f9288c8e21c 100644
--- a/usr.bin/tmux/cmd-show-options.c
+++ b/usr.bin/tmux/cmd-show-options.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-show-options.c,v 1.58 2020/04/09 13:56:46 nicm Exp $ */
+/* $OpenBSD: cmd-show-options.c,v 1.59 2020/04/13 07:25:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -65,10 +65,10 @@ const struct cmd_entry cmd_show_hooks_entry = {
.name = "show-hooks",
.alias = NULL,
- .args = { "gt:", 0, 1 },
- .usage = "[-g] " CMD_TARGET_SESSION_USAGE,
+ .args = { "gpt:w", 0, 1 },
+ .usage = "[-gpw] " CMD_TARGET_PANE_USAGE,
- .target = { 't', CMD_FIND_SESSION, 0 },
+ .target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
.flags = CMD_AFTERHOOK,
.exec = cmd_show_options_exec
diff --git a/usr.bin/tmux/notify.c b/usr.bin/tmux/notify.c
index 1fbd302e5f8..75a3632c92d 100644
--- a/usr.bin/tmux/notify.c
+++ b/usr.bin/tmux/notify.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: notify.c,v 1.29 2019/12/19 09:22:33 nicm Exp $ */
+/* $OpenBSD: notify.c,v 1.30 2020/04/13 07:25:33 nicm Exp $ */
/*
* Copyright (c) 2012 George Nachman <tmux@georgester.com>
@@ -76,6 +76,14 @@ notify_insert_hook(struct cmdq_item *item, struct notify_entry *ne)
else
oo = fs.s->options;
o = options_get(oo, ne->name);
+ if (o == NULL && fs.wp != NULL) {
+ oo = fs.wp->options;
+ o = options_get(oo, ne->name);
+ }
+ if (o == NULL && fs.wl != NULL) {
+ oo = fs.wl->window->options;
+ o = options_get(oo, ne->name);
+ }
if (o == NULL)
return;
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c
index f5fe00e759c..102102cbf9b 100644
--- a/usr.bin/tmux/options-table.c
+++ b/usr.bin/tmux/options-table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: options-table.c,v 1.115 2019/11/28 10:55:45 nicm Exp $ */
+/* $OpenBSD: options-table.c,v 1.116 2020/04/13 07:25:33 nicm Exp $ */
/*
* Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -140,7 +140,7 @@ static const char *options_table_status_format_default[] = {
OPTIONS_TABLE_STATUS_FORMAT1, OPTIONS_TABLE_STATUS_FORMAT2, NULL
};
-/* Helper for hook options. */
+/* Helpers for hook options. */
#define OPTIONS_TABLE_HOOK(hook_name, default_value) \
{ .name = hook_name, \
.type = OPTIONS_TABLE_COMMAND, \
@@ -150,6 +150,24 @@ static const char *options_table_status_format_default[] = {
.separator = "" \
}
+#define OPTIONS_TABLE_PANE_HOOK(hook_name, default_value) \
+ { .name = hook_name, \
+ .type = OPTIONS_TABLE_COMMAND, \
+ .scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE, \
+ .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
+ .default_str = default_value, \
+ .separator = "" \
+ }
+
+#define OPTIONS_TABLE_WINDOW_HOOK(hook_name, default_value) \
+ { .name = hook_name, \
+ .type = OPTIONS_TABLE_COMMAND, \
+ .scope = OPTIONS_TABLE_WINDOW, \
+ .flags = OPTIONS_TABLE_IS_ARRAY|OPTIONS_TABLE_IS_HOOK, \
+ .default_str = default_value, \
+ .separator = "" \
+ }
+
/* Top-level options. */
const struct options_table_entry options_table[] = {
/* Server options. */
@@ -851,21 +869,21 @@ const struct options_table_entry options_table[] = {
OPTIONS_TABLE_HOOK("client-detached", ""),
OPTIONS_TABLE_HOOK("client-resized", ""),
OPTIONS_TABLE_HOOK("client-session-changed", ""),
- OPTIONS_TABLE_HOOK("pane-died", ""),
- OPTIONS_TABLE_HOOK("pane-exited", ""),
- OPTIONS_TABLE_HOOK("pane-focus-in", ""),
- OPTIONS_TABLE_HOOK("pane-focus-out", ""),
- OPTIONS_TABLE_HOOK("pane-mode-changed", ""),
- OPTIONS_TABLE_HOOK("pane-set-clipboard", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-died", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-exited", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-focus-in", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-focus-out", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-mode-changed", ""),
+ OPTIONS_TABLE_PANE_HOOK("pane-set-clipboard", ""),
OPTIONS_TABLE_HOOK("session-closed", ""),
OPTIONS_TABLE_HOOK("session-created", ""),
OPTIONS_TABLE_HOOK("session-renamed", ""),
OPTIONS_TABLE_HOOK("session-window-changed", ""),
- OPTIONS_TABLE_HOOK("window-layout-changed", ""),
- OPTIONS_TABLE_HOOK("window-linked", ""),
- OPTIONS_TABLE_HOOK("window-pane-changed", ""),
- OPTIONS_TABLE_HOOK("window-renamed", ""),
- OPTIONS_TABLE_HOOK("window-unlinked", ""),
+ OPTIONS_TABLE_WINDOW_HOOK("window-layout-changed", ""),
+ OPTIONS_TABLE_WINDOW_HOOK("window-linked", ""),
+ OPTIONS_TABLE_WINDOW_HOOK("window-pane-changed", ""),
+ OPTIONS_TABLE_WINDOW_HOOK("window-renamed", ""),
+ OPTIONS_TABLE_WINDOW_HOOK("window-unlinked", ""),
{ .name = NULL }
};
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index 2414963b2bf..edf007fe257 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.739 2020/04/12 20:16:36 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.740 2020/04/13 07:25:33 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -14,7 +14,7 @@
.\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
.\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: April 12 2020 $
+.Dd $Mdocdate: April 13 2020 $
.Dt TMUX 1
.Os
.Sh NAME
@@ -3897,6 +3897,7 @@ hook and there are a number of hooks not associated with commands.
.Pp
Hooks are stored as array options, members of the array are executed in
order when the hook is triggered.
+Like options different hooks may be global or belong to a session, window or pane.
Hooks may be configured with the
.Ic set-hook
or
@@ -3989,8 +3990,8 @@ Run when a window is unlinked from a session.
Hooks are managed with these commands:
.Bl -tag -width Ds
.It Xo Ic set-hook
-.Op Fl agRu
-.Op Fl t Ar target-session
+.Op Fl agpRuw
+.Op Fl t Ar target-pane
.Ar hook-name
.Ar command
.Xc
@@ -4002,18 +4003,8 @@ unsets) hook
.Ar hook-name
to
.Ar command .
-If
-.Fl g
-is given,
-.Em hook-name
-is added to the global list of hooks, otherwise it is added to the session
-hooks (for
-.Ar target-session
-with
-.Fl t ) .
-.Fl a
-appends to a hook.
-Like options, session hooks inherit from the global ones.
+The flags are the same as for
+.Ic set-option .
.Pp
With
.Fl R ,
@@ -4021,12 +4012,12 @@ run
.Ar hook-name
immediately.
.It Xo Ic show-hooks
-.Op Fl g
-.Op Fl t Ar target-session
+.Op Fl gpw
+.Op Fl t Ar target-pane
.Xc
-Shows the global list of hooks with
-.Fl g ,
-otherwise the session hooks.
+Shows hooks.
+The flags are the same as for
+.Ic show-options .
.El
.Sh MOUSE SUPPORT
If the