22

How can I create a shortcut for URL in my desktop? I want to use them in Firefox or Chrome.

If a copy and paste didn't work.

What script I have to use?

30

In Ubuntu an URL shortcut is stored in a .desktop file as follow (for example):

[Desktop Entry]
Encoding=UTF-8
Name=Link to Ask Ubuntu
Type=Link
URL=http://www.askubuntu.com/
Icon=text-html

You can drag links from Firefox or Chrome and drop them on the Desktop or any other folder where you have permissions to save files.

Note: Link will appear on your Desktop or your file explorer (i.e. caja) under the name in the line Name=…, not by its actual filename. And without any ….desktop extension.

  • Ok, I did this vitor@vitor-HP:~$ vim atalho [Desktop Entry] Encoding=UTF-8 Name=Link to Ask Ubuntu Type=Link URL=askubuntu.com Icon=text-html But didn't appear in my Desktop. – Vitor Mazuco Oct 15 '13 at 18:16
  • 2
    @VitorMazuco You should save that file on your desktop. The file must to have the extension .desktop. See UnityLaunchersAndDesktopFiles. – Radu Rădeanu Oct 15 '13 at 18:42
  • I create vim atalho.desktop but nothing appear in my desktop. – Vitor Mazuco Oct 15 '13 at 19:01
  • 2
    @VitorMazuco How to appear on your desktop if you didn't saved there. You must to save it in your ~/Desktop directory. – Radu Rădeanu Oct 15 '13 at 19:15
  • 1
    In case drag & drop doesn't work, creating a text file with the example contents & saving it as <something>.desktop & making it executable should work – Xen2050 Mar 13 '17 at 14:38
4

Try this. Install Gnome Panel, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo apt-get install gnome-panel

Once installed type this:

gnome-desktop-item-edit --create-new ~/path/to/shortcut

(location of shortcut). In the example below, I will create a shortcut for Ubuntu.com and place it inside the Documents folder. Once I hit Enter a window will open with the properties. See images below.

gnome-desktop-item-edit --create-new ~/Documents

enter image description here

enter image description here

Once done, just click on them newly created shortcut.

  • why all this desktop shortcuts send me to google? – Arturo Mar 7 '15 at 20:54
1

Add this to your ~/.bashrc:-

function createUrlShortcut {
    if [ "$#" -ne 3 ]; then
        echo "Illegal number of parameters. Usage : createUrlShortcut Name Url FileBaseName"
    fi
    printf "[Desktop Entry]\nEncoding=UTF-8\nName=$1\nType=Link\nURL=$2\nIcon=text-html" > $3.Desktop
}

To create a shortcut, do as follows:-

createUrlShortcut RGB-Dataset https://vision.in.tum.de/data/datasets/rgbd-dataset/download RGBD-Dataset-Link

The first argument is the name you want to be displayed in nautilus.
The second argument is the url.
The third argument is the actual name of the file which will be appended by .Desktop extension.

Note that this will create a file with name RGBD-Dataset-Link.Desktop but will be displayed as RGB-Dataset in nautilus.

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.