Package: sensible-utils
Version: 0.0.4
Severity: wishlist
Tags: patch

It's very annoying when I click on a link and it opens a new browser, even
though I already have a browser opened. Even when the open browser isn't my
preferred browser, since it's already loaded, I rather have it handle links I
open from pidgin and whatnot.

I made a patch on sensible-browser that takes that into consideration. As it is,
there is no way to disable its behaviour. If you think it would be best that
this is a configurable option, just say so. I'm willing to fix the patch until
it's in an acceptable state.

Cheers,
Rafael

-- System Information:
Debian Release: 6.0.2
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-- no debconf information
--- sensible-browser    2010-04-06 20:14:47.000000000 -0300
+++ /usr/bin/sensible-browser   2011-09-11 16:08:32.000000000 -0300
@@ -2,6 +2,20 @@
 
 URL="$1"
 
+exec_running_browser() {
+    for browser in $(update-alternatives --list $1); do
+        param="$(basename $browser)"
+        if pgrep -c -f "[^ ]*$param( |$)" >/dev/null; then
+            exec $browser ${URL:+"$URL"}
+        fi
+    done
+}
+
+if test -n "$GNOME_DESKTOP_SESSION_ID"; then
+    exec_running_browser gnome-www-browser
+fi
+exec_running_browser x-www-browser
+
 if test -n "$BROWSER"; then
     OLDIFS="$IFS"
     IFS=:

Reply via email to