LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 03-02-2011, 07:40 PM   #1
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Rep: Reputation: 50
How to drag and drop URL link onto launcher


I am soewhat new to Gnome launchers. I want to create a launcher that receives a URL link dragged from Firefox and dropped onto it.

The executeable is a perl program that takes a URL as an argument. For example:

Code:
getvid http://a.url.net
Here is my launcher:
Code:
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Icon[en_US]=gnome-panel-launcher
Exec=getvid %u
Name[en_US]=GetVid
Name=GetVid
Icon=gnome-panel-launcher
I have tried every argument parameter from %f through %k, but every time I drop a URL directly from the browser onto the launcher, the executeable is never launched. If I first drop the URL onto the Desktop to create a Link, then drop the Link, it receives a Link .desktop file name, instead of the URL inside the desktop link.

Is there anyway to make gnome pass the URL, instead of the desktop file name?

Last edited by pwalden; 03-02-2011 at 07:54 PM.
 
Old 03-02-2011, 08:40 PM   #2
PenGUiN_6_1
Member
 
Registered: Oct 2006
Location: Brunswick, MD
Distribution: gNewSense 2.3 (deltah) i386
Posts: 57

Rep: Reputation: 22
Does '%s' work? Just curious
 
Old 03-03-2011, 09:25 AM   #3
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
No, %s did not work either. The behavior is the same. A direct drop from the browser never launches the executeable. The drop of the Link substitutes the path to the Links .desktop file.
 
Old 03-03-2011, 01:23 PM   #4
PenGUiN_6_1
Member
 
Registered: Oct 2006
Location: Brunswick, MD
Distribution: gNewSense 2.3 (deltah) i386
Posts: 57

Rep: Reputation: 22
What if you try to run it in shell? Then it might be along the lines of what I was dealing with, trying to run 'su'. For instance, the Exec might read
Code:
Exec=gnome-terminal|xterm -e 'getvid $1'
or whatever. Then, it may open up. Also, if done that way, it might be a $1 you have to use, since getvid may be $0, the arg...the URL...may be $1; again, this is just advice. Read the man and info pages; they may help a GREAT deal with figuring this out
 
Old 03-03-2011, 01:25 PM   #5
PenGUiN_6_1
Member
 
Registered: Oct 2006
Location: Brunswick, MD
Distribution: gNewSense 2.3 (deltah) i386
Posts: 57

Rep: Reputation: 22
The | in the last post...
Code:
gnome-terminal|xterm
...is meant to be 'one OR the other' and not 'one PIPED TO the other'
 
Old 03-03-2011, 02:02 PM   #6
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Where are you putting the launcher? What you're trying to do works for me if the launcher is in the GNOME Panel, but not if the launcher is on the Desktop. Don't know why that is.


The use of 'Terminal=true' isn't required.

I created this on the Desktop, then dragged it on the Panel.
Code:
[Desktop Entry]
Version=1.0
Type=Application
Exec=dofoo %u
Name[en_US]=GetVid
Name=GetVid
Icon=gnome-panel-launcher

Code:
#!/bin/bash
#dofoo
outfile="/tmp/$(basename $0)_out"
>$outfile
echo "hey I ran" >>$outfile
echo "$1" >> $outfile
 
Old 03-03-2011, 08:04 PM   #7
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
Maybe it is platform specific? I use Fedora 14. I tried moving the launcher to the panel and also setting Terminal=false.

When the launcher is on the panel, the app gets launched when the Link is dropped directly from the browser, but none of the %k, %f or %u parameters are filled in.

I did notice one strange blip. In one of my adjustments, the %u did contain a URL. However, it was never repeated. Maybe there is a cache that needs to be cleared?

I also tried setting mimetypes to accept text/html. Again no luck.
 
Old 03-04-2011, 07:54 AM   #8
arizonagroovejet
Senior Member
 
Registered: Jun 2005
Location: England
Distribution: openSUSE, Fedora, CentOS
Posts: 1,094

Rep: Reputation: 198Reputation: 198
Curious. I tried using Ubuntu 10.10 which has GNOME 2.32.

Last edited by arizonagroovejet; 03-04-2011 at 07:54 AM. Reason: Ubuntu 10.01 doesn't exist
 
Old 03-06-2011, 04:23 PM   #9
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
Another update on this problem.

I have Gnome 2.32 on Fedora 14.

I have confirmed that link the drop from firefox works sometimes. It is really flakey. Sometimes it works if it is the first drop made. Sometimes it will work multiple times then stop and then start again. I cannot find a consistent pattern. %u is expanded to contain the URL of the link that is dropped.

If I drop the link on the Desktop, it creates a Type=Link desktop file. If I drag and drop this link entry onto the launcher, %u is expanded to the path to the link desktop file. The URL key in the link desktop is not used for the substitution.

Last edited by pwalden; 03-06-2011 at 04:42 PM.
 
Old 03-09-2011, 01:56 PM   #10
pwalden
Member
 
Registered: Jun 2003
Location: Washington
Distribution: Raspbian, Ubuntu, Chrome/Crouton
Posts: 374

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by arizonagroovejet View Post
Where are you putting the launcher? What you're trying to do works for me if the launcher is in the GNOME Panel, but not if the launcher is on the Desktop. Don't know why that is.


The use of 'Terminal=true' isn't required.

I created this on the Desktop, then dragged it on the Panel.
So your clue has solved my problem, but created a newer smaller one.

Yes, if I create a launcher directly on a panel, the drop from the browser works every time. The problem I had previously was that dragging the launcher from the Desktop to the panel seems to affect the setting of the %u parameter. If I do the following it works every time:
  1. right-click on a panel -> Add to Panel...
  2. select Custom Application Launcher
  3. click on ADD
  4. set Type, Name, Command = "command %u", Comment, click OK

So it is now working solidly.

However, I was using the Path= key in the desktop file to preset the working directory for the Exec= script. This key does not seem to work in the panel launcher. I added the key by editing the launcher file in the $HOME/.gnome2/panel2.d/default/launchers directory. No matter what I set the Path= to, the command is launched with the working directory set to my home directory.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help in Qt3.3 drag and drop MiniGopal Programming 1 02-25-2009 08:20 AM
X locks up when drop and drag builder1 Linux - Desktop 1 12-07-2008 10:44 AM
Drag and Drop PapillonRus Linux - General 1 08-11-2008 09:44 AM
drag and drop seaking Linux - Desktop 0 05-25-2007 12:05 PM
drag and drop poeta_boy Programming 4 11-23-2006 08:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration