WIP: Feature/save user session venv (solves #879)
Additionally to the current working directory, it would be nice to also store the python virtual environment that is currently used in the config file and re-activate it on Session restore.
This solves #879
Hi terminator developers,
I just need to figure out, how to get the virtual environment of a current terminal.
prefix = getattr(sys, "base_prefix", None) or getattr(sys, "real_prefix", None) or sys.prefix
if prefix != sys.prefix: # session is in a virtual environment
return sys.prefix
cannot work in this case, as we would need to run a python program within the current shell.
Do you know, if this information is kept somewhere in the shell / process ? (it should, since command prompts also show the current venv)
Can you fix the conflicts from your version change? Then I think I can merge this in. This is getting really close to adding functionality that is not strictly part of the terminal emulator process, but I think I'll allow it.
To really add venv functionality, you could look at adding venv to the layout editor as well. Add it as an extra parameter to the layouts.
I'm worried that this is getting into "Python IDE" territory, but I'm allowing it as this is what a lot of people are actually using it for.
Hi @mattrose, I can fully understand your concerns ( when I started this branch, I also thought about it ;), but as it is a python based application and many people use python, it is worth having this feature included). So thanks for supporting this PR ! :)
There is one "game-stopper" preventing me from finallising the pull request (next to my time limitations): I have not found an elegant, pythonic way to get hold of the name / path of the current virtual environment of a terminator window: to my understanding of terminator, this information is hold only by the shell running in the window. Is there a generic interface, I could use to query the shell for the python environment ? How can i run this code snippet shown above ? Do you have any idea ? Thanks, mark