Skip to content

Shell script to open new terminals with the same virtual environment.

License

Notifications You must be signed in to change notification settings

thebarbershop/environmental

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

environmental

When I'm working in a Python virtual environment, I am too lazy to

  1. Open a new terminal window/tab with some hotkeys and
  2. Type conda activate my-environment.

So I created two shell commands, window and tab.

Supported environments

macOS

I have developed and tested this tool on macOS mojave.

The tool is available for conda environments.

Linux

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.

Install

Install on macOS

  1. Clone the repo.
  2. Set permission to run commands.
  3. 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.

Install on Linux

To use this tool, you need to install the three extra tools, xdotool, xclip, and wmctrl.

sudo apt install xdotool xclip wmctrl

Then,

  1. Clone the repo.
  2. Set permission to run commands.
  3. 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.

How to use

window

To open a new terminal window with the same environment at the same directory,

(my-environment) current-directory $ window

tab

To open a new terminal tab with the same environment at the same directory,

(my-environment) current-directory $ tab

License

This software is Unlicenced. Do whatever you want with it, and I am not liable for any consequences. For more, read LICENSE.

Note

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.

About

Shell script to open new terminals with the same virtual environment.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages