You are not logged in.
Pages: 1
Hi,
I am trying to use environment variables in a custom launcher.
I tried to use this command line as the command:
exo-open --working-directory $HOME/src --launch TerminalEmulator
but when I try to execute the launcher, I get this error message in a modal box:
----
Failed to launch preferred application for category "TerminalEmulator".
Failed to change to directory '$HOME/src' (No such file or directory).
----
I was expecting that environment variables are supported directly. The command specified does work in a bash shell as expected. The launcher fails even if "Run in terminal" is checked.
Is there a way that I can use environment variable in a launcher or is this a bug?
Thanks,
Ralph
----
System info:
ralph@goten:~$ xfce4-about --version
xfce4-about 4.8.3 (Xfce 4.8)
Copyright (c) 2008-2011
The Xfce development team. All rights reserved.
Please report bugs to <[url]http://bugzilla.xfce.org[/url]>.
Translators list from 2011-09-18 00:00:09.
ralph@goten:~$ uname -a
Linux goten 3.2.0-31-generic #50-Ubuntu SMP Fri Sep 7 16:16:45 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
----
EDIT: I did find a workaround. It came to me when I realized that my command was not executed in a shell. So, I could wrap the entire command line in a shell call:
bash -c 'exec exo-open --working-directory $HOME/src --launch TerminalEmulator'
Additionally, I can even export more environment variables, too:
bash -c 'export NAME=rrice;exec exo-open --working-directory $HOME/src --launch TerminalEmulator'
It seems weird, but it works for now.
Last edited by rrice (2012-09-30 21:07:02)
Offline
I have not the exact same problem, but a related: Indeed, the above mentioned workaround works for the Exec key, but (of course) not for other keys, e.g. the Icon key.
Here's how my app.desktop file looks like:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Categories=Network
Exec=/bin/sh -c "$HOME/opt/app/app"
Name=App
Icon=/home/user/opt/app/icon.png
Is there a way to load the icon directly from the users $HOME directory?
I have read the spec[0] for .desktop files, but did not find a solution =/
Offline
It should work just by specifying the full path to the icon:
Icon=/home/toz/d.png
If however, you're looking to use the $USER environment variable there, then I have to ask why? Just place the icon in a location that everyone has access to (i.e. /usr/share/icons) and specify the full path.
Or perhaps I'm not fully understanding the issue...
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Online
@ToZ: Thanks for your very fast reply!
Yes, i want to use an environment variable like $USER or $HOME, because the system is used by many users and every user may have his own version of this program. And i want to avoid to create a specific app.desktop file for every user, but have a generic one to copy into users $HOME/.local/share/applications/ directory.
Last edited by dirdi (2014-05-17 23:39:34)
Offline
In that case, would it not be useful to have one copy of the icon in a system directory accessible by all (i.e. /usr/share/icons) so that each user doesn't need to have a copy of the icon in their home directory?
Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki | Community | Contribute ---
Online
I thought it would be nice to have all files of the program in one place and not scattered across the whole filesystem. However, as it seems there is not a simple solution for this problem, i created a symlink $HOME/.icons/app.png (see [0]) linking to ../opt/app/icon.png (/usr/share/icons is not an option, since i have no root privileges).
app.desktop:
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Categories=Network
Exec=/bin/sh -c "$HOME/opt/app/app"
Name=App
Icon=app.png
Not very elegant, but i think i have wasted enough time on this and at least i have avoided to create a specific app.desktop file for every user xD
[0] http://standards.freedesktop.org/icon-t … ory_layout
@ToZ: Thanks for your help
Offline
Pages: 1
[ Generated in 0.012 seconds, 7 queries executed - Memory usage: 546.24 KiB (Peak: 547.09 KiB) ]