Try to change the window title to match the command running it in. This is done

by reading argv[0] from the process group leader of the group that owns the tty
(tcgetpgrp()). This can't be done portably so some OS-dependent code is
introduced (ugh); OpenBSD, FreeBSD and Linux are supported at the moment.

A new window flag, automatic-rename, is available: if this is set to off, the
window name is not changed. Specifying a name with the new-window, new-session
or rename-window commands will automatically set this flag to off for the
window in question. To disable it entirely set the option to off globally (setw
-g automatic-rename off).
This commit is contained in:
Nicholas Marriott
2009-01-20 19:35:03 +00:00
parent d4f034beb4
commit 2d15f59859
16 changed files with 399 additions and 50 deletions

16
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.244 2009-01-19 18:26:50 nicm Exp $ */
/* $Id: tmux.h,v 1.245 2009-01-20 19:35:03 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -123,6 +123,9 @@ extern const char *__progname;
/* Minimum pane size. */
#define PANE_MINIMUM 4 /* includes separator line */
/* Automatic name refresh interval, in milliseconds. */
#define NAME_INTERVAL 100
/* Fatal errors. */
#define fatal(msg) log_fatal("%s: %s", __func__, msg);
#define fatalx(msg) log_fatalx("%s: %s", __func__, msg);
@ -606,6 +609,8 @@ TAILQ_HEAD(window_panes, window_pane);
/* Window structure. */
struct window {
char *name;
struct timeval name_timer;
pid_t pgrp;
struct window_pane *active;
struct window_panes panes;
@ -903,7 +908,7 @@ struct set_option_entry {
extern const struct set_option_entry set_option_table[];
extern const struct set_option_entry set_window_option_table[];
#define NSETOPTION 20
#define NSETWINDOWOPTION 12
#define NSETWINDOWOPTION 13
/* Edit keys. */
enum mode_key {
@ -1460,6 +1465,10 @@ void printflike3 window_choose_add(
void window_choose_ready(struct window_pane *,
u_int, void (*)(void *, int), void *);
/* names.c */
void set_window_names(void);
char *default_window_name(struct window *);
/* session.c */
extern struct sessions sessions;
void session_alert_add(struct session *, struct window *, int);
@ -1489,6 +1498,9 @@ int utf8_width(u_int);
/* util.c */
char *section_string(char *, size_t, size_t, size_t);
/* osdep-*.c */
char *get_argv0(pid_t);
/* buffer.c */
struct buffer *buffer_create(size_t);
void buffer_destroy(struct buffer *);