You are not logged in.
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
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
Could it be an xdg-open issue?
To know or not to know ...
... the questions remain forever.
Offline
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
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
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 11:55:23)
Offline
Works a treat, thanks.
Offline
Great thanks mateusz.f i've been able to fix this issue without using a DE simply using a Wm
Offline
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
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
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 .
Offline
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
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 21:13:30)
Weaseling out of things is important to learn. It's what separates us from the animals... except the weasel.
Offline
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'"
;;
esacNow I can use systemsettings KDE control panel to set my file associations and everything works fine.
There's an easier way, add
export DE=INSERT_DE_HERE
in ~/.bashrc and ~/.xinitrc
Offline
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 ).
Offline
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
@yiuin - thank you for that solution
Offline
Another confirmation-- perl-file-mimeinfo is all that is needed for this.
Offline
Getting perl-file-mimeinfo doesn't do anything. I used mimeinfo -a <file> to set the association of different file types that I usually open (like pdf's) and then I tried opening something with Chromium and it still opened firefox which then started the program. Since the file was ALREADY associated to use a certain program which is what firefox would use to open, changing it did absolutely nothing. Why can't Chromium just have its OWN list of how to open things. Everytime I click the pdf link it asks to save rather than just automatically opening it like firefox did. I like chromium better for a lot of other reasons, but this file opening stuff is really annoying me.
How is perl-file-mimeinfo supposed to work with Chromium?
Well for generic_open I just put pcmanfm %url% and that seems to work
Last edited by SiegeMachine (2010-02-11 18:37:51)
Offline
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'"
;;
esacNow I can use systemsettings KDE control panel to set my file associations and everything works fine.
Hey thanks so much.
It works perfectly well.
I am using xfce so i just replaced kde with xfce.
Offline
I'm using XFCE 4.8.0, and have same problem with default "xdg-open" implementation, but recently I've solved it.
File "/usr/bin/xdg-open" has some old lines for detecting XFCE session. Detection is done by:
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
However, it doesn't work, so change it to:
elif [ x"$DESKTOP_SESSION" == x"xfce" ]; then DE=xfce;
Now everything works as expected.
Offline
I'm using XFCE 4.8.0, and have same problem with default "xdg-open" implementation, but recently I've solved it.
File "/usr/bin/xdg-open" has some old lines for detecting XFCE session. Detection is done by:
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
However, it doesn't work, so change it to:
elif [ x"$DESKTOP_SESSION" == x"xfce" ]; then DE=xfce;
Now everything works as expected.
Excelent, great solution.
Offline
I've been having this issue, read through these posts, and then hunted around myself.
I think I have something quite a bit easier than fiddling with the xdg-open and xdg-mime binaries. Plus, do those changes survive an update when those files are replaced?
I found THIS which contains this suggestion (it's the second answer):
Instead of editing defaults.list, I find it easier to use the xdg-mime program. Looking up the pdf viewer, seeing its adobe, and switching it to KPDF:
$xdg-mime query default application/pdf
AdobeReader.desktop
$xdg-mime default kde-kpdf.desktop application/pdf
$xdg-mime query default application/pdf
kde-kpdf.desktopAnd you can use xdg-open to open a file with your preferred application:
$xdg-open file.pdf
Maybe this is what yiuin was suggesting above, but I didn't even need perl-mimeinfo to carry it out. I've been having the issue with pdfs, so I just tried this:
$ xdg-mime query default application/pdf (nothing there)
$ locate evince.desktop (make sure it's there)
$ xdg-mime default evince.desktop application/pdf
Then I went and clicked on a downloaded pdf in chromium and it opened in evince -- yay! You can also try ahead of time by doing:
$ xdg-open /path/to/file
If that opens in the right program, it will in chromium as well.
If you don't have the 'application.desktop' file... just make one.[1] Just for kicks, I looked at the one for evince and made this:
$ cat /usr/share/applications/zathura.desktop
[Desktop Entry]
Name=zathura
TryExec=zathura
Exec=zathura %f
StartupNotify=true
Terminal=false
Type=Application
Icon=zathura
NoDisplay=true
MimeType=application/pdf;
Then:
$ xdg-mime default zathura.desktop application/pdf
$ xdg-open Downloads/file.pdf
and I'm looking at my file in zathura now! It appears that doing this also changes it for pcmanfm as well. However it would seem that setting it this way controls chrom[e/ium] and pcmanfm... but setting it only in pcmanfm (or thunar) via right clicking and adjusting the default app in properties does not have said effect.
Hopefully this is helpful. It's worked for me and I feel much better about having solved it in what I think is a more robust manner. In fact, as I typed that I searched again and fount THIS and sure enough:
$ cat ~/.local/share/applications/defaults.list
[Default Applications]
application/pdf=zathura.desktop
To me, that confirms that even when the xdg-utils package is updated, my local settings will be honored. For the above fix, I would assume you'd have to make these tweaks whenever an xdg-utils update comes through.
Edit: I use openbox, but I'm hoping this works cross-DE/WM. That would spare people having to make DE/WM-specific change and give us a universal solution.
Edit2: Wow... just perused Arch wiki to see if I found anything on this and whattya know, it's already there (LINK). It says:
Then, you basically have to fill the ~/.local/share/applications/defaults.list file with default associations. As this can be painful, some utilities are available:
xdg-mime: not that intuitive; e.g. to use xpdf as default pdf viewer:$ xdg-mime default xpdf.desktop application/pdf
So... have others tried this and it just didn't work? Maybe since it's in the section on not having a DE, it's only working for me on openbox but not the rest of you if you're using something else?
[1] For the application.desktop file, see the xdg-desktop-menu page.
Last edited by jwhendy (2011-03-11 19:53:23)
Offline
@mtasic85
perfect solution! I can second that this works. I am also on XFCE4.8 and was having issues with chromium (and other apps) not functioning correctly due to 'xdg-open' issues.
Offline
Have those trying the route of modifying xdg-open tried to diagnose what xdg-mime is currently pointing at? For example, have you looked at the output of:
$ xdg-mime query default application/pdf
or whatever type of document you want opened with a particular program? I guess if the solutions work, they work... but reading through this thread has made me wary of changing the actual executable files since they will probably be replaced by any upgrades that come through. Just curious if others have tried the solution I posted. It seems like that route (which I found elsewhere) uses the tools that are there to do what they're for, and also will survive an upgrade.
Offline
I'm using XFCE 4.8.0, and have same problem with default "xdg-open" implementation, but recently I've solved it.
File "/usr/bin/xdg-open" has some old lines for detecting XFCE session. Detection is done by:
elif xprop -root _DT_SAVE_MODE 2> /dev/null | grep ' = \"xfce4\"$' >/dev/null 2>&1; then DE=xfce;
However, it doesn't work, so change it to:
elif [ x"$DESKTOP_SESSION" == x"xfce" ]; then DE=xfce;
Now everything works as expected.
Great solution !!!! Thanks a lot.
Offline