Arch Linux Forums

Discussion forums for Arch Linux, a simple, lightweight linux distribution.

You are not logged in.

#1 2009-09-30 17:55:17

MrGone
Member
Registered: 2009-09-30
Posts: 14

Chromium opens everything to do with downloads in Firefox.

I installed chromium-snapshot-64 from aur with yaourt and it is mostly working, decided to switch as flash keeps crashing and thought the multi-thread architecture would save me from restarting all of my windows everytime. However, every time i download a torrent and click open it starts firefox which handles the file rather than actually opening it. Is there anyway to change this or should i expect that it should be different in one of the other builds?

Anyone else got the same?

Offline

 

#2 2009-09-30 18:31:51

area
Member
Registered: 2008-09-18
Posts: 40

Re: Chromium opens everything to do with downloads in Firefox.

Same issue here. I've tried a few different versions from AUR and it seems to be universal. I've looked through the preferences (not very hard) to find an option for this with no luck. I'm sure if it's not there yet, it will be someday.

Offline

 

#3 2009-09-30 19:08:25

bernarcher
Member
From: Germany
Registered: 2009-02-17
Posts: 649

Re: Chromium opens everything to do with downloads in Firefox.

Could it be an xdg-open issue?


To know or not to know ...
... the questions remain forever.

Online

 

#4 2009-09-30 20:38:36

RobbeR49
Member
From: Columbus, OH
Registered: 2006-01-17
Posts: 159
Website

Re: Chromium opens everything to do with downloads in Firefox.

I discovered this with a mailto: link, not a torrent, but otherwise same thing here.

Maybe related: chromium also says it cannot find or make itself the default browser - I am guessing it hooks into the gnome or xfce settings for this? So if you're not running a DE I suppose you lose out on it.

Offline

 

#5 2009-10-01 05:58:17

MrGone
Member
Registered: 2009-09-30
Posts: 14

Re: Chromium opens everything to do with downloads in Firefox.

bernarcher: I had a look at xdg-open but

xdg-mime query default application/x-bittorrent

returns nothing so i'm assuming it's associated elsewhere, it seems to be recognised by nautilus so maybe it's a gnome thing.

RobbeR49: Hmmm, yeah i use enlightenment, i'll try setting it as my default in gnome, if possible, and see if this changes the situation.

Thanks.

Offline

 

#6 2009-10-13 07:54:43

mateusz.f
Member
Registered: 2009-04-17
Posts: 34

Re: Chromium opens everything to do with downloads in Firefox.

I had the same problem, but now I fixed it. Everything works great now!

Chromium opens everything using xdg-open command. You can try to open a file from shell using xdg-open. It's default behaviour is to check what DE are you using by inspecting enviromental variable. If it doesn't find KDE, Gnome, or XFCE then it tries to open that file using your browser. Browsers are tried by names, if one of the default ones is found, then it is used to run this file.

In case that DE is found, xdg-open uses kde-open, gnome-open or exo-open. I don't like that behaviour, I'm using ION3 window manager, thus all my files are being open by firefox. I also don't want to set some strange environment variables. Fortunately xdg-open is a simple ~400 lines shell script. I simply hardcoded my chosen files launcher. I entered kde-open, but one could even write his own launcher detecting file type by name or content. In my case the change was something like:

sudo vi /usr/bin/xdg-open

few lines before end I changed the following code:

case "$DE" in
    kde)
    open_kde "$url"
    ;;

    gnome)
    open_gnome "$url"
    ;;

    xfce)
    open_xfce "$url"
    ;;

    generic)
#    open_generic "$url"      # commented this line
     open_kde "$url"             # added this line
    ;;

    *)
    exit_failure_operation_impossible "no method available for opening '$url'"
    ;;
esac


Now I can use systemsettings KDE control panel to set my file associations and everything works fine.

Last edited by mateusz.f (2009-10-13 07:55:23)

Offline

 

#7 2009-10-13 18:30:54

MrGone
Member
Registered: 2009-09-30
Posts: 14

Re: Chromium opens everything to do with downloads in Firefox.

Works a treat, thanks.

Offline

 

#8 2009-10-26 09:07:50

toketin
Member
From: Belluno
Registered: 2007-04-17
Posts: 159
Website

Re: Chromium opens everything to do with downloads in Firefox.

Great thanks mateusz.f i've been able to fix this issue without using a DE simply using a Wm big_smile

Offline

 

#9 2009-11-27 14:53:29

PiousMinion
Member
Registered: 2009-07-21
Posts: 8

Re: Chromium opens everything to do with downloads in Firefox.

I found a better way.  I patched /usr/bin/xdg-open to not need any DE specific stuff.
It still supports DEs and their settings, but falls back to saner defaults.

xdg-mime is used to query and set default apps for mime-types.  Why xdg-open doesn't use this by default is simply retarded.

If you aren't running a DE, this patch calls xdg-mime to determine the mime type of the file you want to open. It calls xdg-mime a second time to see if there is a *.desktop file associated with that type. If there is it greps out the "Exec" line in the file to run the program with the file as an argument.  If there is no *.desktop file associated with the type it reverts back to the old method of running it with firefox.  It's that simple.

To change what application is associated with a certain mime type you run(not as root):
xdg-mime default some-app.desktop mime/type
e.g.
xdg-mime default deluge.desktop application/x-bittorrent

Available .desktop files are in /usr/share/applications

Code:

