mirror of
https://github.com/tmux/tmux.git
synced 2025-01-07 16:28:48 +00:00
Add pane focus hooks.
This commit is contained in:
parent
2fae6a5761
commit
d254293a6d
@ -1148,10 +1148,6 @@ server_client_check_focus(struct window_pane *wp)
|
|||||||
push = wp->flags & PANE_FOCUSPUSH;
|
push = wp->flags & PANE_FOCUSPUSH;
|
||||||
wp->flags &= ~PANE_FOCUSPUSH;
|
wp->flags &= ~PANE_FOCUSPUSH;
|
||||||
|
|
||||||
/* If we don't care about focus, forget it. */
|
|
||||||
if (!(wp->base.mode & MODE_FOCUSON))
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* If we're not the active pane in our window, we're not focused. */
|
/* If we're not the active pane in our window, we're not focused. */
|
||||||
if (wp->window->active != wp)
|
if (wp->window->active != wp)
|
||||||
goto not_focused;
|
goto not_focused;
|
||||||
@ -1175,14 +1171,20 @@ server_client_check_focus(struct window_pane *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
not_focused:
|
not_focused:
|
||||||
if (push || (wp->flags & PANE_FOCUSED))
|
if (push || (wp->flags & PANE_FOCUSED)) {
|
||||||
bufferevent_write(wp->event, "\033[O", 3);
|
if (wp->base.mode & MODE_FOCUSON)
|
||||||
|
bufferevent_write(wp->event, "\033[O", 3);
|
||||||
|
notify_pane("pane-focus-out", wp);
|
||||||
|
}
|
||||||
wp->flags &= ~PANE_FOCUSED;
|
wp->flags &= ~PANE_FOCUSED;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
focused:
|
focused:
|
||||||
if (push || !(wp->flags & PANE_FOCUSED))
|
if (push || !(wp->flags & PANE_FOCUSED)) {
|
||||||
bufferevent_write(wp->event, "\033[I", 3);
|
if (wp->base.mode & MODE_FOCUSON)
|
||||||
|
bufferevent_write(wp->event, "\033[I", 3);
|
||||||
|
notify_pane("pane-focus-in", wp);
|
||||||
|
}
|
||||||
wp->flags |= PANE_FOCUSED;
|
wp->flags |= PANE_FOCUSED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
8
tmux.1
8
tmux.1
@ -3423,6 +3423,14 @@ Run when the program running in a pane exits, but
|
|||||||
is on so the pane has not closed.
|
is on so the pane has not closed.
|
||||||
.It pane-exited
|
.It pane-exited
|
||||||
Run when the program running in a pane exits.
|
Run when the program running in a pane exits.
|
||||||
|
.It pane-focus-in
|
||||||
|
Run when the focus enters a pane, if the
|
||||||
|
.Ic focus-events
|
||||||
|
option is on.
|
||||||
|
.It pane-focus-out
|
||||||
|
Run when the focus exits a pane, if the
|
||||||
|
.Ic focus-events
|
||||||
|
option is on.
|
||||||
.It pane-set-clipboard
|
.It pane-set-clipboard
|
||||||
Run when the terminal clipboard is set using the
|
Run when the terminal clipboard is set using the
|
||||||
.Xr xterm 1
|
.Xr xterm 1
|
||||||
|
Loading…
Reference in New Issue
Block a user