Reputation: 432
I have two XTerm terminals on my Ubuntu desktop. My goal is to activate py2 virtualenv when I open the first one and py3 when I open the second one.
Tried to manipulate the behavior by changing the Exec
line under [Desktop Entry]
but it did not work
[Desktop Entry]
Name=PY2-VENV
Exec=uxterm && source /home/user/py2-venv/bin/activate
Terminal= true
.
.
.
Any ideas how to do it?
Upvotes: 0
Views: 154
Reputation: 54583
You might have meant
Exec=uxterm
(a shell script used for setting up xterm) rather than
Exec=uterm
however, that &&
may not work, since the desktop specification calls for something that can be directly transformed into an execvp
call:
The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments. The executable program can either be specified with its full path or with the name of the executable only. If no full path is provided the executable is looked up in the $PATH environment variable used by the desktop environment. The name or path of the executable program may not contain the equal sign ("="). Arguments are separated by a space.
Arguments may be quoted in whole. If an argument contains a reserved character the argument must be quoted. The rules for quoting of arguments is also applicable to the executable name or path of the executable program as provided.
Assuming your shell is bash, you can use its comment-line options for pointing to your different shell initialization files:
--init-file file
--rcfile file
Execute commands from file instead of the system wide initial‐
ization file /etc/bash.bashrc and the standard personal initial‐
ization file ~/.bashrc if the shell is interactive (see INVOCA‐
TION below).
Something like this, for example:
Exec=uxterm -e bash --rcfile /home/user/py2-venv/bin/activate
Upvotes: 1