mirror of
https://github.com/tmux/tmux.git
synced 2025-12-27 04:16:03 +00:00
Add focus-follows-mouse option, from Barry Wasdell in GitHub issue 4771.
This commit is contained in:
@@ -665,6 +665,13 @@ const struct options_table_entry options_table[] = {
|
|||||||
.text = "Time for which status line messages should appear."
|
.text = "Time for which status line messages should appear."
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ .name = "focus-follows-mouse",
|
||||||
|
.type = OPTIONS_TABLE_FLAG,
|
||||||
|
.scope = OPTIONS_TABLE_SESSION,
|
||||||
|
.default_num = 0,
|
||||||
|
.text = "Whether moving the mouse into a pane selects it."
|
||||||
|
},
|
||||||
|
|
||||||
{ .name = "history-limit",
|
{ .name = "history-limit",
|
||||||
.type = OPTIONS_TABLE_NUMBER,
|
.type = OPTIONS_TABLE_NUMBER,
|
||||||
.scope = OPTIONS_TABLE_SESSION,
|
.scope = OPTIONS_TABLE_SESSION,
|
||||||
|
|||||||
@@ -1064,8 +1064,16 @@ have_event:
|
|||||||
case NOTYPE:
|
case NOTYPE:
|
||||||
break;
|
break;
|
||||||
case MOVE:
|
case MOVE:
|
||||||
if (where == PANE)
|
if (where == PANE) {
|
||||||
key = KEYC_MOUSEMOVE_PANE;
|
key = KEYC_MOUSEMOVE_PANE;
|
||||||
|
if (wp != NULL &&
|
||||||
|
wp != w->active &&
|
||||||
|
options_get_number(s->options, "focus-follows-mouse")) {
|
||||||
|
window_set_active_pane(w, wp, 1);
|
||||||
|
server_redraw_window_borders(w);
|
||||||
|
server_status_window(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (where == STATUS)
|
if (where == STATUS)
|
||||||
key = KEYC_MOUSEMOVE_STATUS;
|
key = KEYC_MOUSEMOVE_STATUS;
|
||||||
if (where == STATUS_LEFT)
|
if (where == STATUS_LEFT)
|
||||||
@@ -2973,7 +2981,8 @@ server_client_reset_state(struct client *c)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Set mouse mode if requested. To support dragging, always use button
|
* Set mouse mode if requested. To support dragging, always use button
|
||||||
* mode.
|
* mode. For focus-follows-mouse, we need all-motion mode to receive
|
||||||
|
* movement events.
|
||||||
*/
|
*/
|
||||||
if (options_get_number(oo, "mouse")) {
|
if (options_get_number(oo, "mouse")) {
|
||||||
if (c->overlay_draw == NULL) {
|
if (c->overlay_draw == NULL) {
|
||||||
@@ -2983,7 +2992,9 @@ server_client_reset_state(struct client *c)
|
|||||||
mode |= MODE_MOUSE_ALL;
|
mode |= MODE_MOUSE_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (~mode & MODE_MOUSE_ALL)
|
if (options_get_number(oo, "focus-follows-mouse"))
|
||||||
|
mode |= MODE_MOUSE_ALL;
|
||||||
|
else if (~mode & MODE_MOUSE_ALL)
|
||||||
mode |= MODE_MOUSE_BUTTON;
|
mode |= MODE_MOUSE_BUTTON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
6
tmux.1
6
tmux.1
@@ -4242,6 +4242,12 @@ passed through to applications running in
|
|||||||
.Nm .
|
.Nm .
|
||||||
Attached clients should be detached and attached again after changing this
|
Attached clients should be detached and attached again after changing this
|
||||||
option.
|
option.
|
||||||
|
.It Xo Ic focus-follows-mouse
|
||||||
|
.Op Ic on | off
|
||||||
|
.Xc
|
||||||
|
When enabled and
|
||||||
|
.Ic mouse
|
||||||
|
is on, moving the mouse into a pane selects it.
|
||||||
.It Xo Ic get-clipboard
|
.It Xo Ic get-clipboard
|
||||||
.Op Ic both | request | buffer | off
|
.Op Ic both | request | buffer | off
|
||||||
.Xc
|
.Xc
|
||||||
|
|||||||
Reference in New Issue
Block a user