zsh-users
 help / color / mirror / code / Atom feed
* command on switching terminals?
@ 2018-01-06  5:33 Ray Andrews
  2018-01-06 22:20 ` Mikael Magnusson
  0 siblings, 1 reply; 21+ messages in thread
From: Ray Andrews @ 2018-01-06  5:33 UTC (permalink / raw)
  To: Zsh Users

Is it possible for zsh to know when the terminal in which it is running 
has awakened by having the mouse moved into that window?  I understand 
that it's the window manager that decides which terminal is active of 
course, but perhaps zsh knows when it is put to sleep by the mouse 
moving out of it's window, and also knows when it has been awakened 
again? I have a utility that lets you hotkey a mouse jump between 
terminals so as to jump between them without having to reach for the 
mouse itself, and I can call it fine within a function, but I'd like to 
be able to also execute some code after each jump but in the new 
window.  As it is, zsh just wakes up without seeming to know it's been 
asleep so there's nothing to 'attach' any commands to.  precmd() and 
preexec() are not aroused.   Any commands inside the calling function 
placed after the command to jump to the new terminal are executed in the 
old terminal, which is not surprising, so it would have to depend on the 
awakened terminal knowing it's been awakened.  Sorta like precmd but 
hooked to the activation of the terminal.  I understand that this might 
be outside of zsh's domain.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-06  5:33 command on switching terminals? Ray Andrews
@ 2018-01-06 22:20 ` Mikael Magnusson
  2018-01-06 22:45   ` Ray Andrews
                     ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Mikael Magnusson @ 2018-01-06 22:20 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sat, Jan 6, 2018 at 6:33 AM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> Is it possible for zsh to know when the terminal in which it is running has
> awakened by having the mouse moved into that window?  I understand that it's
> the window manager that decides which terminal is active of course, but
> perhaps zsh knows when it is put to sleep by the mouse moving out of it's
> window, and also knows when it has been awakened again? I have a utility
> that lets you hotkey a mouse jump between terminals so as to jump between
> them without having to reach for the mouse itself, and I can call it fine
> within a function, but I'd like to be able to also execute some code after
> each jump but in the new window.  As it is, zsh just wakes up without
> seeming to know it's been asleep so there's nothing to 'attach' any commands
> to.  precmd() and preexec() are not aroused.   Any commands inside the
> calling function placed after the command to jump to the new terminal are
> executed in the old terminal, which is not surprising, so it would have to
> depend on the awakened terminal knowing it's been awakened.  Sorta like
> precmd but hooked to the activation of the terminal.  I understand that this
> might be outside of zsh's domain.

You can, yes. Note that if a program was running in the foreground,
zsh won't know if the terminal is active or not once that program
finishes though. I have never found a practical use for this.

# this might work for more terminals but i haven't tested, adjust as needed
# also check if you already have hooks for zle-line-init/finish and
adjust those as needed instead
# note also that leaving/entering a terminal will disable paste
hilighting when the following stuff is enabled
# These two hooks will enable and disable the terminal sending an
escape code to the terminal when it receives/loses focus, since most
programs won't handle them.
function _zle_line_init() {
  # enable focus events
  [[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?1004h'
}

function _zle_line_finish() {
  # disable focus events
  [[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?1004l'
}
zle -N zle-line-init _zle_line_init
zle -N zle-line-finish _zle_line_finish

# Handle FocusIn/Out events
bindkey '^[[I' focus-in
bindkey '^[[O' focus-out
# you can use two different functions too of course,
# i just happened to want the same thing to happen in both cases
# when i was testing this
zle -N focus-in _focus_handler
zle -N focus-out _focus_handler
function _focus_handler() {
  # $WIDGET will be focus-in when terminal receives
  # focus and focus-out when losing it, eg
  if [[ $WIDGET = focus-in ]]; then
    zle -M "hey we got focus"
  fi
}


-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-06 22:20 ` Mikael Magnusson
@ 2018-01-06 22:45   ` Ray Andrews
  2018-01-07 18:48     ` Grant Taylor
  2018-01-07  0:51   ` Ray Andrews
  2018-01-08  6:25   ` Mikael Magnusson
  2 siblings, 1 reply; 21+ messages in thread
