Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have created quicklists very successfully but one thing is a problem, I have tried to use $HOME in the Exec= line but it is not accepted, I have to enter the full /home/user path. This seems at odds with most other scripts.

share|improve this question
add comment

1 Answer

You cannot access such environment variables in a .desktop file. What should work, is to write a wrapper script and start this instead

Exec=/path/to/wrapper

and the wrapper script would call

$HOME/whatever
share|improve this answer
    
htorque, tried your helpful suggestion, and some others of my own devising, but none worked, guess I have to type out in full the path - a shame that custom .desktop files are not transportable by having a $HOME option but it's a small price to pay –  Mike Birchley Sep 3 '11 at 11:44
    
The first method definitely works. Make sure your wrapper starts with #!/bin/bash and that it's executable. –  htorque Sep 3 '11 at 12:05
    
htorque, you are quite correct. Commenting 'but none worked' was a hasty comment; I do link this .desktop file to a bash script that calls some small scripts; however, some shortcuts don't point to smaller scripts, but are one-liners, and these were the concern. My way around this is as you pointed out, is point to wrapper scripts in shortcut lines, instead of putting one-liners. I just find this a bit clunky - having used $HOME in scripts for so long. I may experiment with passing variables to the base script via the shortcuts. My launcher button brings up my Zenity menu, works well. –  Mike Birchley Sep 3 '11 at 22:26
    
.desktop files are not scripts of any kind. –  Jo-Erlend Schinstad Sep 4 '11 at 3:54
    
@JoErlendSchinstad Right, removed the second suggestion. –  htorque Sep 4 '11 at 6:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.