Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: command on switching terminals?



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: smime.p7s
Description: S/MIME Cryptographic Signature



Messages sorted by: Reverse Date, Date, Thread, Author