When I'm working in a Python virtual environment, I am too lazy to
- Open a new terminal window/tab with some hotkeys and
- Type
conda activate my-environment
.
So I created two shell commands, window
and tab
.
I have developed and tested this tool on macOS mojave.
The tool is available for conda environments.
I have developed and tested this tool on Ubuntu 18.04 with GNOME 3.28.2.
The tool is available for conda and virtualenv environments.
- Clone the repo.
- Set permission to run commands.
- Copy the files so that you can run the commands.
git clone https://github.com/thebarbershop/environmental.git
sudo chmod +x environmental/mac/conda/*
sudo cp environmental/mac/conda/* /usr/local/bin/
Now you may delete the downloaded files, if you don't want to keep them around.
rm -r environmental/
The script emulates ⌘ Command+N and ⌘ Command+T to open a new window/terminal. You have to fix line 8 of each script, if you use a different combination of keys.
To use this tool, you need to install the three extra tools, xdotool, xclip, and wmctrl.
sudo apt install xdotool xclip wmctrl
Then,
- Clone the repo.
- Set permission to run commands.
- Copy the files so that you can run the commands.
git clone https://github.com/thebarbershop/environmental.git
sudo chmod +x environmental/linux/conda/*
sudo cp environmental/linux/conda/* /usr/local/bin/
If you use virtualenv instead of conda, replace the path accordingly for the last two commands.
Now you may delete the downloaded files, if you don't want to keep them around.
rm -r environmental/
The script emulates Control+Shift+N and Control+Shift+T to open a new window/terminal. You have to fix line 10 of window
and line 11 of tab
, if you use a different combination of keys.
To open a new terminal window with the same environment at the same directory,
(my-environment) current-directory $ window
To open a new terminal tab with the same environment at the same directory,
(my-environment) current-directory $ tab
This software is Unlicenced. Do whatever you want with it, and I am not liable for any consequences. For more, read LICENSE.
I don't have any plan to import this tool for any other OS or environment manager than the ones I am using. (But I may someday, whenever I feel like it.)
So feel free to fork and modify to fit your own system. I would deeply appreciate if you send me a pull request with your addition.