Discussion forums for Arch Linux, a simple, lightweight linux distribution.
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?
Online
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 07: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
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
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)
Offline
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
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