Can I start a desktop launcher from command line? E.g. I have a desktop launcher for slack in my ~/Desktop directory:
vadim@my-pc ~/Desktop $ cat slack.desktop
[Desktop Entry]
Name=Slack
Comment=Slack Desktop
GenericName=Slack Client for Linux
Exec=/usr/bin/slack --proxy-server="10.1.50.8:8080"
Icon=/usr/share/pixmaps/slack.png
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Network;InstantMessaging;
MimeType=x-scheme-handler/slack;
Name[en_US]=slack
In the Exec parameter I can specify various options to start application with, for instance proxy server. I find it convenient to specify proxy exactly in the parameters of desktop launcher.
Now I'd like to be able to start slack from command line using all start options from the desktop launcher. I know I can create a shell script file and specify in it all start options I want and run this file both from desktop launcher and from command line, but is there a way to just run slack.desktop file from command line?
Best Answer
You can use a tool like
xdg-open
(Broken currently),kde-open
,gnome-open
,gtk-launch
or the equivalent for your desktop-environment. (xdg-open
seems to be supposed to be the universal one...)(It seems like just about everything other than
gtk-launch
(more similar tools might exist for other toolkits) suffers from the same bug asxdg-open
- it opens the .desktop file in an editor instead of running it)Packages: (Exact name will differ betweem distros) (this is based on CentOS 7)