Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

(ConEmu + Cygwin) How to change tab name of ConEmu from within a cygwin bash script

i've configuring my ConEmu + Cygwin enviroment. I've created a task, when i start it in a tab, the task will run a batch file, which in turn will change dir into cygwin and run

bash --login -i my_ssh_entry_script.sh

Inside my_ssh_entry_script.sh, it will read a config file in my home directory then print a menu for me to select which host to connect. And finally

...
exec ssh -p$port $userhost

Now i can work on the selected machine in the same conemu tab. This works fine. And the script also works on linux machine too.

But there is a little flaw. I can't change the tab's title. I've tried to change it to:

....
exec $(cygpath ${ConEmuDir})/ConEmu.exe /cmd ssh -p$port $userhost -cur_console:t:$title

But this will always create a new tab. Any suggestion to slove it? Thanks~

like image 581
jayven Avatar asked Jul 28 '14 09:07

jayven


2 Answers

1) You need GuiMacro, thoroughly described in the project wiki: http://conemu.github.io/en/GuiMacro.html

ConEmuC -GuiMacro Rename 0 "Title"

2) You do not need to run batch. It causes extra and useless cmd.exe in yours process tree. You can do all required "CD" and "SET" from the task content directly.

like image 192
Maximus Avatar answered Nov 09 '22 15:11

Maximus


At least for cmd shell: "-new_console:d:C:\Users\dir_name" cmd /V /K -new_console:t:Tab_renamed

like image 39
Marius Pojar Avatar answered Nov 09 '22 17:11

Marius Pojar