Add Comment
|
Related Links
|
TrackBack
Relative Path with Linux .desktop FilesThe Linux .desktop files--files with ".desktop" extension--allows Linux window managers to launch scripts and executables with visible icons. It's pretty much the Windows shortcuts in the Linux world. Unlike the Windows shortcuts, Linux .desktop files are text files that you can edit easily. It includes entries for execution path and executable to run. A few generations back, you are able to specify relative path using environment variables (e.g. ${HOME}/bin/scripts/UNIX). But you can no longer use environment variables in today's Linux distributions. However, there is a way to still use relative path in the Linux .desktop file. And that is to leave out the forward slash on the path. For example, the following entries will no longer work in the .desktop file, because the ${HOME} variable is no longer accepted: Exec="${HOME}/bin/scripts/UNIX/Prototype.bash" If you try to launch that icon, you'll get the following error message: "There was an error launching the application. But the following simple change to the .desktop file makes all the difference: Exec="Prototype.bash" As you can see, today's Linux distribution defaults icon launch to your home directory. And it still accepts a relative path from your home directory if you don't provide the forward slash. So the relative path capability hasn't been completely taken away. You can still take advantage of it knowing this trick. Mel http://standards.freedesktop.org/desktop-entry-spec/ Exec=bash -c '_PWD="$PWD"; cd "`echo $0 | sed s/filename.desktop$//`"; ./program.sh run; cd "_PWD"' %k Alexandre Magno This is great info, thanks for sharing! nexayq
Add Comment
|
Related Links
|
TrackBack
Did your message disappear? Read the Forums FAQ. TrackBackTrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites. Send Ping | TrackBack URL | Spam Control Title: Ubuntu 13.04 Desktop File Restrictions Add CommentSpam Control | * indicates required field Messages, files, and images copyright by respective owners. |
Articles
|
Wiki
125 Users Online
|
Copyright © 2004 - 2024. All Rights Reserved. |