Usually my status bars include ouput from external programs (e.g. biff-like
information on new mails, summary of Nagios states etc.). Previous to tmux
1.5 a config reload resulted in immediate re-execution of external commands.
While the current behaviour probably is more sane, I miss the ability to
force a full status bar refresh including triggering aforementioned
commands without having to rely on very short status update intervals
(e.g. to reset my status bar biff after having read a newly arrived mail).
The attached patch introduces a new command 'refresh-status' to allow this.
Marco
# HG changeset patch
# User Marco Beck <mb...@eaddrinuse.net>
# Date 1317154638 -7200
# Node ID dcbe3b0731710931a6091104cbbd512540664e57
# Parent 2a041ad30bca5f26d6ca8c056957e0ce364a8305
Add new command to refresh status bar.
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -102,6 +102,7 @@
cmd-paste-buffer.c \
cmd-pipe-pane.c \
cmd-refresh-client.c \
+ cmd-refresh-status.c \
cmd-rename-session.c \
cmd-rename-window.c \
cmd-resize-pane.c \
diff --git a/cmd-refresh-status.c b/cmd-refresh-status.c
new file mode 100644
--- /dev/null
+++ b/cmd-refresh-status.c
@@ -0,0 +1,47 @@
+/* $Id$ */
+
+/*
+ * Copyright (c) 2011 Marco Beck <mb...@eaddrinuse.net>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "tmux.h"
+
+/*
+ * Refresh status bar.
+ */
+
+int cmd_refresh_status_exec(struct cmd *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_refresh_status_entry = {
+ "refresh-status", "",
+ "", 0, 0,
+ "",
+ 0,
+ NULL,
+ NULL,
+ cmd_refresh_status_exec
+};
+
+int
+cmd_refresh_status_exec(unused struct cmd *self, struct cmd_ctx *ctx)
+{
+ struct client *c;
+
+ c = cmd_current_client(ctx);
+ status_update_jobs(c);
+ c->flags |= CLIENT_STATUS;
+
+ return (0);
+}
diff --git a/cmd.c b/cmd.c
--- a/cmd.c
+++ b/cmd.c
@@ -76,6 +76,7 @@
&cmd_previous_layout_entry,
&cmd_previous_window_entry,
&cmd_refresh_client_entry,
+ &cmd_refresh_status_entry,
&cmd_rename_session_entry,
&cmd_rename_window_entry,
&cmd_resize_pane_entry,
diff --git a/tmux.1 b/tmux.1
--- a/tmux.1
+++ b/tmux.1
@@ -696,6 +696,8 @@
Refresh the current client if bound to a key, or a single client if one is given
with
.Fl t .
+.It Ic refresh-status
+Refresh the status bar.
.It Xo Ic rename-session
.Op Fl t Ar target-session
.Ar new-name
diff --git a/tmux.h b/tmux.h
--- a/tmux.h
+++ b/tmux.h
@@ -1600,6 +1600,7 @@
extern const struct cmd_entry cmd_previous_layout_entry;
extern const struct cmd_entry cmd_previous_window_entry;
extern const struct cmd_entry cmd_refresh_client_entry;
+extern const struct cmd_entry cmd_refresh_status_entry;
extern const struct cmd_entry cmd_rename_session_entry;
extern const struct cmd_entry cmd_rename_window_entry;
extern const struct cmd_entry cmd_resize_pane_entry;
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users