How to add desktop shortcut in KDE.

25 Aug

If you find this article helpful please follow the blog: https://rongsheng007.wordpress.com, and recommend it to your friends. Thx.

[NOTE:] This article is talking about how to add a shortcut of a batch file or shell script. If you want to add a shortcut of a file, simply right-click and “Add to desktop”.

I’ve been confusing about how to create a shortcut for a long time, yet finally figure out a way. Beside this, I go deep to the shortcut file, and work out an another complicated way~ Let’s see how to do.

1. My application need to run in a root privilege.  (skip this if your application don’t need to)

In KDE, you need to add kdesu before the command which you wish to run. (in GNOME use gksu instead)

2. What’s Now?

Right click the Application Launcher.(Left-bottom, blue button), and select Menu Editor, now you can see a KDE Menu Editor dialog. Click the New Item on the toolbar, type the name and click OK. On the right side of the Menu Editor, type the command into it or use the small button on the right to locate the application. After these all, click Save on the toolbar. Then you can drag the item into the category you want, and then click Save.

3. How can I put it into desktop?

Right click the item in the Application Lanucher, then click Add to Desktop. We are done!

3. My shortcut points to a shell script or batch file that doesn’t have an icon, can I add one?

Yes, to do so move the cursor to the icon and wait until a vertical bar shows, click on the icon that looks like a screwdriver. Now you can see a Icon Setting Dialog. Click the screwdriver icon on the General tab. You can see a KEditFileType dialog. Now click the icon itself, a Select Icon dialog will show up, choose the icon you want and click OK, everything is done.

4. Can I change the icon directly from the menu?

Yes. But it is not that easy to find for the first time…Click the “CLICK HERE” part showed in the following picture…

5. What is a shortcut?

A .desktop file actually. When you use Dolphin file manager and you type applications:/ in the address bar, you can see all the applications listed in the manager. When you right click on the blank place, and select Create New -> Link to Application, you find it the same with what you were doing. But still, what it is? If you right click a shortcut and choose Open with -> Kate, you will find it is a readable ascii text file, just like this:

It is actually true that we can simply write a file like this and save it. As long as the extension of the file is not engaged by other program(say if you save it to a.txt, it will be open by kate, you save it to a.jpg, it will be open by gview). Here we save it to a.desktop(you can save it to a.hello, a.bye as well). We see a exclamation mark on the icon, when you click it, the system will pop-up a dialog and says “This will start a program”, click yes. WOW, you now create a shortcut by your own. Isn’t it amazing?

Anyway, you cannot write files or add link to applicaiton in application:/, even if you are the root. Okay, this is the end of the tutorial, Thx.

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: