Re: standard browser
- From: Ulrik Sverdrup <ulrik sverdrup gmail com>
- To: Sebastian Merz <merz sebas googlemail com>
- Cc: kupfer-list gnome org
- Subject: Re: standard browser
- Date: Wed, 3 Feb 2010 18:58:07 +0100
Hi Sebastian,
2010/2/3 Sebastian Merz <merz sebas googlemail com>:
> Hello people!
>
> Kupfer is wicked. I use it a lot and the new keybinding feature is great.
>
> I have two questions about the program though:
> is there a way to use "emacs-like" key chains (lets say hit control x
> - control y)
Kupfer only uses the keybinding code, no one here has written it so
the details are not known, but I don't think this fits into the
keybinding code's model.
>
> How does kupfer figure out what the standard browser is? I could not
> get the internet search plugin start anything but firefox.
On my predominantly Gnome system, kupfer obeys the default browser I
set in the preferred applications applet. Internally it calls
gtk_show_uri which I think in turn asks GIO (GLib's filesystem code)
for the registered handler for the http:// URL scheme. Kupfer is
implemented with the assumption that GLib functions mostly
cross-desktop and well for most users, but the reality is not that
perfect.
While we could implement "workarounds" in Kupfer (It's trivial to make
kupfer use xdg-open for opening URLs instead, patch attached for
curious people), it would be even better to make GLib do the right
thing on all desktops. I think we simply need more distribution people
working with cross-desktop compatibility.
>
> Thanks in advance. I hope this is the right place to write too. Keep
> up your great work,
> Sebastian
Thank you! Your feedback is very welcome.
Ulrik
From 7ac38fc77b4fb490a0d12f5f470d704fc6326f2b Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon, 11 Jan 2010 19:22:26 +0100
Subject: [PATCH] utils: Handle URLs with xdg-open (FOR TESTING PURPOSES)
---
kupfer/utils.py | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/kupfer/utils.py b/kupfer/utils.py
index d7ee445..f6a272c 100644
--- a/kupfer/utils.py
+++ b/kupfer/utils.py
@@ -106,8 +106,22 @@ def show_path(path):
url = gfile.get_uri()
show_url(url)
+def _tolocale(ustr):
+ import locale
+ enc = locale.getpreferredencoding(do_setlocale=False)
+ if isinstance(ustr, unicode):
+ return ustr.encode(enc, "replace")
+ return ustr
+
+def show_url_xdg(url):
+ """Open @url xdg-open"""
+ pretty.print_debug(__name__, "show_url_xdg", url)
+ encoded_url = _tolocale(url)
+ return spawn_async(("xdg-open", encoded_url))
+
def show_url(url):
"""Open any @url with default viewer"""
+ return show_url_xdg(url)
from gtk import show_uri, get_current_event_time
from gtk.gdk import screen_get_default
from glib import GError
--
1.6.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]