LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-16-2004, 05:20 PM   #1
servo_fan
LQ Newbie
 
Registered: Nov 2003
Location: Sacramento, CA
Distribution: SuSE 9.1
Posts: 25

Rep: Reputation: 15
Changed html file assoc. in KDE, but have issues (Firefox Profiles)


I've changed the html association in KDE, (3.1.4 in SuSE 9), to open Firefox, (firefox is installed in my home directory). If I click on an html file in Konquerer it starts Firefox and displays the html page. However, if Firefox is still open and I click on another html file in Konquerer, Firefox tries to open another instance of itself and it prompts me for a profile to use. If I choose my default profile, it errors, saying it is already in use.

Does anyone know of a way to prevent this from happening? Thanks.

Last edited by servo_fan; 03-17-2004 at 01:36 PM.
 
Old 03-17-2004, 01:15 PM   #2
servo_fan
LQ Newbie
 
Registered: Nov 2003
Location: Sacramento, CA
Distribution: SuSE 9.1
Posts: 25

Original Poster
Rep: Reputation: 15
I've narrowed it down a bit, it has something to do with adding a -remote switch to the firefox command, (http://www.mozilla.org/unix/remote.html).

When I click on an html file I can now get Firefox to open a new window or tab, but it does not display the file I've clicked on, it just opens a blank window, (or tab).

So part of the problem is solved. I would appreciate any insight into the remaining problem. Thanks.
 
Old 03-17-2004, 01:36 PM   #3
servo_fan
LQ Newbie
 
Registered: Nov 2003
Location: Sacramento, CA
Distribution: SuSE 9.1
Posts: 25

Original Poster
Rep: Reputation: 15
Changed html file assoc. in KDE, but have an issue (Firefox profiles)

I found this in a newsgroup. The person who posted it could not site the original post or author. Here it is and it works well.

Quote:
I think your problem is that you're running mozilla-bin twice or more
and you need your apps to send their browser request to mozilla.sh. The
mozilla.sh is a dumb little script that says "open an instance of
mozilla-bin if one is not running, otherwise open a new window (or tab)"

Here's what my script looks like, it's for firefox, but you'll get the
concept:
#!/bin/sh
MOZILLA="/usr/bin/mozilla-firefox"
if $MOZILLA -remote "ping()" 2>/dev/null
then
echo "Mozilla already launch"
location=",new-tab"
exec $MOZILLA -remote "openURL($1$location)"
else
exec $MOZILLA "$@"
fi
exit 1

you could copy this, change the appropriate names and locations, save as
mozilla-remote in the /usr/bin directory (make it executable ). and
then tell KDE or whatever environment you're using to use
"mozilla-remote.sh" as your default browser.
 
Old 03-26-2004, 07:36 PM   #4
questone
LQ Newbie
 
Registered: Mar 2004
Location: Oshkosh, WI U.S.A.
Distribution: Mandrake 10.0
Posts: 17

Rep: Reputation: 0
servo_fan,

I ran the script that you posted above. And a couple aproblems still there.
1. If I don't have Firefox open and I am in my mail and click a url then FIrefox doesn't open.
2. If Firefox is open and I click a url in my mail then Firefox opens a new tab but not the url.

Thanks for the script. Any suggestion?

Last edited by questone; 03-26-2004 at 07:38 PM.
 
Old 03-26-2004, 11:25 PM   #5
servo_fan
LQ Newbie
 
Registered: Nov 2003
Location: Sacramento, CA
Distribution: SuSE 9.1
Posts: 25

Original Poster
Rep: Reputation: 15
I assume that you've already changed the html association in KDE or whatever to use this script, correct? And did you change the path locations to match where you have Firefox installed and make it executable? I did not have any issues with the script myself.

Actually, the only way I've tested it is by clicking on a .html file from my local file system, I have not tested the script by clicking on an url from an email - although in theory I think it should work.

Let me know how it goes.
 
Old 03-26-2004, 11:53 PM   #6
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 32
Here's a slightly different variation that works by getting the process id:

#! /bin/sh

# find pid of running moz, if any, for current user
PID=`ps -ef | grep $USER | grep firefox-bin |\
grep -v "grep" | awk '{print $2}'`

# if moz is not running, start normally
if [ $PID="" ]; then
/path/to/firefox $1;

# otherwise, open url in a new window
else
/path/to/firefox -remote "openurl($1,new-tab)";
fi
 
Old 03-27-2004, 11:27 AM   #7
questone
LQ Newbie
 
Registered: Mar 2004
Location: Oshkosh, WI U.S.A.
Distribution: Mandrake 10.0
Posts: 17

Rep: Reputation: 0
Ok now Im getting a little closer. The first scrip would open a new tab but not open fire fox if it was not already open. The second would open firefox if it was not open but wouldn't open a new tab. So I combined them like this:

-----------------------------------------------------------------------------------
#!/bin/sh

MOZILLA="/home/steve/.firefox/firefox"

# find pid of running moz, if any, for current user
PID=`ps -ef | grep $USER | grep firefox-bin |\
grep -v "grep" | awk '{print $2}'`

# if moz is not running, start normally
if [ $PID="" ]; then
/home/steve/.firefox/firefox $1;
fi

if $MOZILLA -remote "ping()" 2>/dev/null
then
echo "Mozilla already launch"
location=",new-tab"
exec $MOZILLA -remote "openURL($1$location)"
else
exec $MOZILLA "$@"
fi
exit 1
---------------------------------------------------------------------------------------
With this script if I click a url in my mail it will open fire fox if not already running and if it is running it opens a new tab. However the url location doesn't open in either instance. If fie fox is not running then I go to my home page and if it is I get a blank tab. I'll keep playing with it but I assume that the line:
exec $MOZILLA -remote "openURL($1$location)"
supposed to do this. But Im not sure as I really have no Idea what Im doing. Just trial and error. I edit the script save and click a url and see what happens. Thanks for any direction.

questone
 
Old 03-27-2004, 06:08 PM   #8
Kovacs
Member
 
Registered: Jul 2003
Distribution: FreeBSD 8.2 RELEASE
Posts: 607

Rep: Reputation: 32
Um the one I posted should be opening things in a new tab always, you have to select "always show tabs even if only one document is open" in the firefox options.
 
Old 03-27-2004, 07:42 PM   #9
vi0lat0r
Member
 
Registered: Aug 2003
Location: Lewisville, TX
Distribution: Kubuntu
Posts: 295

Rep: Reputation: 30
How about you set the file extension to:

soundwrapper /usr/bin/mozffremote

That works perfect here. :-)
 
Old 04-03-2004, 09:00 PM   #10
fbs95842
LQ Newbie
 
Registered: Apr 2004
Posts: 1

Rep: Reputation: 0
Quote:
Originally posted by Kovacs
Um the one I posted should be opening things in a new tab always, you have to select "always show tabs even if only one document is open" in the firefox options.
Kovacs' solution worked perfectly for me. Thank you.
 
Old 04-06-2004, 08:32 PM   #11
questone
LQ Newbie
 
Registered: Mar 2004
Location: Oshkosh, WI U.S.A.
Distribution: Mandrake 10.0
Posts: 17

Rep: Reputation: 0
This script does work as it is said to work here. ie: if I have a link on my desktop that I double click it opens in firefox as intented, but still doesn't wotk from Thunderbird when I click on a link in my e-mail. I really don't have any links on my desktop so... I don't know what I need to add to the script to get it to, umm? "export" the link that I am clicking on to firefox. Clicking on the link in TB does open a new tab or the browser respectively but firefox seems to have no Idea at that point where I need to go. The odd thing is in my RSS client if I click on a link to a torrent file (I have a helper app setup in FF to open .tor files) a new tab opens in FF and my helper app opens and and starts running witht the .tor file. So I take this to meant that the url is being seen by FF but for some reason it is not opening in the tab. I am so lost. I know where I want to go I can see the destination from where I stand , but I don't seem to be able to drive very well I need some instruction.
Thanks
quest
 
Old 05-05-2004, 10:21 PM   #12
allofitsik
LQ Newbie
 
Registered: Sep 2003
Posts: 15

Rep: Reputation: 0
Sorry for dragging up an old thread. I used the above script to be able to open links in already open browser in Gnome. however, the problem i have encountered, while not serious as this setup is only one of many for me, is that if firefox is open on a different screen than on the one that i click the link on. I assume that it would work if i were using Xinerama, however, xinerama screws with matlab.
if there is a way to get it to work, it would be much appreciated...

-ta.
 
  


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
KDE File assoc. sorted (Suse9) flippantfig LinuxQuestions.org Member Success Stories 1 05-16-2005 10:47 PM
Where are the app assoc files for KDE? hari_seldon99 Linux - Newbie 3 06-20-2004 04:49 PM
suse 9 + kde3.2 = file assoc. trouble Corkscrew Linux - Software 0 02-15-2004 10:10 PM
KDE File Association Issues Eultza Linux - Newbie 7 12-16-2003 03:51 PM
Konqueror + file:/usr/share/doc/HTML/index.html jon_k Linux - Software 2 11-25-2003 05:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:06 AM.

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