From: Ray Andrews @ 2018-01-06 22:45 UTC (permalink / raw)
  To: zsh-users

On 06/01/18 02:20 PM, Mikael Magnusson wrote:

Thanks Mikael, I'll play with that and let you know.
> You can, yes. Note that if a program was running in the foreground,
> zsh won't know if the terminal is active or not once that program
> finishes though. I have never found a practical use for this.

What I want to do is pretty esoteric, if I execute my command " c 12 " I 
want focus to jump to xterm #12 (which already works fine) but also 'cd' 
xterm #12 to the current directory in the xterm I just jumped from.  Of 
course any sort of 'cd' command in the same function but after the jump 
continues to be executed in the original xterm, thus I'll want some way 
of detecting the change in focus. It's smartassy but should be 
educational to fool around with.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-06 22:20 ` Mikael Magnusson
  2018-01-06 22:45   ` Ray Andrews
@ 2018-01-07  0:51   ` Ray Andrews
  2018-01-07 13:24     ` Mikael Magnusson
  2018-01-08  6:25   ` Mikael Magnusson
  2 siblings, 1 reply; 21+ messages in thread
From: Ray Andrews @ 2018-01-07  0:51 UTC (permalink / raw)
  To: zsh-users

On 06/01/18 02:20 PM, Mikael Magnusson wrote:
> # Handle FocusIn/Out events
> bindkey '^[[I' focus-in
> bindkey '^[[O' focus-out

Mikael:

What keys are those?  I tried the usual suspects with no luck.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07  0:51   ` Ray Andrews
@ 2018-01-07 13:24     ` Mikael Magnusson
  2018-01-07 16:45       ` Ray Andrews
  0 siblings, 1 reply; 21+ messages in thread
From: Mikael Magnusson @ 2018-01-07 13:24 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sun, Jan 7, 2018 at 1:51 AM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> On 06/01/18 02:20 PM, Mikael Magnusson wrote:
>>
>> # Handle FocusIn/Out events
>> bindkey '^[[I' focus-in
>> bindkey '^[[O' focus-out
>
>
> Mikael:
>
> What keys are those?  I tried the usual suspects with no luck.

>> # Handle FocusIn/Out events
they are the sequences sent by the terminal when it receives/loses focus.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 13:24     ` Mikael Magnusson
@ 2018-01-07 16:45       ` Ray Andrews
  2018-01-07 18:23         ` Mikael Magnusson
  0 siblings, 1 reply; 21+ messages in thread
From: Ray Andrews @ 2018-01-07 16:45 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 16:45       ` Ray Andrews
@ 2018-01-07 18:23         ` Mikael Magnusson
  2018-01-07 18:39           ` Grant Taylor
  2018-01-07 19:06           ` Ray Andrews
  0 siblings, 2 replies; 21+ messages in thread
From: Mikael Magnusson @ 2018-01-07 18:23 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sun, Jan 7, 2018 at 5:45 PM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> 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:
> ------------------------------

Are you using xterm? Maybe some other knock-off terminal claims to be
xterm but actually doesn't support all the features xterm (and urxvt)
support.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 18:23         ` Mikael Magnusson
@ 2018-01-07 18:39           ` Grant Taylor
  2018-01-07 19:06           ` Ray Andrews
  1 sibling, 0 replies; 21+ messages in thread
From: Grant Taylor @ 2018-01-07 18:39 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

On 01/07/2018 11:23 AM, Mikael Magnusson wrote:
> Are you using xterm? Maybe some other knock-off terminal claims to be 
> xterm but actually doesn't support all the features xterm (and urxvt) 
> support.

I was not aware that Xterm would send keys to the window when it 
received and lost focus.  -  Do you have an Xterm setting enabled in the 
Main / VT / Font Options menus?

I don't know how I would use such focus awareness, but I'd like to 
dabble in it.



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3982 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-06 22:45   ` Ray Andrews
@ 2018-01-07 18:48     ` Grant Taylor
  0 siblings, 0 replies; 21+ messages in thread
