Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command on switching terminals?
On 07/01/18 05:24 AM, Mikael Magnusson wrote:
I can't get it to work Mikael, here's my current hacked up test code, I
source it in two different terminals and then change focus between them
but nothing seems different. I've tried a few variations on this with
no luck:
------------------------------
#!/usr/bin/zsh
function _zle_line_init()
{
[[ $TERM = xterm ]] && printf '\e[?1004h'
echo in-$TERM
}
function _zle_line_finish()
{
[[ $TERM = xterm ]] && printf '\e[?1004l'
echo out-$TERM
}
zle -N zle-line-init _zle_line_init
zle -N zle-line-finish _zle_line_finish
# The test echo's in the functions show that the above two lines are in
effect, I get:
# $ in-xterm
# out-xterm
# ... after every ENTER.
bindkey '^[[I' focus-in
bindkey '^[[O' focus-out
zle -N focus-in _focus_handler
zle -N focus-out _focus_handler
# But this seems not to be called:
function _focus_handler()
{
if [[ $WIDGET = focus-in ]]; then
zle -M "hey we got focus"
fi
if [[ $WIDGET = focus-out ]]; then
zle -M "we lost focus"
fi
echo _focus_handler where are you?
}
echo sourced ok
Messages sorted by:
Reverse Date,
Date,
Thread,
Author