You are not logged in.
Pages: 1
What is the best XDG Opener? (Like rox, exo-open (XFCE), gnome-open, mimeopen, kioclient)
Right now I'm using "rox", but I don't like how it comes with a file manager. I'd like to be able to have a seperate file manager and xdg opener, so I can pick and choose easily. Also rox can't open urls.
Libertarian Arch Linux User
Offline
xdg-open ?
English is not my native language .
Offline
@Nezmer
'xdg-mime'. please install GPicView (Community Repository)
Open GPicView (duh!)
Click on 'Preferences'
Then you'll see a button says "Make GPicview the default viewer for images"
Click on it and then a message will appear:
GPicView will become the default viewer for all supported image files on your system.
(This will be done through 'xdg-mime' program)
Are you sure you really want to do this?
I think that matthewbauer meant to this sort of thing.
EDIT: never mind, forget what I just wrote =/
Last edited by RedArcher (2024-05-10 01:56:19)
Offline
Well xdg-open by itself is only a link to another mime opener (cat /usr/bin/xdg-open). You need to have another application do the mime handling.
Libertarian Arch Linux User
Offline
I just use this quick-n-dirty script. It queries xdg-mime for the correct application, except for the browser because xdg-mime doesn't seem to recognize web links. Although I haven't run into issues yet, the way it finds the executable is particularly hacky and doesn't respect any arguments in the Exec field of the .desktop file. But whatever, it works for me.
~ $ cat /usr/bin/xdg-open
#!/bin/bash
[ -z "$1" ] && exit 1
if echo "$1" | egrep -q "^(https?://|www.)"; then
google-chrome "$1" # or whatever browser you choose
exit
fi
desktop_file="$(xdg-mime query default $(xdg-mime query filetype "$1" | cut -d";" -f1))"
if [ -z "$desktop_file" ]; then
exit 1
fi
function get_exec ()
{
egrep "^Exec=" "$1" | cut -d"=" -f2 | sed -r "s:(%U|%f):$2:"
}
if [ -f "$HOME/.local/share/applications/$desktop_file" ]; then
$(get_exec "$HOME/.local/share/applications/$desktop_file" "$1")
elif [ -f "/usr/share/applications/$desktop_file" ]; then
$(get_exec "/usr/share/applications/$desktop_file" "$1")
else
exit 1
fi
Offline
xdg-open is the devil. Or maybe I don't understand it, because I can't make it use the right programs to open files. When I make it open folders with rox instead of firefox, any install will overwrite my changes. So I finally edited the xdg-open script to use rox for everything that is not http. I don't use Gnome, is there any gnome tool to configure xdg-open and the mime types?
Last edited by spupy (2009-11-16 14:46:34)
There are two types of people in this world - those who can count to 10 by using their fingers, and those who can count to 1023.
Offline
xdg-open is the devil. Or maybe I don't understand it, because I can't make it use the right programs to open files. When I make it open folders with rox instead of firefox, any install will overwrite my changes. So I finally edited the xdg-open script to use rox for everything that is not http. I don't use Gnome, is there any gnome tool to configure xdg-open and the mime types?
I use multiple DEs/WMs and the slim login manager. I found the best way to make sure xdg-open worked as I would like it to, was to add a little line in my ~/.xinitrc file:
export GNOME_DESKTOP_SESSION_ID="01" # fool xdg-open
By doing this I fool xdg-open to think I'm in gnome, and by doing so, programs like chromium-browser and others that use xdg-open, works good:-P
EDIT: Or better still! By adding one of the following lines to the top of .xinitrc (or to openbox autostart.sh):
export DE=kde
export DE=gnome
Last edited by smyrman (2009-11-20 18:16:40)
Offline
It seems that xdg-open will always use one's browser if one does not have a major DE (that is KDE, Gnome or XFCE). This is denoted generic in xdg-utils.
From the change log it seems that xdg-open would query mimeopen . This functionality is not present in xdg-open at the moment though. I might have something to do with this bug.
I found a nice patch that will make query mimeopen when using xdg-open.
The patch is located here.
Basically one just needs to change the open_generic() function in /usr/bin/xdg-open to:
open_generic()
{
if mimeopen -v 2>/dev/null 1>&2; then
mimeopen -n "$1"
if [ $? -eq 0 ]; then
exit_success
fi
fi
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
exit_failure_operation_impossible "no method available for opening '$1'"
}
It works well for me. I don't know why the removed this IMO essential feature. They mention something about protocols in the bug report. . . If somebody knows more please enlighten me.
--Rasmus
Arch x64 on Thinkpad X200s/W530
Offline
Because i'm using PCManFM (which handles all file types very well and starts the correct applications) my xdg-open file looks like this:
[ -z "$1" ] && exit 1
if echo "${1}" | egrep -q "^(https?://|www.)"; then
firefox "${1}" &
exit
fi
pcmanfm "${1}"
Offline
xdg-open is the devil. Or maybe I don't understand it, because I can't make it use the right programs to open files. When I make it open folders with rox instead of firefox, any install will overwrite my changes. So I finally edited the xdg-open script to use rox for everything that is not http. I don't use Gnome, is there any gnome tool to configure xdg-open and the mime types?
I made my own open-script, then I just force everything on my system to open files using that script. Simpler than messing around with 3-4 different regimes for opening goddamn files.
Offline
You mean something like mimeman
Mimeman can only be used to set associations but that inspired me to rip out some code from something else that I'd written to create Mimeo. It doesn't have URL support yet but that should be easy to add.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
It's been a while since this thread had any updates, but this problem was driving me *nuts* while using Chromium. There's a really, really easy fix in this thread: http://bbs.archlinux.org/viewtopic.php?id=89053. Installing the perl-file-mimeinfo package made everything work without any further configuration.
@Pank, apparently the bug stopping xdg-open from using mimeopen has been squashed.
Offline
Pages: 1