From: Grant Taylor @ 2018-01-07 18:48 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 1671 bytes --]

On 01/06/2018 03:45 PM, Ray Andrews wrote:
> What I want to do is pretty esoteric, if I execute my command " c 12 " I 
> want focus to jump to xterm #12 (which already works fine) but also 'cd' 
> xterm #12 to the current directory in the xterm I just jumped from.

I'd like to know more about how you're changing the focus of the 
windows.  Would you please share?

> Of course any sort of 'cd' command in the same function but after the 
> jump continues to be executed in the original xterm, thus I'll want 
> some way of detecting the change in focus. It's smartassy but should be 
> educational to fool around with.

I've done something (I think is) similar to what you're wanting to do 
via xdotool sending key strokes to other windows.

Window 1 had a proprietary Python program running with a readline macro 
defined do perform some actions.

Window 2 had a "while :; do xdotool <send macro initiation key sequence 
to window 1>; sleep 60; done" loop running.

Window 3 had a "sleep 72000; xdotool <send Ctrl-C to window 2>" running.

I know that it's not the most graceful, but it did what I wanted it to do.

The point being that I was able to use the xdotool to send keyboard 
commands from one window into a different window.  -  Which sounds 
adjacent to what you're wanting your source xterm to do to xterm #12.

Granted, I don't know how to set up the targeting of xdotool in your 
scenario.  (I used xwininfo to get the Window IDs of window #1 & #2 and 
manually put the values on the xdotool command lines in windows #2 & #3 
respectively.)  But I suspect that can be worked out.



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3982 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 18:23         ` Mikael Magnusson
  2018-01-07 18:39           ` Grant Taylor
@ 2018-01-07 19:06           ` Ray Andrews
  2018-01-07 20:27             ` Bart Schaefer
  2018-01-07 20:29             ` Grant Taylor
  1 sibling, 2 replies; 21+ messages in thread
From: Ray Andrews @ 2018-01-07 19:06 UTC (permalink / raw)
  To: zsh-users

On 07/01/18 10:23 AM, Mikael Magnusson wrote:
>
> Are you using xterm? Maybe some other knock-off terminal claims to be
> xterm but actually doesn't support all the features xterm (and urxvt)
> support.
>
No, it's xfce4-terminal, I say 'xterm' because that seems generic for a 
graphical terminal.  I just fired up two real xterms and it works 
perfectly even with my diagnostic code as shown.  But xterm seems very 
primitive otherwise compared to xfce4-terminal, I wonder how I can 
pursue making that work with the latter?  Sounds like it's not really a 
zsh issue tho.  Bet it's with the bindkey lines.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 19:06           ` Ray Andrews
@ 2018-01-07 20:27             ` Bart Schaefer
  2018-01-07 20:43               ` Grant Taylor
  2018-01-07 21:12               ` Ray Andrews
  2018-01-07 20:29             ` Grant Taylor
  1 sibling, 2 replies; 21+ messages in thread
From: Bart Schaefer @ 2018-01-07 20:27 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sun, Jan 7, 2018 at 11:06 AM, Ray Andrews <rayandrews@eastlink.ca> wrote:
> No, it's xfce4-terminal

As far as I can tell, xfce4-terminal does not support sending anything
to the app running inside the terminal when the window gains focus.

> xterm seems very primitive
> otherwise compared to xfce4-terminal

xterm is older but more stuffed with features.  xfce4-terminal is
intentionally "lightweight".


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 19:06           ` Ray Andrews
  2018-01-07 20:27             ` Bart Schaefer
