Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am currently packaging an application in a Ubuntu .deb file. The package will not be distributed publicly.

Currently, I package a .desktop file which is installed to /usr/share/applications. After installing the package, the .desktop file gets picked up correctly, and a new entry for my application is added to the Applications menu. So far, so good.

Besides the Applications menu entry however, I also want to install an application launcher on the user's desktop. The problem is that I do not know beforehand the directory of the user's Desktop. How should I install a launcher on the user's desktop?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

http://stackoverflow.com/questions/119031/how-to-set-my-applications-desktop-icon-for-linux-kde-gnome-etc

EDIT: see comments for info on using xdg-desktop-icon command in postinst/postrm scripts.

share|improve this answer
    
I already have a .desktop file, the challenge is how to get it installed on the user's desktop. I'm not using Cmake, I'm using Ubuntu's packaging tools, dh_make and debuild. –  Ton van den Heuvel Dec 2 '09 at 17:20
1  
I don't know if there is a better way, but you can install it calling xdg-desktop-icon install .../program.desktop from the post installation script debian/postinst, and remove it calling xdg-desktop-icon uninstall ... from the post removal script debian/postrm –  alfplayer Dec 2 '09 at 23:52
    
Thanks, I'll try that. –  Ton van den Heuvel Dec 4 '09 at 16:48
    
I have tried Using xdg-desktop-icon install. The desktop icon is installed to the user's desktop, but is read-only for root. How to ensure that the desktop icon is usable by the user? –  Ton van den Heuvel Dec 11 '09 at 19:17
1  
The environment variables $SUDO_USER and $HOME (I believe that both are present on postinst) are useful to do this, they both refer to the user that executed the installer. After installing the file, you can change its file ownership to $SUDO_USER and file permissions to 755. –  alfplayer Dec 11 '09 at 20:20

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.