mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 18:38:48 +00:00
-n is now -s on new-session.
This commit is contained in:
parent
1b9647669a
commit
543e7b0f03
4
CHANGES
4
CHANGES
@ -1,5 +1,7 @@
|
|||||||
19 October 2007
|
19 October 2007
|
||||||
|
|
||||||
|
* (nicm) -n on new-session is now -s, and -n is now the initial window name.
|
||||||
|
This was documented but not implemented :-/.
|
||||||
* (nicm) kill-window command, bound to & by default (because it should be hard
|
* (nicm) kill-window command, bound to & by default (because it should be hard
|
||||||
to hit accidently).
|
to hit accidently).
|
||||||
* (nicm) bell-style option with three choices: "none" completely ignore bell;
|
* (nicm) bell-style option with three choices: "none" completely ignore bell;
|
||||||
@ -137,5 +139,5 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
customisation.
|
||||||
|
|
||||||
$Id: CHANGES,v 1.44 2007-10-19 11:10:34 nicm Exp $
|
$Id: CHANGES,v 1.45 2007-10-19 17:15:28 nicm Exp $
|
||||||
|
|
||||||
|
1
TODO
1
TODO
@ -43,6 +43,7 @@
|
|||||||
- it would be nice to have multichar commands so you could have C-b K K for
|
- it would be nice to have multichar commands so you could have C-b K K for
|
||||||
kill-window to limit accidental presses
|
kill-window to limit accidental presses
|
||||||
- status-fg/status-bg should be to set attributes: bold, etc
|
- status-fg/status-bg should be to set attributes: bold, etc
|
||||||
|
- show-options command
|
||||||
|
|
||||||
-- For 0.1 --------------------------------------------------------------------
|
-- For 0.1 --------------------------------------------------------------------
|
||||||
- man page
|
- man page
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-new-session.c,v 1.12 2007-10-19 09:21:25 nicm Exp $ */
|
/* $Id: cmd-new-session.c,v 1.13 2007-10-19 17:15:29 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -34,12 +34,14 @@ void cmd_new_session_free(void *);
|
|||||||
|
|
||||||
struct cmd_new_session_data {
|
struct cmd_new_session_data {
|
||||||
char *name;
|
char *name;
|
||||||
|
char *winname;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
int flag_detached;
|
int flag_detached;
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct cmd_entry cmd_new_session_entry = {
|
const struct cmd_entry cmd_new_session_entry = {
|
||||||
"new-session", "new", "[-d] [-n session name] [command]",
|
"new-session", "new",
|
||||||
|
"[-d] [-s session name] [-n window name] [command]",
|
||||||
CMD_STARTSERVER|CMD_NOSESSION|CMD_CANTNEST,
|
CMD_STARTSERVER|CMD_NOSESSION|CMD_CANTNEST,
|
||||||
cmd_new_session_parse,
|
cmd_new_session_parse,
|
||||||
cmd_new_session_exec,
|
cmd_new_session_exec,
|
||||||
@ -57,16 +59,20 @@ cmd_new_session_parse(void **ptr, int argc, char **argv, char **cause)
|
|||||||
*ptr = data = xmalloc(sizeof *data);
|
*ptr = data = xmalloc(sizeof *data);
|
||||||
data->flag_detached = 0;
|
data->flag_detached = 0;
|
||||||
data->name = NULL;
|
data->name = NULL;
|
||||||
|
data->winname = NULL;
|
||||||
data->cmd = NULL;
|
data->cmd = NULL;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "dn:")) != EOF) {
|
while ((opt = getopt(argc, argv, "ds:n:")) != EOF) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'd':
|
case 'd':
|
||||||
data->flag_detached = 1;
|
data->flag_detached = 1;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 's':
|
||||||
data->name = xstrdup(optarg);
|
data->name = xstrdup(optarg);
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
data->winname = xstrdup(optarg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
goto usage;
|
goto usage;
|
||||||
}
|
}
|
||||||
@ -92,7 +98,8 @@ usage:
|
|||||||
void
|
void
|
||||||
cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
|
cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct cmd_new_session_data *data = ptr, std = { NULL, NULL, 0 };
|
struct cmd_new_session_data *data = ptr;
|
||||||
|
struct cmd_new_session_data std = { NULL, NULL, NULL, 0 };
|
||||||
struct client *c = ctx->client;
|
struct client *c = ctx->client;
|
||||||
char *cmd;
|
char *cmd;
|
||||||
u_int sy;
|
u_int sy;
|
||||||
@ -125,6 +132,10 @@ cmd_new_session_exec(void *ptr, struct cmd_ctx *ctx)
|
|||||||
c->session = session_create(data->name, cmd, c->sx, sy);
|
c->session = session_create(data->name, cmd, c->sx, sy);
|
||||||
if (c->session == NULL)
|
if (c->session == NULL)
|
||||||
fatalx("session_create failed");
|
fatalx("session_create failed");
|
||||||
|
if (data->winname != NULL) {
|
||||||
|
xfree(c->session->window->name);
|
||||||
|
c->session->window->name = xstrdup(data->winname);
|
||||||
|
}
|
||||||
|
|
||||||
if (data->flag_detached)
|
if (data->flag_detached)
|
||||||
server_write_client(c, MSG_EXIT, NULL, 0);
|
server_write_client(c, MSG_EXIT, NULL, 0);
|
||||||
@ -141,6 +152,7 @@ cmd_new_session_send(void *ptr, struct buffer *b)
|
|||||||
|
|
||||||
buffer_write(b, data, sizeof *data);
|
buffer_write(b, data, sizeof *data);
|
||||||
cmd_send_string(b, data->name);
|
cmd_send_string(b, data->name);
|
||||||
|
cmd_send_string(b, data->winname);
|
||||||
cmd_send_string(b, data->cmd);
|
cmd_send_string(b, data->cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,6 +164,7 @@ cmd_new_session_recv(void **ptr, struct buffer *b)
|
|||||||
*ptr = data = xmalloc(sizeof *data);
|
*ptr = data = xmalloc(sizeof *data);
|
||||||
buffer_read(b, data, sizeof *data);
|
buffer_read(b, data, sizeof *data);
|
||||||
data->name = cmd_recv_string(b);
|
data->name = cmd_recv_string(b);
|
||||||
|
data->winname = cmd_recv_string(b);
|
||||||
data->cmd = cmd_recv_string(b);
|
data->cmd = cmd_recv_string(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +175,8 @@ cmd_new_session_free(void *ptr)
|
|||||||
|
|
||||||
if (data->name != NULL)
|
if (data->name != NULL)
|
||||||
xfree(data->name);
|
xfree(data->name);
|
||||||
|
if (data->winname != NULL)
|
||||||
|
xfree(data->winname);
|
||||||
if (data->cmd != NULL)
|
if (data->cmd != NULL)
|
||||||
xfree(data->cmd);
|
xfree(data->cmd);
|
||||||
xfree(data);
|
xfree(data);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $Id: cmd-rename-window.c,v 1.6 2007-10-19 09:21:26 nicm Exp $ */
|
/* $Id: cmd-rename-window.c,v 1.7 2007-10-19 17:15:29 nicm Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -39,7 +39,7 @@ struct cmd_rename_window_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const struct cmd_entry cmd_rename_window_entry = {
|
const struct cmd_entry cmd_rename_window_entry = {
|
||||||
"rename-window", "renamew", "[-i index] newname",
|
"rename-window", "renamew", "[-i index] new name",
|
||||||
0,
|
0,
|
||||||
cmd_rename_window_parse,
|
cmd_rename_window_parse,
|
||||||
cmd_rename_window_exec,
|
cmd_rename_window_exec,
|
||||||
|
2
examples/start-tmux.sh → examples/mxey-start-tmux.sh
Executable file → Normal file
2
examples/start-tmux.sh → examples/mxey-start-tmux.sh
Executable file → Normal file
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
tmux attach
|
tmux attach
|
||||||
if [[ $? = 1 ]]; then
|
if [[ $? = 1 ]]; then
|
||||||
tmux new-session -d -nmain 'exec irssi'
|
tmux new-session -d -smain 'exec irssi'
|
||||||
tmux -smain set prefix '^H'
|
tmux -smain set prefix '^H'
|
||||||
tmux -smain new-window -d -nherrie 'exec sudo herrie -c /home/mxey/etc/herrie/config'
|
tmux -smain new-window -d -nherrie 'exec sudo herrie -c /home/mxey/etc/herrie/config'
|
||||||
tmux -smain new-window -d 'exec lynx'
|
tmux -smain new-window -d 'exec lynx'
|
24
examples/nicm-start-tmux.sh
Normal file
24
examples/nicm-start-tmux.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SOCKET=/tmp/tmux-1000-main
|
||||||
|
SESSION=natasha-main
|
||||||
|
|
||||||
|
TMUX="tmux -S $SOCKET"
|
||||||
|
|
||||||
|
if ! $TMUX -s $SESSION attach 2>/dev/null; then
|
||||||
|
$TMUX new -d -s $SESSION -nyelena 'exec ssh yelena' # 0
|
||||||
|
$TMUX -s $SESSION neww -d -ntodo 'exec emacs ~/TODO' # 1
|
||||||
|
$TMUX -s $SESSION neww -d -nncmpc 'exec ncmpc -f ~/.ncmpc.conf' # 2
|
||||||
|
$TMUX -s $SESSION neww -d # 3
|
||||||
|
$TMUX -s $SESSION neww -d # 4
|
||||||
|
$TMUX -s $SESSION neww -d # 5
|
||||||
|
$TMUX -s $SESSION neww -d # 6
|
||||||
|
$TMUX -s $SESSION neww -d # 7
|
||||||
|
$TMUX -s $SESSION neww -d # 8
|
||||||
|
$TMUX -s $SESSION neww -d # 9
|
||||||
|
|
||||||
|
$TMUX set prefix ^A
|
||||||
|
$TMUX set bell-action none
|
||||||
|
|
||||||
|
$TMUX -s $SESSION attach
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user