363,387c363,371
<     TYPE=`xdg-mime query filetype "$1" | cut -d\; -f1`;
<     XDGAPPFILE=`xdg-mime query default $TYPE`;
<     if [ ! -z $XDGAPPFILE ]; then
<         XDGAPP=`cat /usr/share/applications/$XDGAPPFILE | grep -i exec | cut -d= -f2`;
<         $XDGAPP "$1";
<         if [ $? -eq 0 ]; then
<             exit_success
<         else
<             exit_failure_operation_failed
<         fi
<     else
<         IFS=":"
<         for browser in $BROWSER; do
<             if [ x"$browser" != x"" ]; then
< 
<                 browser_with_arg=`echo "$browser" | sed s#%s#"$1"#`
< 
<                 if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
<                 else $browser_with_arg;
<                 fi
< 
<                 if [ $? -eq 0 ]; then exit_success;
<                 fi
<             fi
<         done
---
>     IFS=":"
>     for browser in $BROWSER; do
>         if [ x"$browser" != x"" ]; then
> 
>             browser_with_arg=`echo "$browser" | sed s#%s#"$1"#`
> 
>             if [ x"$browser_with_arg" = x"$browser" ]; then "$browser" "$1";
>             else $browser_with_arg;
>             fi
389,390c373,378
<         exit_failure_operation_impossible "no method available for opening '$1'"
<     fi
---
>             if [ $? -eq 0 ]; then exit_success;
>             fi
>         fi
>     done
> 
>     exit_failure_operation_impossible "no method available for opening '$1'"

If anyone can improve upon this code please let me know.
If not I'll submit it upstream to FreeDesktop.org in a few days.

Offline

 

#10 2009-11-27 15:10:17

mateusz.f
Member
Registered: 2009-04-17
Posts: 34

Re: Chromium opens everything to do with downloads in Firefox.

I don't understand what are you saying, so I just assume you are right ^^.
For my simplistic needs my way is enough.
Still - unpatched way to do the thing I want to do using mime types would be great too smile.

Offline

 

#11 2009-11-27 15:49:20

PiousMinion
Member
Registered: 2009-07-21
Posts: 8

Re: Chromium opens everything to do with downloads in Firefox.

mateusz.f wrote:

I don't understand what are you saying, so I just assume you are right ^^.
For my simplistic needs my way is enough.
Still - unpatched way to do the thing I want to do using mime types would be great too :).

It's all pretty simple.

The functionality was all there, I just implemented it. As xdg-open and xdg-mime are from the same project, I fail to understand why this wasn't already the default functionality.

If this patch is approved, you may simply see this in the next update and won't need to patch anything yourself.
That's what I'm hoping anyway.  Maybe they can even improve upon it.

Offline

 

#12 2009-11-27 16:04:18

fini_fly
Member
From: Mississauga
Registered: 2009-11-20
Posts: 16
Website

Re: Chromium opens everything to do with downloads in Firefox.

This also helped with opening URL's from Kmail in a new tab in chromium.

EDIT: Only links that end with .htm(l)

Last edited by fini_fly (2009-11-27 16:13:30)


Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel.

Offline

 

#13 2009-11-27 16:17:11

some-guy94
Member
Registered: 2009-08-15
Posts: 165

Re: Chromium opens everything to do with downloads in Firefox.

mateusz.f wrote:

I had the same problem, but now I fixed it. Everything works great now!

Chromium opens everything using xdg-open command. You can try to open a file from shell using xdg-open. It's default behaviour is to check what DE are you using by inspecting enviromental variable. If it doesn't find KDE, Gnome, or XFCE then it tries to open that file using your browser. Browsers are tried by names, if one of the default ones is found, then it is used to run this file.

In case that DE is found, xdg-open uses kde-open, gnome-open or exo-open. I don't like that behaviour, I'm using ION3 window manager, thus all my files are being open by firefox. I also don't want to set some strange environment variables. Fortunately xdg-open is a simple ~400 lines shell script. I simply hardcoded my chosen files launcher. I entered kde-open, but one could even write his own launcher detecting file type by name or content. In my case the change was something like:

sudo vi /usr/bin/xdg-open

few lines before end I changed the following code:

case "$DE" in
    kde)
    open_kde "$url"
    ;;

    gnome)
    open_gnome "$url"
    ;;

    xfce)
    open_xfce "$url"
    ;;

    generic)
#    open_generic "$url"      # commented this line
     open_kde "$url"             # added this line
    ;;

    *)
    exit_failure_operation_impossible "no method available for opening '$url'"
    ;;
esac


Now I can use systemsettings KDE control panel to set my file associations and everything works fine.

There's an easier way, add

Code:

export DE=INSERT_DE_HERE

in ~/.bashrc and ~/.xinitrc

Offline

 

#14 2009-11-28 01:35:05

mateusz.f
Member
Registered: 2009-04-17
Posts: 34

Re: Chromium opens everything to do with downloads in Firefox.

That would be an easy way, but I didn't want to polute my environment variables namespace (sorry, I'm a programmer and it hurts my aestetics feelings wink ).

Offline

 

#15 2010-02-02 12:42:24

yiuin
Member
Registered: 2010-02-02
Posts: 1

Re: Chromium opens everything to do with downloads in Firefox.

The easiest solution is to install perl-file-mimeinfo for the utility mimeopen. Since xdg-open uses mimeopen for generic stuff,  after that I think it should work.

Offline

 

#16 2010-02-02 13:05:07

anonymous_user
Member
Registered: 2009-08-28
Posts: 314

Re: Chromium opens everything to do with downloads in Firefox.

@yiuin - thank you for that solution


My deviantART page

Rosscott’s Law: The faster the computer, the faster something will go wrong.

Offline

 

#17 2010-02-04 10:42:34

beretta
Member
Registered: 2008-04-21
Posts: 87

Re: Chromium opens everything to do with downloads in Firefox.

Another confirmation-- perl-file-mimeinfo is all that is needed for this.

Offline

 

Board footer

Powered by FluxBB