mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Merge branch 'obsd-master'
This commit is contained in:
14
alerts.c
14
alerts.c
@ -267,11 +267,11 @@ alerts_set_message(struct session *s, struct window *w, struct winlink *wl,
|
|||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We have found an alert (bell, activity or silence), so we need
|
* We have found an alert (bell, activity or silence), so we need to
|
||||||
* to notify the user. For each client attached to this session,
|
* pass it on to the user. For each client attached to this session,
|
||||||
* decide whether a bell (or visual message) is needed.
|
* decide whether a bell (or visual message) is needed.
|
||||||
*
|
*
|
||||||
* {bell,activity,silence}-action determines when we notify: none means
|
* {bell,activity,silence}-action determines when we alert: none means
|
||||||
* nothing happens, current means we only do something for the current
|
* nothing happens, current means we only do something for the current
|
||||||
* window and other means only for windows other than the current.
|
* window and other means only for windows other than the current.
|
||||||
*
|
*
|
||||||
@ -280,17 +280,17 @@ alerts_set_message(struct session *s, struct window *w, struct winlink *wl,
|
|||||||
* mean both a bell and visual message is sent.
|
* mean both a bell and visual message is sent.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (action == BELL_NONE)
|
if (action == ALERT_NONE)
|
||||||
return;
|
return;
|
||||||
TAILQ_FOREACH(c, &clients, entry) {
|
TAILQ_FOREACH(c, &clients, entry) {
|
||||||
if (c->session != s || c->flags & CLIENT_CONTROL)
|
if (c->session != s || c->flags & CLIENT_CONTROL)
|
||||||
continue;
|
continue;
|
||||||
flag = 0;
|
flag = 0;
|
||||||
if (action == BELL_ANY)
|
if (action == ALERT_ANY)
|
||||||
flag = 1;
|
flag = 1;
|
||||||
else if (action == BELL_CURRENT)
|
else if (action == ALERT_CURRENT)
|
||||||
flag = (c->session->curw->window == w);
|
flag = (c->session->curw->window == w);
|
||||||
else if (action == BELL_OTHER)
|
else if (action == ALERT_OTHER)
|
||||||
flag = (c->session->curw->window != w);
|
flag = (c->session->curw->window != w);
|
||||||
if (!flag)
|
if (!flag)
|
||||||
continue;
|
continue;
|
||||||
|
@ -37,8 +37,8 @@ const struct cmd_entry cmd_display_panes_entry = {
|
|||||||
.name = "display-panes",
|
.name = "display-panes",
|
||||||
.alias = "displayp",
|
.alias = "displayp",
|
||||||
|
|
||||||
.args = { "t:", 0, 1 },
|
.args = { "d:t:", 0, 1 },
|
||||||
.usage = CMD_TARGET_CLIENT_USAGE,
|
.usage = "[-d duration] " CMD_TARGET_CLIENT_USAGE,
|
||||||
|
|
||||||
.flags = CMD_AFTERHOOK,
|
.flags = CMD_AFTERHOOK,
|
||||||
.exec = cmd_display_panes_exec
|
.exec = cmd_display_panes_exec
|
||||||
@ -49,6 +49,9 @@ cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
{
|
{
|
||||||
struct args *args = self->args;
|
struct args *args = self->args;
|
||||||
struct client *c;
|
struct client *c;
|
||||||
|
struct session *s;
|
||||||
|
u_int delay;
|
||||||
|
char *cause;
|
||||||
|
|
||||||
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL)
|
||||||
return (CMD_RETURN_ERROR);
|
return (CMD_RETURN_ERROR);
|
||||||
@ -61,8 +64,18 @@ cmd_display_panes_exec(struct cmd *self, struct cmdq_item *item)
|
|||||||
c->identify_callback_data = xstrdup(args->argv[0]);
|
c->identify_callback_data = xstrdup(args->argv[0]);
|
||||||
else
|
else
|
||||||
c->identify_callback_data = xstrdup("select-pane -t '%%'");
|
c->identify_callback_data = xstrdup("select-pane -t '%%'");
|
||||||
|
s = c->session;
|
||||||
|
|
||||||
server_client_set_identify(c);
|
if (args_has(args, 'd')) {
|
||||||
|
delay = args_strtonum(args, 'd', 0, UINT_MAX, &cause);
|
||||||
|
if (cause != NULL) {
|
||||||
|
cmdq_error(item, "delay %s", cause);
|
||||||
|
free(cause);
|
||||||
|
return (CMD_RETURN_ERROR);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
delay = options_get_number(s->options, "display-panes-time");
|
||||||
|
server_client_set_identify(c, delay);
|
||||||
|
|
||||||
return (CMD_RETURN_NORMAL);
|
return (CMD_RETURN_NORMAL);
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ const struct options_table_entry options_table[] = {
|
|||||||
.type = OPTIONS_TABLE_CHOICE,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_SESSION,
|
.scope = OPTIONS_TABLE_SESSION,
|
||||||
.choices = options_table_bell_action_list,
|
.choices = options_table_bell_action_list,
|
||||||
.default_num = BELL_OTHER
|
.default_num = ALERT_OTHER
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "assume-paste-time",
|
{ .name = "assume-paste-time",
|
||||||
@ -172,7 +172,7 @@ const struct options_table_entry options_table[] = {
|
|||||||
.type = OPTIONS_TABLE_CHOICE,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_SESSION,
|
.scope = OPTIONS_TABLE_SESSION,
|
||||||
.choices = options_table_bell_action_list,
|
.choices = options_table_bell_action_list,
|
||||||
.default_num = BELL_ANY
|
.default_num = ALERT_ANY
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "default-command",
|
{ .name = "default-command",
|
||||||
@ -357,7 +357,7 @@ const struct options_table_entry options_table[] = {
|
|||||||
.type = OPTIONS_TABLE_CHOICE,
|
.type = OPTIONS_TABLE_CHOICE,
|
||||||
.scope = OPTIONS_TABLE_SESSION,
|
.scope = OPTIONS_TABLE_SESSION,
|
||||||
.choices = options_table_bell_action_list,
|
.choices = options_table_bell_action_list,
|
||||||
.default_num = BELL_OTHER
|
.default_num = ALERT_OTHER
|
||||||
},
|
},
|
||||||
|
|
||||||
{ .name = "status",
|
{ .name = "status",
|
||||||
|
@ -72,18 +72,17 @@ server_client_callback_identify(__unused int fd, __unused short events,
|
|||||||
|
|
||||||
/* Set identify mode on client. */
|
/* Set identify mode on client. */
|
||||||
void
|
void
|
||||||
server_client_set_identify(struct client *c)
|
server_client_set_identify(struct client *c, u_int delay)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
int delay;
|
|
||||||
|
|
||||||
delay = options_get_number(c->session->options, "display-panes-time");
|
|
||||||
tv.tv_sec = delay / 1000;
|
tv.tv_sec = delay / 1000;
|
||||||
tv.tv_usec = (delay % 1000) * 1000L;
|
tv.tv_usec = (delay % 1000) * 1000L;
|
||||||
|
|
||||||
if (event_initialized(&c->identify_timer))
|
if (event_initialized(&c->identify_timer))
|
||||||
evtimer_del(&c->identify_timer);
|
evtimer_del(&c->identify_timer);
|
||||||
evtimer_set(&c->identify_timer, server_client_callback_identify, c);
|
evtimer_set(&c->identify_timer, server_client_callback_identify, c);
|
||||||
|
if (delay != 0)
|
||||||
evtimer_add(&c->identify_timer, &tv);
|
evtimer_add(&c->identify_timer, &tv);
|
||||||
|
|
||||||
c->flags |= CLIENT_IDENTIFY;
|
c->flags |= CLIENT_IDENTIFY;
|
||||||
|
13
tmux.1
13
tmux.1
@ -1465,6 +1465,7 @@ specifies the format for each item in the tree.
|
|||||||
This command works only if at least one client is attached.
|
This command works only if at least one client is attached.
|
||||||
.It Xo
|
.It Xo
|
||||||
.Ic display-panes
|
.Ic display-panes
|
||||||
|
.Op Fl d Ar duration
|
||||||
.Op Fl t Ar target-client
|
.Op Fl t Ar target-client
|
||||||
.Op Ar template
|
.Op Ar template
|
||||||
.Xc
|
.Xc
|
||||||
@ -1472,11 +1473,19 @@ This command works only if at least one client is attached.
|
|||||||
Display a visible indicator of each pane shown by
|
Display a visible indicator of each pane shown by
|
||||||
.Ar target-client .
|
.Ar target-client .
|
||||||
See the
|
See the
|
||||||
.Ic display-panes-time ,
|
.Ic display-panes-colour
|
||||||
.Ic display-panes-colour ,
|
|
||||||
and
|
and
|
||||||
.Ic display-panes-active-colour
|
.Ic display-panes-active-colour
|
||||||
session options.
|
session options.
|
||||||
|
The indicator is closed when a key is pressed or
|
||||||
|
.Ar duration
|
||||||
|
milliseconds have passed.
|
||||||
|
If
|
||||||
|
.Fl d
|
||||||
|
is not given,
|
||||||
|
.Ic display-panes-time
|
||||||
|
is used.
|
||||||
|
A duration of zero means the indicator stays until a key is pressed.
|
||||||
While the indicator is on screen, a pane may be chosen with the
|
While the indicator is on screen, a pane may be chosen with the
|
||||||
.Ql 0
|
.Ql 0
|
||||||
to
|
to
|
||||||
|
12
tmux.h
12
tmux.h
@ -81,11 +81,11 @@ struct tmuxproc;
|
|||||||
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0]))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Bell option values. */
|
/* Alert option values. */
|
||||||
#define BELL_NONE 0
|
#define ALERT_NONE 0
|
||||||
#define BELL_ANY 1
|
#define ALERT_ANY 1
|
||||||
#define BELL_CURRENT 2
|
#define ALERT_CURRENT 2
|
||||||
#define BELL_OTHER 3
|
#define ALERT_OTHER 3
|
||||||
|
|
||||||
/* Visual option values. */
|
/* Visual option values. */
|
||||||
#define VISUAL_OFF 0
|
#define VISUAL_OFF 0
|
||||||
@ -1874,7 +1874,7 @@ void server_add_accept(int);
|
|||||||
|
|
||||||
/* server-client.c */
|
/* server-client.c */
|
||||||
u_int server_client_how_many(void);
|
u_int server_client_how_many(void);
|
||||||
void server_client_set_identify(struct client *);
|
void server_client_set_identify(struct client *, u_int);
|
||||||
void server_client_clear_identify(struct client *, struct window_pane *);
|
void server_client_clear_identify(struct client *, struct window_pane *);
|
||||||
void server_client_set_key_table(struct client *, const char *);
|
void server_client_set_key_table(struct client *, const char *);
|
||||||
const char *server_client_get_key_table(struct client *);
|
const char *server_client_get_key_table(struct client *);
|
||||||
|
Reference in New Issue
Block a user