summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NOTES9
-rw-r--r--TODO3
-rw-r--r--cmd-set-option.c48
-rw-r--r--status.c14
-rw-r--r--tmux.c4
-rw-r--r--tmux.h3
6 files changed, 64 insertions, 17 deletions
diff --git a/NOTES b/NOTES
index b9240c3a..8f32de75 100644
--- a/NOTES
+++ b/NOTES
@@ -62,11 +62,6 @@ Commands:
set-option prefix key
Set command prefix (meta) key.
-Sessions are destroyed when no windows remain attached to them.
-
-There is currently no command to change status bar colour, it can be altered
-by adjusting the last argument of line 38 in status.c:
+XXX set-option status,status-fg,status-bg
- input_store_two(b, CODE_ATTRIBUTES, ATTR_REVERSE, 0x20);
-
-0x47 is white-on-blue.
+Sessions are destroyed when no windows remain attached to them.
diff --git a/TODO b/TODO
index 8c322c77..53cd2757 100644
--- a/TODO
+++ b/TODO
@@ -42,6 +42,8 @@
- Nested sessions over the network, plug-in another tmux as a window/subsession
- it would be nice to have multichar commands so you could have C-b K K for
kill-window to limit accidental presses
+- status-fg/status-bg should be able to a) use strings for colours "red" etc
+ b) set attributes too ("bold-red"?)
-- For 0.1 --------------------------------------------------------------------
- man page
@@ -55,7 +57,6 @@
unlink window (error if window only linked to one session)
kill window (C-b backsp)
kill session (no not bind by default)
- set status on/off
set shell
send prefix
- handle tmux in tmux (check $TMUX and abort)
diff --git a/cmd-set-option.c b/cmd-set-option.c
index 7d229b4f..7569ad29 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -1,4 +1,4 @@
-/* $Id: cmd-set-option.c,v 1.4 2007-10-04 22:18:48 nicm Exp $ */
+/* $Id: cmd-set-option.c,v 1.5 2007-10-12 12:08:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -91,7 +91,7 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
struct cmd_set_option_data *data = ptr;
struct client *c = ctx->client;
const char *errstr;
- u_int number;
+ u_int number, i;
int bool, key;
if (data == NULL)
@@ -102,6 +102,7 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
return;
}
+ number = -1;
if (data->value != NULL) {
number = strtonum(data->value, 0, UINT_MAX, &errstr);
@@ -126,6 +127,49 @@ cmd_set_option_exec(void *ptr, unused struct cmd_ctx *ctx)
return;
}
prefix_key = key;
+ } else if (strcmp(data->option, "status") == 0) {
+ if (bool == -1) {
+ ctx->error(ctx, "bad value: %s", data->value);
+ return;
+ }
+ status_lines = bool;
+ recalculate_sizes();
+ } else if (strcmp(data->option, "status-fg") == 0) {
+ if (data->value == NULL) {
+ ctx->error(ctx, "invalid value");
+ return;
+ }
+ if (errstr != NULL || number > 7) {
+ ctx->error(ctx, "bad colour: %s", data->value);
+ return;
+ }
+ status_colour &= 0x0f;
+ status_colour |= number << 4;
+ if (status_lines > 0) {
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
+ }
+ }
+ } else if (strcmp(data->option, "status-bg") == 0) {
+ if (data->value == NULL) {
+ ctx->error(ctx, "invalid value");
+ return;
+ }
+ if (errstr != NULL || number > 7) {
+ ctx->error(ctx, "bad colour: %s", data->value);
+ return;
+ }
+ status_colour &= 0xf0;
+ status_colour |= number;
+ if (status_lines > 0) {
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c != NULL && c->session != NULL)
+ server_redraw_client(c);
+ }
+ }
} else {
ctx->error(ctx, "unknown option: %s", data->option);
return;
diff --git a/status.c b/status.c
index ee15d4b8..1b80c7d7 100644
--- a/status.c
+++ b/status.c
@@ -1,4 +1,4 @@
-/* $Id: status.c,v 1.4 2007-10-12 11:24:15 nicm Exp $ */
+/* $Id: status.c,v 1.5 2007-10-12 12:08:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -35,20 +35,24 @@ status_write(struct client *c)
input_store_zero(b, CODE_CURSOROFF);
input_store_two(b, CODE_CURSORMOVE, c->sy - status_lines + 1, 1);
- input_store_two(b, CODE_ATTRIBUTES, ATTR_REVERSE, 0x20);
+ input_store_two(b, CODE_ATTRIBUTES, 0, status_colour);
size = c->sx;
for (i = 0; i < ARRAY_LENGTH(&c->session->windows); i++) {
w = ARRAY_ITEM(&c->session->windows, i);
if (w == NULL)
continue;
- if (session_hasbell(c->session, w))
- input_store_two(b, CODE_ATTRIBUTES, ATTR_REVERSE, 0x30);
+
+ if (session_hasbell(c->session, w)) {
+ input_store_two(
+ b, CODE_ATTRIBUTES, ATTR_REVERSE, status_colour);
+ }
status_print(b, &size,
"%u:%s%s", i, w->name, w == c->session->window ? "*" : "");
if (session_hasbell(c->session, w))
- input_store_two(b, CODE_ATTRIBUTES, ATTR_REVERSE, 0x20);
+ input_store_two(b, CODE_ATTRIBUTES, 0, status_colour);
status_print(b, &size, " ");
+
if (size == 0)
break;
}
diff --git a/tmux.c b/tmux.c
index 3a38c3af..af28548c 100644
--- a/tmux.c
+++ b/tmux.c
@@ -1,4 +1,4 @@
-/* $Id: tmux.c,v 1.29 2007-10-04 11:52:03 nicm Exp $ */
+/* $Id: tmux.c,v 1.30 2007-10-12 12:08:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -40,6 +40,7 @@ volatile sig_atomic_t sigterm;
int debug_level;
int prefix_key = META;
u_int status_lines;
+u_char status_colour;
char *default_command;
void sighandler(int);
@@ -195,6 +196,7 @@ main(int argc, char **argv)
log_open(stderr, LOG_USER, debug_level);
status_lines = 1;
+ status_colour = 0x02;
shell = getenv("SHELL");
if (shell == NULL || *shell == '\0')
diff --git a/tmux.h b/tmux.h
index e16d00c3..ce162bf6 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1,4 +1,4 @@
-/* $Id: tmux.h,v 1.54 2007-10-12 11:24:15 nicm Exp $ */
+/* $Id: tmux.h,v 1.55 2007-10-12 12:08:51 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -497,6 +497,7 @@ extern volatile sig_atomic_t sigterm;
extern int prefix_key;
extern int debug_level;
extern u_int status_lines;
+extern u_char status_colour;
extern char *default_command;
void usage(char **, const char *, ...);
void logfile(const char *);