Cygwin {ssh localhost} task - which ConEmu variables to send (forward) for ConEmuC to work?

67 views
Skip to first unread message

Gene Pavlovsky

unread,
Oct 3, 2016, 11:36:51 AM10/3/16
to ConEmu ML
Using Cygwin sshd running on localhost.

I have a task:
ssh.exe localhost -new_console:t:"ssh localhost"

I'd like to be able to do:
ConEmuC -StoreCWD;
ConEmuC -GuiMacro Rename 0 "$PWD"

(it's part of my PROMPT_COMMAND)

Of course, it doesn't work, because there are no ConEmu-related environment variables set in the ssh session.
I can set up ssh to send particular variables to the remote host, like explained here.
Question is - which env vars are necessary/enough?
ConEmuBaseDir to be able to find the ConEmuC command (although I can hardcode the path).
For ConEmuC to work, what is needed? ConEmuPID, ConEmuHWND, ...?

ConEmu Maximus

unread,
Oct 3, 2016, 11:48:44 AM10/3/16
to cone...@googlegroups.com

Sending environment variables has no sense - they are not available to ConEmu and while using ssh there is no moment when you may "forward" variables to ConEmu.
Instead you have to use PS1.
[cygwin/msys connector](https://conemu.github.io/en/CygwinMsysConnector.html)
[ConEmu specific OSC](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC)

Gene Pavlovsky

unread,
Oct 3, 2016, 11:55:04 AM10/3/16
to ConEmu ML, conemu....@gmail.com
Really?
I'm running ssh task as a ConEmu tab. The ssh process (Cygwin's) receives all ConEmu's env vars from ConEmu when it starts. Of course, the session it creates has it's own environment, that doesn't have these variables. If I transfer ConEmu env vars to this new session, wouldn't ConEmuC be able to communicate with the ConEmu process? Note that I'm talking about ssh-ing to localhost.

Maximus ConEmu

unread,
Oct 3, 2016, 7:42:08 PM10/3/16
to ConEmu ML
Really!
You may pass ConEmu environment to your server, but that really has no sense.
1. How do you plan to pass environment *from server* to *ConEmu GUI*?
2. Read again my previous post, your solution is there (ANSI).

Gene Pavlovsky

unread,
Oct 3, 2016, 8:15:57 PM10/3/16
to ConEmu ML
I didn't figure there's any passing env vars back involved!
Ok, to get it working with ANSI way, I had to run my ssh.exe task via conemu-cyg-64.exe.
# cd /home/gene
# echo $'\e]9;3;""\e\\'
# echo $'\e]9;9;"'$PWD$'"\e\\'
# echo $'\e]9;9;"'$(cygpath -w $PWD)$'"\e\\'

First line resets the tab title to default template (I had it called "ssh localhost"), which I have as `%c %d`.
Second line displays "\home\gene" as the tab title. Opening Far task with `/dir "%CD%"` gives an error since it's an invalid path for Windows/ConEmu.
Third line displays "C:\cygwin\home\gene" as the tab title. Opening Far task works.
Mission accomplished?
Feel free to use the code snippets to improve the docs https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC
esc=$(printf '\033')
esc
=$'\e'
In a modern bash, it's better to use the $'' syntax.

Thanks for your help, Max
Reply all
Reply to author
Forward
0 new messages