@ 2018-01-07 20:29             ` Grant Taylor
  1 sibling, 0 replies; 21+ messages in thread
From: Grant Taylor @ 2018-01-07 20:29 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 951 bytes --]

On 01/07/2018 12:06 PM, Ray Andrews wrote:
> But xterm seems very primitive otherwise compared to xfce4-terminal

What about Xterm seems primitive to you?

I've found that Xterm supports far more things (that I use and care 
about) than any of the other terminals that I've tried.

Many of the other terminals that I've tried seem to focus on window 
dressing and things outside of the actual terminal area.  Thus things 
that don't really impact my use of Xterm.

That being said, I would be interested in something that wrapped around 
Xterm and provided various window dressing / eye candy while maintaining 
all of the things that Xterm can do that other terminal emulators don't do.

Note:  I use Xterm as the proper name for the "xterm" program / binary 
and (rarely) "xterm" as a generic term for other terminal emulators. 
(Think Xerox / Kleenex proper brands vs alternative brands.)



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3982 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 20:27             ` Bart Schaefer
@ 2018-01-07 20:43               ` Grant Taylor
  2018-01-07 21:12               ` Ray Andrews
  1 sibling, 0 replies; 21+ messages in thread
From: Grant Taylor @ 2018-01-07 20:43 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 933 bytes --]

On 01/07/2018 01:27 PM, Bart Schaefer wrote:
> xterm is older but more stuffed with features.

Yep.  Features that I occasionally use, like, and want to continue using.

  - Sixel / ReGIS graphics in the terminal w/o some sort of overlay hack.
  - answer back
  - Tektronix 4014 emulation - great for things like GNUplot
  - double height and / or width fonts
  - the ability to save a screen as HTML (read: text) including colors
  - Media Copy - send remote command output to a file on the client's 
desktop.

That's just what comes to mind at the moment.

I really like and use both Sixel and Media Copy.  MC is quite nice in 
that I can be sshed to a remote machine, running commands interactively, 
and cause the output of a specific command to show up on my client 
desktop as a file.  }:-)

I know that they are esoteric things.  But they are things that I do use.



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3982 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 20:27             ` Bart Schaefer
  2018-01-07 20:43               ` Grant Taylor
@ 2018-01-07 21:12               ` Ray Andrews
  2018-01-07 21:36                 ` Grant Taylor
  2018-01-08  1:43                 ` Ray Andrews
  1 sibling, 2 replies; 21+ messages in thread
From: Ray Andrews @ 2018-01-07 21:12 UTC (permalink / raw)
  To: zsh-users

On 07/01/18 12:27 PM, Bart Schaefer wrote:
>
> xterm is older but more stuffed with features.  xfce4-terminal is
> intentionally "lightweight".
>
Hmmm ... yeah, I guess this thing is pretty non-light.  I could never 
get  xterm to use anything but the nastiest fonts tho.  But I'm tempted 
to see what mischief I can get up to with Mikael's code.  Probably some 
horrible man page for xterm if I had the spine.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 21:12               ` Ray Andrews
@ 2018-01-07 21:36                 ` Grant Taylor
  2018-01-08  1:43                 ` Ray Andrews
  1 sibling, 0 replies; 21+ messages in thread
From: Grant Taylor @ 2018-01-07 21:36 UTC (permalink / raw)
  To: zsh-users

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

On 01/07/2018 02:12 PM, Ray Andrews wrote:
> I could never get  xterm to use anything but the nastiest fonts tho.
I've had reasonably good luck with altering fonts in Xterm.  (Anyone 
who's interested…)  Feel free to email me (off list to avoid spamming 
the Zsh-users list) if you want pointers.



-- 
Grant. . . .
unix || die


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 3982 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-07 21:12               ` Ray Andrews
  2018-01-07 21:36                 ` Grant Taylor
@ 2018-01-08  1:43                 ` Ray Andrews
  1 sibling, 0 replies; 21+ messages in thread
From: Ray Andrews @ 2018-01-08  1:43 UTC (permalink / raw)
  To: zsh-users

On 07/01/18 01:12 PM, Ray Andrews wrote:
> On 07/01/18 12:27 PM, Bart Schaefer wrote:
>>
>> xterm is older but more stuffed with features.  xfce4-terminal is
>> intentionally "lightweight".
>>
> Hmmm ... yeah, I guess this thing is pretty non-light.  I could never 
> get  xterm to use anything but the nastiest fonts tho.  But I'm 
> tempted to see what mischief I can get up to with Mikael's code.  
> Probably some horrible man page for xterm if I had the spine.
>
>
Fiddling around, some of the modern emulators work, some don't.   Gotta 
be careful what $TERM is tho, is seems to vary quite a bit.


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-06 22:20 ` Mikael Magnusson
  2018-01-06 22:45   ` Ray Andrews
  2018-01-07  0:51   ` Ray Andrews
