2

I have this launcher I created with a quicklist full of options to execute different applications. One of the options is TeamViewer and this is the quicklist code for it:

[Desktop Action fav-teamviewer]
Name=TeamViewer
Exec=/opt/teamviewer9/tv_bin/script/teamviewer
OnlyShowIn=Unity

This works perfectly, but what if I wanted to execute the "teamviewer.desktop" file directly? Something like this...

[Desktop Action fav-teamviewer]
Name=TeamViewer
Exec=/usr/share/applications/teamviewer.desktop
OnlyShowIn=Unity

I've tried it, but it won't work. Why is it not working? Am I doing it wrongly or is it impossible to be done?

The reason I want to do it is that if I run TeamViewer normally, from the Dash, its icon on the Launcher is perfect (first image); but if I run it from that quicklist option, it loses its default icon and gets the generic Wine application icon (second image). Please, see screenshots for a better understanding.

If run from the Dash: If run from the QuickList:

I hope you can help me. Thanks for your attention.

  • That's because .desktop files aren't executables. Other apps (like Unity launcher) can read them and execute specifyed programms. – enedil May 23 '14 at 21:51
  • I see, enedil. So... is it impossible to do it? Isn't there a workaround or a legitimate way to do it, like using "xdg-open", "gnome-terminal -x" or whatever? I don't know. Thanks for your answer. :) – brunces May 23 '14 at 21:56
  • 1
    Use Exec=gtk-launch teamviewer.desktop /usr/share/applications Instead of Exec=/usr/share/applications/teamviewer.desktop To launch desktop file. – Pandya May 24 '14 at 4:32
  • I am pretty sure there is a solution, but I need to understand: do you run teamviewer under wine? there is a linux version, and the command seems no to call a wine application? – Jacob Vlijm May 24 '14 at 7:58
  • @JacobVlijm Linux version is Windows version with Wine included. – enedil May 24 '14 at 10:08
2

Desktop file can not be launched by directly from Exec. So, use gtk-launch as follows in your second file Exec option:

[Desktop Action fav-teamviewer]
Name=TeamViewer
Exec=gtk-launch teamviewer.desktop /usr/share/applications
OnlyShowIn=Unity

By this way you will be able to launch teamviewer.desktop by launching this file.


From man gtk-launch:

NAME
       gtk-launch - Launch an application

SYNOPSIS
       gtk-launch [APPLICATION] [URI...]

Reference of Use for desktop file:-

DESCRIPTION  
         gtk-launch takes at least one argument, the name of the application to launch.
The name should match application desktop file name, as residing in /usr/share/application, 
with or without the '.desktop' suffix.
  • @Glutanimate I added this answer. – Pandya Aug 14 '14 at 9:22
  • Ah, sorry. I didn't get a notification. +1 for the great answer! – Glutanimate Aug 22 '14 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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