0

I'm really new to Ubuntu and Linux OS, and I have been digging around trying to find the answer to my question.

I want to have a shortcut to a specific URL address in the Unity taskbar (the menu bar to the left).

What I want it to be and how to work: I want to have the shortcut to µTorrent web-app using the URL, and I want it to open up in a new Firefox window. Pretty much how the YouTube application works.

Is this possible to do, and if so, can I have the µTorrent icon on my shortcut?

jkt123
  • 3,530
  • 22
  • 24

3 Answers3

3

I am not sure what the µTorrent web-app looks like, but to make an icon (desktop file) call a specific url you can create a desktop file, with an Exec= line, like:

firefox -new-window <url>

To do that:

  • Open the existing firefox.desktop file in /usr/share/applications with gedit (open gedit and drop the file on the gedit window)
  • Save the file as torrent.desktop in ~/.local/share/applications.
  • Remove al the lines below, and including Actions=NewWindow;NewPrivateWindow;

Change the following lines

  • The line starting with Name= replace with: Name=Utorrent, remove the other lines like Name[language]=
  • The line starting with Exec= replace with firefox -new-window <the _url_you_want>
  • The line starting with Icon= replace with Icon=/path/to/your/icon

Drag the new `torrent.desktop file on to the launcher and it will work.

A few remarks:

  • The window of the url you are calling with the starter will appear under the existing Firefox icon in the launcher.
  • As a general rule, I would prefer not to have multiple desktop files, calling the same application in their native command (the first 'Exec=` line of the file). The solution below is therefore a "cleaner" solution, and still makes the url available from the launcher:

Alternatively

You can add the torrent link to your existing firefox icon:

To do that:

  • Copy the existing firefox.desktop in /usr/share/applications to the local directory:

    `cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop`
    
  • Open the file with gedit (like in the first example)
  • Add the following to the end of the file:

    [Desktop Action utorrent]
    Name=utorrent
    Exec=firefox -new-window <url>
    OnlyShowIn=Unity;
    
  • Change the line (further above) starting with:

    Actions=NewWindow;NewPrivateWindow; 
    

    to:

    Actions=NewWindow;NewPrivateWindow;utorrent;
    

After log out and back in, the link will be added.

Jacob Vlijm
  • 83,767
1

Run:

gksudo gedit /usr/share/applications/<DESIRED NAME>.desktop

Add following lines to the resulting empty document :

[Desktop Entry]
Encoding=UTF-8
Name=<WHATEVER NAME>
Comment=<WHATEVER>
TryExec=firefox <URL>
Exec=firefox <URL>
StartupNotify=true
Terminal=false
Type=Application
Icon=<PATH TO A ICON .PNG FILE>
NoDisplay=false
MimeType=applications/php

Then in the dash you will able to find the icon which opens the firefox with your URL. Click on add to task bar. Then the icon eill appear in task bar.

** Put necessary things to the < >.

1

Hi & Welcome to Ask Ubuntu,

I'm very sure you'll get different types of answer and indeed this question made me to play with certain applications and bash scripts. Well, I had a quick go through and it seems working perfectly on my 12.04 LTS. Refer below steps

Add PPA, Update your system & install Ubuntu tweek

I do not know your OS version you're on but this should work without causing you any errors. Refer mroe on installing and understanding Ubuntu Tweak tool.

Open a terminal (CTRL+ALT+T) & do below;

sudo add-apt-repository ppa:tualatrix/ppa      # add apt repository for ubuntu tweak
sudo apt-get update                            # update the system before installing pkg
sudo apt-get install ubuntu-tweak              # install ubuntu tweak

One a related note, install the gnome-panel

sudo apt-get install gnome-panel               # installing gnome panel
sudo apt-get install -f                        # only run if any dependency problem raises

Preparing the bash script to open firefox & url

You may use your favorite editor on a terminal (vi or nano). In here, I've opened vi editor on terminal.

vi filname.sh               # if you have nano, then use "nano filename.sh"

Paste the script shown below;

#!/bin/bash

# Launch clean firefox profile with parameters:
# -no-remote    don't connect to any running instance of firefox
# -P        run firefox through a profile
# firefox -P 'Another Profile' &
sleep 4 # wait for firefox to load

# Open URLs
firefox -new-tab 'https://askubuntu.com/users'

and to save it hit Esc once then type :wq! which will write the script to the file and force quit. Make sure you replace the URL with your preferred one. You may refer more on customizing the script here. Once you've saved the script, give executable permission to it.

chmod +x filename.sh             # this will make the file executable

Important: note down the /path/to/the/filename.sh, which will be needed when creating the script shortcut.

Making the script work with Ubuntu Tweak & pin to Dash menu

  • Open the Ubuntu Tweak tool from the dash menu

enter image description here

  • Click on Admins tab -> click on Scripts

enter image description here

  • You'll see Create Launcher.. at the bottom of Disabled scripts (right column), and drag it to Enabled scripts (left column).

enter image description here

  • Afterwards, go to the location of where you've saved your filename.sh, -> right click -> Script -> Create launcher (which will give you below screen).

enter image description here

  • Fill in accordingly to fit your need (seen above) & make sure to select the filename.sh file by browsing and finish it with Ok. There'll be a shortcut created on the same location where your script file located. Simply drag it and put it into the dash panel.

enter image description here

Hope this helps! :)

AzkerM
  • 10,270
  • 6
  • 32
  • 51