@ 2018-01-08  6:25   ` Mikael Magnusson
  2018-01-08  6:28     ` Mikael Magnusson
  2 siblings, 1 reply; 21+ messages in thread
From: Mikael Magnusson @ 2018-01-08  6:25 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Sat, Jan 6, 2018 at 11:20 PM, Mikael Magnusson <mikachu@gmail.com> wrote:
> On Sat, Jan 6, 2018 at 6:33 AM, Ray Andrews <rayandrews@eastlink.ca> wrote:
>> Is it possible for zsh to know when the terminal in which it is running has
>> awakened by having the mouse moved into that window?  I understand that it's
>> the window manager that decides which terminal is active of course, but
>> perhaps zsh knows when it is put to sleep by the mouse moving out of it's
>> window, and also knows when it has been awakened again? I have a utility
>> that lets you hotkey a mouse jump between terminals so as to jump between
>> them without having to reach for the mouse itself, and I can call it fine
>> within a function, but I'd like to be able to also execute some code after
>> each jump but in the new window.  As it is, zsh just wakes up without
>> seeming to know it's been asleep so there's nothing to 'attach' any commands
>> to.  precmd() and preexec() are not aroused.   Any commands inside the
>> calling function placed after the command to jump to the new terminal are
>> executed in the old terminal, which is not surprising, so it would have to
>> depend on the awakened terminal knowing it's been awakened.  Sorta like
>> precmd but hooked to the activation of the terminal.  I understand that this
>> might be outside of zsh's domain.
>
> You can, yes. Note that if a program was running in the foreground,
> zsh won't know if the terminal is active or not once that program
> finishes though. I have never found a practical use for this.
>
> # this might work for more terminals but i haven't tested, adjust as needed
> # also check if you already have hooks for zle-line-init/finish and
> adjust those as needed instead
> # note also that leaving/entering a terminal will disable paste
> hilighting when the following stuff is enabled
> # These two hooks will enable and disable the terminal sending an
> escape code to the terminal when it receives/loses focus, since most
> programs won't handle them.
> function _zle_line_init() {
>   # enable focus events
>   [[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?1004h'
> }
>
> function _zle_line_finish() {
>   # disable focus events
>   [[ $TERM == rxvt-unicode || $TERM = xterm ]] && printf '\e[?1004l'
> }
> zle -N zle-line-init _zle_line_init
> zle -N zle-line-finish _zle_line_finish
>
> # Handle FocusIn/Out events
> bindkey '^[[I' focus-in
> bindkey '^[[O' focus-out
> # you can use two different functions too of course,
> # i just happened to want the same thing to happen in both cases
> # when i was testing this
> zle -N focus-in _focus_handler
> zle -N focus-out _focus_handler
> function _focus_handler() {
>   # $WIDGET will be focus-in when terminal receives
>   # focus and focus-out when losing it, eg
>   if [[ $WIDGET = focus-in ]]; then
>     zle -M "hey we got focus"
>   fi
> }

I forgot to include these lines,

# this is as close to no-op as you get in menuselect/isearch
bindkey -M menuselect '^[[I' redisplay
bindkey -M menuselect '^[[O' redisplay
bindkey -M isearch '^[[I' redisplay
bindkey -M isearch '^[[O' redisplay

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-08  6:25   ` Mikael Magnusson
@ 2018-01-08  6:28     ` Mikael Magnusson
  2018-01-08 15:39       ` Ray Andrews
  0 siblings, 1 reply; 21+ messages in thread
From: Mikael Magnusson @ 2018-01-08  6:28 UTC (permalink / raw)
  To: Ray Andrews; +Cc: Zsh Users

On Mon, Jan 8, 2018 at 7:25 AM, Mikael Magnusson <mikachu@gmail.com> wrote:

> I forgot to include these lines,
>
> # this is as close to no-op as you get in menuselect/isearch
> bindkey -M menuselect '^[[I' redisplay
> bindkey -M menuselect '^[[O' redisplay
> bindkey -M isearch '^[[I' redisplay
> bindkey -M isearch '^[[O' redisplay

And of course now I realize you can do this,

bindkey -M menuselect -s '^[[I' ''
bindkey -M menuselect -s '^[[O' ''
bindkey -M isearch -s '^[[I' ''
bindkey -M isearch -s '^[[O' ''

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-08  6:28     ` Mikael Magnusson
@ 2018-01-08 15:39       ` Ray Andrews
  2018-01-08 16:08         ` Peter Stephenson
  0 siblings, 1 reply; 21+ messages in thread
From: Ray Andrews @ 2018-01-08 15:39 UTC (permalink / raw)
  To: zsh-users

On 07/01/18 10:28 PM, Mikael Magnusson wrote:


	bindkey -M menuselect '^[[I' redisplay

	bindkey -M menuselect -s '^[[I' ''

All four of those 'menuselect' lines give:


... no such keymap `menuselect'

Anyway, the original code works with rxvt-unicode and tho it's hard to 
get looking good, it seems highly recommended.   It also works with 
'terminator'FWIW.



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-08 15:39       ` Ray Andrews
@ 2018-01-08 16:08         ` Peter Stephenson
  2018-01-08 16:38           ` Ray Andrews
  0 siblings, 1 reply; 21+ messages in thread
From: Peter Stephenson @ 2018-01-08 16:08 UTC (permalink / raw)
  To: zsh-users

On Mon, 8 Jan 2018 07:39:32 -0800
Ray Andrews <rayandrews@eastlink.ca> wrote:
> On 07/01/18 10:28 PM, Mikael Magnusson wrote:
> 	bindkey -M menuselect '^[[I' redisplay
> 	bindkey -M menuselect -s '^[[I' ''
> 
> All four of those 'menuselect' lines give:
>
> ... no such keymap `menuselect'

You need to "zmodload zsh/complist", but actually if you don't have that
loaded those lines aren't doing anything anyway, so no big deal, just
ignore.

pws


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: command on switching terminals?
  2018-01-08 16:08         ` Peter Stephenson
@ 2018-01-08 16:38           ` Ray Andrews
  0 siblings, 0 replies; 21+ messages in thread
From: Ray Andrews @ 2018-01-08 16:38 UTC (permalink / raw)
  To: zsh-users

On 08/01/18 08:08 AM, Peter Stephenson wrote:
>
> You need to "zmodload zsh/complist", but actually if you don't have that
> loaded those lines aren't doing anything anyway, so no big deal, just
> ignore.
>
> pws
>
>
At the risk of biting off more than I can chew, is there some place I 
can read up on all that stuff?  I'm taking Mikael's code on faith, these 
lines in particular seem black-magical:

printf '\e[?1004h'

bindkey '^[[I' focus-in

$WIDGET = focus-in

... it seems sorta like 'keystrokes' are really commands but they aren't 
really keystrokes.  This is a whole new vista, I think.





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-01-08 17:08 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-06  5:33 command on switching terminals? Ray Andrews
2018-01-06 22:20 ` Mikael Magnusson
2018-01-06 22:45   ` Ray Andrews
2018-01-07 18:48     ` Grant Taylor
2018-01-07  0:51   ` Ray Andrews
2018-01-07 13:24     ` Mikael Magnusson
2018-01-07 16:45       ` Ray Andrews
2018-01-07 18:23         ` Mikael Magnusson
2018-01-07 18:39           ` Grant Taylor
2018-01-07 19:06           ` Ray Andrews
2018-01-07 20:27             ` Bart Schaefer
2018-01-07 20:43               ` Grant Taylor
2018-01-07 21:12               ` Ray Andrews
2018-01-07 21:36                 ` Grant Taylor
2018-01-08  1:43                 ` Ray Andrews
2018-01-07 20:29             ` Grant Taylor
2018-01-08  6:25   ` Mikael Magnusson
2018-01-08  6:28     ` Mikael Magnusson
2018-01-08 15:39       ` Ray Andrews
2018-01-08 16:08         ` Peter Stephenson
2018-01-08 16:38           ` Ray Andrews

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).