Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #161721 > unrolled thread
| Started by | Eduard Bloch <edi@gmx.de> |
|---|---|
| First post | 2015-12-13 10:30 +0100 |
| Last post | 2015-12-15 17:20 +0100 |
| Articles | 7 — 5 participants |
Back to article view | Back to linux.debian.user
Changing default XDB browser w/o GNOME etc. Eduard Bloch <edi@gmx.de> - 2015-12-13 10:30 +0100
Re: Changing default XDB browser w/o GNOME etc. "Thomas Schmitt" <scdbackup@gmx.net> - 2015-12-13 10:40 +0100
Re: Changing default XDB browser w/o GNOME etc. Eduard Bloch <edi@gmx.de> - 2015-12-14 11:30 +0100
Re: Changing default XDB browser w/o GNOME etc. <tomas@tuxteam.de> - 2015-12-13 11:20 +0100
Re: Changing default XDB browser w/o GNOME etc. Martin Read <zen75502@zen.co.uk> - 2015-12-13 12:20 +0100
Re: Changing default XDB browser w/o GNOME etc. Eduard Bloch <edi@gmx.de> - 2015-12-14 11:20 +0100
Re: Changing default XDB browser w/o GNOME etc. Christian Seiler <christian@iwakd.de> - 2015-12-15 17:20 +0100
| From | Eduard Bloch <edi@gmx.de> |
|---|---|
| Date | 2015-12-13 10:30 +0100 |
| Subject | Changing default XDB browser w/o GNOME etc. |
| Message-ID | <qFb8B-6vN-7@gated-at.bofh.it> |
Hello, dear lazynet, I have a problem and I am not sure which is the best approach to tackle it. Observation: various programs use the XDG mechanism (freedesktop configuration method) to start a specific browser to visit a hyperlink. Easy to verify with the xdg-open tool. But how can I change this setting in a persistent way especially when I don't use Gnome or Kde or Xfce? I tried LxQt once and apparently the stupid thing has reset some configuration and now xdg-open starts Qupzilla which I don't like. Before, some other stupid program has reset it to Chromium which I don't like either. How can I configure this, and do that in a way that is set persisently? i.e. no program or package changes the setting to its own yard. NOTE: I will not install the monster just to change this simple setting. Feels like things that have been established in a sane way (alternatives system and sensible-browser) are now reverted to the chaos we used to manage in the nineties :-( Regards, Eduard.
[toc] | [next] | [standalone]
| From | "Thomas Schmitt" <scdbackup@gmx.net> |
|---|---|
| Date | 2015-12-13 10:40 +0100 |
| Message-ID | <qFbih-6zZ-13@gated-at.bofh.it> |
| In reply to | #161721 |
Hi, > Feels like things that have been established in a sane way (alternatives > system and sensible-browser) are now reverted to the chaos we used to > manage in the nineties :-( Well, the kernel has also reverted to the CD drive quirks of the 90s. History is chaotic in a cyclical way. > Message-ID: <....wohnheim.uni-kl.de> Some things stay constant, though. Have a nice day :) Thomas
[toc] | [prev] | [next] | [standalone]
| From | Eduard Bloch <edi@gmx.de> |
|---|---|
| Date | 2015-12-14 11:30 +0100 |
| Message-ID | <qFyyf-4PE-37@gated-at.bofh.it> |
| In reply to | #161722 |
Hallo, * Thomas Schmidt [Sun, Dec 13 2015, 10:32:01AM]: > > Feels like things that have been established in a sane way (alternatives > > system and sensible-browser) are now reverted to the chaos we used to > > manage in the nineties :-( > > Well, the kernel has also reverted to the CD drive quirks > of the 90s. History is chaotic in a cyclical way. Don't get me started... some things start rotting quickly when the user base is shrinking. > > Message-ID: <....wohnheim.uni-kl.de> > > Some things stay constant, though. Or maybe not. Thanks for reminding, I should use the holidays to finally overhaul my mail setup. Regards, Eduard.
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2015-12-13 11:20 +0100 |
| Message-ID | <qFbV0-72v-17@gated-at.bofh.it> |
| In reply to | #161721 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sun, Dec 13, 2015 at 10:19:49AM +0100, Eduard Bloch wrote: > Hello, dear lazynet, > > I have a problem and I am not sure which is the best approach to tackle > it. > > Observation: various programs use the XDG mechanism (freedesktop > configuration method) to start a specific browser to visit a hyperlink. > Easy to verify with the xdg-open tool. > > But how can I change this setting in a persistent way especially when I > don't use Gnome or Kde or Xfce? I tried LxQt once and apparently the > stupid thing has reset some configuration and now xdg-open starts > Qupzilla which I don't like. Before, some other stupid program has reset > it to Chromium which I don't like either. > > How can I configure this, and do that in a way that is set persisently? > i.e. no program or package changes the setting to its own yard. > > NOTE: I will not install the monster just to change this simple setting. If I were you, I'd just try to hi-jack xdg-open (it is, after all, just a shell script under /usr/bin) by installing an alternative one under /usr/local/bin (which comes before /usr/bin in the "usual" set up). Of course you'll call back into the original /usr/bin/xdg-open whenever convenient. In the most common case you just write a simple wrapper around /usr/bin/xdg-open. > Feels like things that have been established in a sane way (alternatives > system and sensible-browser) are now reverted to the chaos we used to > manage in the nineties :-( I feel your pain. Applications programmers have become lazy and now consider file system layout as a part of the "OS API", quabbling on whether something should be under /opt or /usr/local, instead of coping with it. regards - -- tomás -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlZtPCgACgkQBcgs9XrR2kbxiwCeOQ1B+EfkUTOV4RnIjvl/QW9H w18AnjERrGmUBqERh08z+zZ/BrFV7ndR =xV5o -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Martin Read <zen75502@zen.co.uk> |
|---|---|
| Date | 2015-12-13 12:20 +0100 |
| Message-ID | <qFcR3-7CW-3@gated-at.bofh.it> |
| In reply to | #161721 |
On 13/12/15 09:19, Eduard Bloch wrote: > Observation: various programs use the XDG mechanism (freedesktop > configuration method) to start a specific browser to visit a hyperlink. > Easy to verify with the xdg-open tool. > > But how can I change this setting in a persistent way especially when I > don't use Gnome or Kde or Xfce? I tried LxQt once and apparently the > stupid thing has reset some configuration and now xdg-open starts > Qupzilla which I don't like. Before, some other stupid program has reset > it to Chromium which I don't like either. xdg-open examines your environment to determine what desktop environment (if any) you are invoking it under, and follows a DE-specific strategy if you're using one of the DEs it knows about (KDE, LXDE, XFCE, Gnome, Darwin, MATE). This is an entirely reasonable design decision, but also one that reasonable people can disagree with. If you are not using one of the desktop environments it knows about, then it uses its "generic" approach. For HTTP URLs, the generic approach is "check the BROWSER environment variable, then try the web browsers in a specified order if BROWSER isn't set". The first entry in that ordering is www-browser if DISPLAY is not set, and x-www-browser if DISPLAY *is* set. xdg-open is written in POSIX shell, so you could easily copy it into a higher-priority location in your particular user account's PATH and modify it.
[toc] | [prev] | [next] | [standalone]
| From | Eduard Bloch <edi@gmx.de> |
|---|---|
| Date | 2015-12-14 11:20 +0100 |
| Message-ID | <qFyoy-4Kh-17@gated-at.bofh.it> |
| In reply to | #161724 |
Hallo, * Martin Read [Sun, Dec 13 2015, 11:18:24AM]: > On 13/12/15 09:19, Eduard Bloch wrote: > >Observation: various programs use the XDG mechanism (freedesktop > >configuration method) to start a specific browser to visit a hyperlink. > >Easy to verify with the xdg-open tool. > > > >But how can I change this setting in a persistent way especially when I > >don't use Gnome or Kde or Xfce? I tried LxQt once and apparently the > >stupid thing has reset some configuration and now xdg-open starts > >Qupzilla which I don't like. Before, some other stupid program has reset > >it to Chromium which I don't like either. > > xdg-open examines your environment to determine what desktop environment (if > any) you are invoking it under, and follows a DE-specific strategy if you're > using one of the DEs it knows about (KDE, LXDE, XFCE, Gnome, Darwin, MATE). > This is an entirely reasonable design decision, but also one that reasonable > people can disagree with. I didn't realize that it's plain shell script, thanks for mentioning this below. I haven't even checked because I assumed that it's a program using the common glib/kde framework functions to run url/mime handlers. > If you are not using one of the desktop environments it knows about, then it > uses its "generic" approach. For HTTP URLs, the generic approach is "check > the BROWSER environment variable, then try the web browsers in a specified > order if BROWSER isn't set". The first entry in that ordering is www-browser > if DISPLAY is not set, and x-www-browser if DISPLAY *is* set. What you describe is exactly what the sensible-browser script does. And sensible-browser works fine for me, xdg-open does not. What happens for me is that sensible-browser runs x-www-browser (pointing at iceweasel) but xdg-open seems to try different fallbacks first and finds some mime information about for http in /usr/share//applications/mimeinfo.cache (not ok). But anyhow, thanks for mentioning BROWSER variable. It seems to influence glib functions too, so it's just what I need. > xdg-open is written in POSIX shell, so you could easily copy it into a > higher-priority location in your particular user account's PATH and modify > it. I will try to communicate this with the xdg-utils maintainer. IMHO the script should respect the specifics of a system and on Debian consider the configuration of x-www-browser alternative entry rather if it couldn't detect a specific desktop environment. Or maybe do so only if the alternative-link is a non-default setting. Best regards, Eduard.
[toc] | [prev] | [next] | [standalone]
| From | Christian Seiler <christian@iwakd.de> |
|---|---|
| Date | 2015-12-15 17:20 +0100 |
| Message-ID | <qG0uu-6y5-17@gated-at.bofh.it> |
| In reply to | #161721 |
Hi,
Am 2015-12-13 10:19, schrieb Eduard Bloch:
> Observation: various programs use the XDG mechanism (freedesktop
> configuration method) to start a specific browser to visit a
> hyperlink.
> Easy to verify with the xdg-open tool.
Note that xdg-open is just a single implementation and most GUI
toolkits provide their own implementation of the XDG specifications
that are related to this - so changing xdg-open will typically not help
you, I don't think I'm using any software that actually uses it; it's
useful for scripting though.
> But how can I change this setting in a persistent way especially when
> I
> don't use Gnome or Kde or Xfce? I tried LxQt once and apparently the
> stupid thing has reset some configuration and now xdg-open starts
> Qupzilla which I don't like. Before, some other stupid program has
> reset
> it to Chromium which I don't like either.
>
> How can I configure this, and do that in a way that is set
> persisently?
> i.e. no program or package changes the setting to its own yard.
Well, there's a command line tool to change the current setting, called
xdg-mime.
First of all, you need to figure out how the .desktop file is called
of the browser you want to set. For example, Debian's Iceweasel has
iceweasel.desktop. [*] If the software you want to use as your browser
deosn't have a .desktop file (I suspect all browsers packaged within
Debian do, but I don't know), then you need to create one - see the
man page of xdg-desktop-menu for details. All desktop files are found
in /usr/share/applications for programs installed via Debian packages.
I'll assume Iceweasel here and use 'iceweasel.desktop' in the following
example. Replace it by your browser of choice if appropriate.
The 'default browser' is actually not just a single setting. There are
four main settings that are typically related to the question of
'default browser': what program is associated with the HTTP and HTTPS
protocols and what program should open HTML and XHTML files. The
typical checkboxes in programs such as Chromium that change this
setting typically change all four (maybe some others as well), but you
can in fact change them individually if you like. (Iceweasel/Firefox
also includes text/xml for generic XML files in this list, but I'm
going to skip that here, because I don't think it's sensible to open
generic XML files in browsers.)
The MIME types for HTML and XHTML are text/html and
application/xhtml+xml. Change the defaults for these MIME types to make
local (X)HTML files open in the browser of your choice.
There are some 'special' MIME types for protocols, the dummy MIME
category for that is x-scheme-handler/, so for HTTP and HTTPS you
have x-scheme-handler/http and x-scheme-handler/https - these are the
MIME types used when a remote website is accessed.
The following example will set Iceweasel as the default browser by
setting all four MIME types (but as I said, you can pick and choose
here):
xdg-mime default iceweasel.desktop text/html application/xhtml+xml \
x-scheme-handler/http x-scheme-handler/https
After that all XDG compliant programs will use the browser you've set
here as their default browser - you may test it with xdg-open.
Note: this does not preclude some renegade program from changing this
setting back to something else - other than sandboxing such programs
don't think there's any possibility to stop this, because all these
settings are just a couple of files in your home directory, so any
program you run could in principle change them. I try to avoid programs
that mess up my configuration without asking.
Btw. you can also query the current default, e.g.
xdg-mime query default x-scheme-handler/http
(ignores any additional arguments, at least on my box, so only pass
a single MIME type to it per call)
You can also change your default file mananger via the special
inode/directory MIME type - this is the program executed when clicking
on "open containing folder" in Iceweasel - but also other programs use
it. It doesn't even have to be an X11-based program, mc also works
(and it comes with a .desktop file).
> Feels like things that have been established in a sane way
> (alternatives
> system and sensible-browser) are now reverted to the chaos we used to
> manage in the nineties :-(
Well, there's some logic behind it. The alternatives system can only be
set globally by the administrator, so it doesn't help on multi-user
systems. sensible-* is a Debianism, other than derivatives I don't
think this has been adopted by anybody else (I may be wrong), so if I
were upstream to some project, I would not want to rely on these
things. (Also, I can't extract any inforamtion and e.g. show the user
with which program I was going to open something, which is something
you might want to do in certain circumstances.) Also, sensible-*
requires an environment variable per thing you want to configure it
as a user, which is fine if you restrict yourself to just a couple of
things (there are only sensible-{editor,pager,browser}), but there are
a lot of other things you might want to automatically start, such as
your favorite image manipulation program, your favorite PDF reader,
etc.
The basic idea that this should be coupled with MIME types is sound in
my eyes: it's also nothing new, the mailcap(5) file also follows that
idea. The reason why the major desktops on Linux developed a different
solution is that there are certain shortcomings of the mailcap format.
Among others, it only allows for one program to be recognized as
handling a given filetype and automated changes to the file are hugely
problematic. (Which is why the XDG specification was designed with
automatic changes in mind.)
That isn't to say that there aren't any shortcomings of the XDG
standards on this topic - I just want to explain that a lot of thought
has gone into these specifications and there is a good reason for why
most things are the way they are there. (Admittedly, if we were to
redesign the whole thing in today's time, there would probably not be
XML involved.)
I think the main problem of the XDG standards (and in my eyes this is a
HUGE issue) is the lack of documentation. It's not that there's no
documentation at all (there is), but I would argue that it's impossible
to understand how the system works fully without reading the specs
themselves - and since most specs are kind of interrelated, this can
take a while. (They are not terribly long, but still.) And since most
direct consumers of the XDG spec are either desktop environment
developers - or at least developers that work on the major toolkits,
there is little knowledge of the spec outside a small group of people,
especially since most application developers (even if they don't use
the same desktop environments) reuse one of the major toolkits that
already has built-in support for this, so they don't have to know about
any of it.
But apart from the documentation problem, I mostly like the XDG
specification and I understand why it's done the way it is and why most
of the complexity is necessary. You can of course start to nitpick the
entire things, and there sure are parts which I would design in a
different manner today (less XML ;-)), but I do think it is an
improvement over what was there before.
Regards,
Christian
[*] Caveat: KDE4 applications have their .desktop files in a kde4/
subdirectory of /usr/share/applications. In order to properly address
them you need to prefix the .desktop file name with kde4-, e.g.
kde4-konqueror.desktop. Note that some programs will strip the kde4-
prefix when displaying this information. (I'm not completely sure
anymore, but older I think Wheezy's version of xdg-mime query did
that.) But setting with the prefix will work properly. Only in case
you use any KDE4 applications.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web