PDA

View Full Version : Shortcut



scottjsn
26-Jul-2012, 18:51
Running SLED 11 with KDE4. To launch an application, I need to go to the /opt.xxx to locate the executable. Back in the Windows I could either launch an app under the Program or create a shortcut on the desktop. Now in my current environment, I want to do the same. How can I do it?

mikewillis
26-Jul-2012, 21:18
Is what you're launching from /opt a third party application you installed which didn't create it's own menu entry? Some applications will create a menu entry, some won't.

I expect there's a way to create a menu entry in KDE with some sort of graphical tool (try kmenuedit don't know if it still exists or is in SLED) but I don't use KDE or currently have access to a machine with KDE on it. So I'll tell you the generic way of doing it which might seem complicated but does have the advantage that it works for KDE, GNOME and other Desktop Environments too.

Each shortcut you see in the KDE/GNOME menu exists because of a .desktop file. Such files conform to a specification (http://standards.freedesktop.org/menu-spec/menu-spec-latest.html). If you have a look in /usr/share/applications you'll find lots of them. You can have a look at them and see how they're constructed. You can make you own using any text editor. There's lots of things you can put in there but a basic file need only contain

[Desktop Entry]
Type=Application
Name=My App
Exec=/path/to/executable %u
Icon=/path/to/icon

So make a file that looks like that, with suitable values for Exec and Icon and save it with a suitable name that ends in .desktop
If you want the menu entry to be visible to any user then put it in to /usr/share/applications If you only want the menu entry to be visible to you then you can put it in to ${HOME}/.local/share/applications That directory may not exist by default, you may have to create it. Easiest way is

$ mkdir -p ${HOME}/.local/share/applications
Note that graphical file managers won't show .local by default because it's a hidden directory. They'll be an option on their menu somewhere to show hidden files and directories.
If you want an icon on your Desktop then put your .desktop file in to %{HOME}/Desktop

scottjsn
28-Jul-2012, 19:39
Great appreciation.