aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2007-10-12 13:03:58 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2007-10-12 13:03:58 +0000
commitf3404ee9229ae3acab973b93ca7a20eddd593c7f (patch)
tree6da5c97c1301c44438c1f00b7a594f9d781fd66f
parente5b70015246c634a53747a149e5e7f8cc04a9f85 (diff)
downloadrtmux-f3404ee9229ae3acab973b93ca7a20eddd593c7f.tar.gz
rtmux-f3404ee9229ae3acab973b93ca7a20eddd593c7f.tar.bz2
rtmux-f3404ee9229ae3acab973b93ca7a20eddd593c7f.zip
send-prefix command.
-rw-r--r--CHANGES3
-rw-r--r--Makefile4
-rw-r--r--TODO1
-rw-r--r--cmd-send-prefix.c53
-rw-r--r--cmd.c5
-rw-r--r--key-bindings.c3
-rw-r--r--tmux.h5
7 files changed, 65 insertions, 9 deletions
diff --git a/CHANGES b/CHANGES
index 63c88b1e..7bed252f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,6 @@
12 October 2007
+* (nicm) send-prefix command. Bound to C-b by default.
* (nicm) set status, status-fg, status-bg commands. fg and bg are as a number
from 0 to 7. status may be 0/1/on/off/yes/no.
* (nicm) Make status line mark window in yellow on bell.
@@ -124,5 +125,5 @@
(including mutt, emacs). No status bar yet and no key remapping or other
customisation.
-$Id: CHANGES,v 1.38 2007-10-12 12:32:34 nicm Exp $
+$Id: CHANGES,v 1.39 2007-10-12 13:03:58 nicm Exp $
diff --git a/Makefile b/Makefile
index faedee11..202570d0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.25 2007-10-10 19:45:20 nicm Exp $
+# $Id: Makefile,v 1.26 2007-10-12 13:03:58 nicm Exp $
.SUFFIXES: .c .o .y .h
.PHONY: clean
@@ -22,7 +22,7 @@ SRCS= tmux.c server.c server-msg.c server-fn.c buffer.c buffer-poll.c status.c \
cmd-list-sessions.c cmd-new-window.c cmd-next-window.c cmd-bind-key.c \
cmd-unbind-key.c cmd-previous-window.c cmd-last-window.c cmd-list-keys.c \
cmd-set-option.c cmd-rename-window.c cmd-select-window.c \
- cmd-list-windows.c cmd-attach-session.c
+ cmd-list-windows.c cmd-attach-session.c cmd-send-prefix.c
YACC= yacc -d
diff --git a/TODO b/TODO
index 53cd2757..dd2ee049 100644
--- a/TODO
+++ b/TODO
@@ -58,6 +58,5 @@
kill window (C-b backsp)
kill session (no not bind by default)
set shell
- send prefix
- handle tmux in tmux (check $TMUX and abort)
- check for some reqd terminfo caps on startup
diff --git a/cmd-send-prefix.c b/cmd-send-prefix.c
new file mode 100644
index 00000000..7f08dfe9
--- /dev/null
+++ b/cmd-send-prefix.c
@@ -0,0 +1,53 @@
+/* $Id: cmd-send-prefix.c,v 1.1 2007-10-12 13:03:58 nicm Exp $ */
+
+/*
+ * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.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 <sys/types.h>
+
+#include <getopt.h>
+#include <unistd.h>
+
+#include "tmux.h"
+
+/*
+ * Send prefix key as a key.
+ */
+
+void cmd_send_prefix_exec(void *, struct cmd_ctx *);
+
+const struct cmd_entry cmd_send_prefix_entry = {
+ "send-prefix", NULL, 0,
+ NULL,
+ NULL,
+ cmd_send_prefix_exec,
+ NULL,
+ NULL,
+ NULL
+};
+
+void
+cmd_send_prefix_exec(unused void *ptr, struct cmd_ctx *ctx)
+{
+ struct client *c = ctx->client;
+
+ if (!(ctx->flags & CMD_KEY)) {
+ server_write_client(c, MSG_EXIT, NULL, 0);
+ return;
+ }
+
+ window_key(c->session->window, prefix_key);
+}
diff --git a/cmd.c b/cmd.c
index cc0818e0..de07e3b4 100644
--- a/cmd.c
+++ b/cmd.c
@@ -1,4 +1,4 @@
-/* $Id: cmd.c,v 1.14 2007-10-04 22:04:01 nicm Exp $ */
+/* $Id: cmd.c,v 1.15 2007-10-12 13:03:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -37,7 +37,8 @@ const struct cmd_entry *cmd_table[] = {
&cmd_previous_window_entry,
&cmd_rename_window_entry,
&cmd_select_window_entry,
- &cmd_set_option_entry,
+ &cmd_send_prefix_entry,
+ &cmd_set_option_entry,
&cmd_unbind_key_entry,
NULL
};
diff --git a/key-bindings.c b/key-bindings.c
index 78143782..31deeb25 100644
--- a/key-bindings.c
+++ b/key-bindings.c
@@ -1,4 +1,4 @@
-/* $Id: key-bindings.c,v 1.7 2007-10-04 11:55:55 nicm Exp $ */
+/* $Id: key-bindings.c,v 1.8 2007-10-12 13:03:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -103,6 +103,7 @@ key_bindings_init(void)
{ '7', &cmd_select_window_entry, cmd_select_window_default },
{ '8', &cmd_select_window_entry, cmd_select_window_default },
{ '9', &cmd_select_window_entry, cmd_select_window_default },
+ { META, &cmd_send_prefix_entry, NULL },
/* { 'R', &cmd_refresh_client_entry },
{ 'r', &cmd_refresh_client_entry },
{ 'I', &cmd_windo_info_entry },
diff --git a/tmux.h b/tmux.h
index ce162bf6..f5833e55 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.55 2007-10-12 12:08:51 nicm Exp $ */
+/* $Id: tmux.h,v 1.56 2007-10-12 13:03:58 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -525,9 +525,10 @@ extern const struct cmd_entry cmd_next_window_entry;
extern const struct cmd_entry cmd_previous_window_entry;
extern const struct cmd_entry cmd_rename_window_entry;
extern const struct cmd_entry cmd_select_window_entry;
-void cmd_select_window_default(void **, int);
+extern const struct cmd_entry cmd_send_prefix_entry;
extern const struct cmd_entry cmd_set_option_entry;
extern const struct cmd_entry cmd_unbind_key_entry;
+void cmd_select_window_default(void **, int);
/* client.c */
int client_init(char *, struct client_ctx *, int);