LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (http://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   [WORKED AROUND] Xfce Help not displayed when Opera is default web browser (http://www.linuxquestions.org/questions/linux-desktop-74/%5Bworked-around%5D-xfce-help-not-displayed-when-opera-is-default-web-browser-751800/)

catkin 09-01-2009 09:17 AM

[WORKED AROUND] Xfce Help not displayed when Opera is default web browser
 
Hello :)

In case it helps anyone ...

In Xfce 4.6.1, with Opera 9.64 as the default web browser, Help from the Applications menu was not displayed with Opera giving error message "You tried to access the address http://'file///usr/share/xfce4/doc/C/index.html', which is currently unavailable". See the http: at the start of the URL; it should be file:///usr/share/xfce4/doc/C/index.html

ps showed the command being run to show help was /usr/lib/opera/9.64/opera -remote openURL('file:///usr/share/xfce4/doc/C/index.html',new-window)

Changing the default web browser from Opera to Firefox (3.5.2) solved the problem. Changed by Applications menu, Settings, "Xfce4 Settings", "Preferred Applications", "Web browser": "Mozilla Firefox".

In case someone wants to make Help work with Opera, the script that launches Help is /usr/bin/xfhelp4.

Best

Charles

i92guboj 09-02-2009 02:04 AM

I haven't xfce installed, but the secret lies for sure in /usr/bin/xfhelp4. If it's a shell script we could edit it to make it always use firefox or whatever browser you want it to use. However, I think that opera can open local URIs as well, so the problem might be that the URI needs to be parsed and corrected a bit.

Try to paste the script here and I'll do my best.

catkin 09-02-2009 03:27 AM

Quote:

Originally Posted by i92guboj (Post 3666427)
I haven't xfce installed, but the secret lies for sure in /usr/bin/xfhelp4. If it's a shell script we could edit it to make it always use firefox or whatever browser you want it to use. However, I think that opera can open local URIs as well, so the problem might be that the URI needs to be parsed and corrected a bit.

Try to paste the script here and I'll do my best.

Thank you for your kind offer but I'm OK with the workaround because Firefox is my preferred browser; I'd only configured Opera while running Gnome and Xfce simultaneously during the changeover (because Firefox got upset when run in two sessions).

Xfce has a preferred browser setting (Menu→Settings→"Xfce4 Settings"→ "Preferred Applications" then set "Web browser") so no need to modify /usr/bin/xfhelp4 for that.

You are right to say "opera can open local URIs as well"; when I tried pasting file:///usr/share/xfce4/doc/C/index.html into its address bar it worked OK.

Out of curiosity, I dug a bit deeper. The problem is not in /usr/bin/xfhelp4. That script only selects the URI and then calls /usr/bin/xfbrowser4 with the URI as the argument. /usr/bin/xfbrowser4 expects environment variable $BROWSER to be set (defaults otherwise) and then calls the browser with a browser-specific command line:
Code:

[snip]
if [ ! "x$1" = "x" ]; then
  case $1 in
      *://*) URL=$1;;
      *) URL="file://$1" ;;
  esac
fi

case $BROWSER in
    firefox*)
        $BROWSER -a firefox -remote openurl\($URL,new-window\) || \
                $BROWSER $URL
        ;;
    communicator*|netscape|mozilla*|phoenix*|firebird*)
        $BROWSER -remote openurl\($URL,new-window\) || \
                $BROWSER $URL   
        ;;
    opera*)
            $BROWSER -remote openURL\($URL,new-window\) || \
                $BROWSER $URL
        ;;
        exo-open)
            $BROWSER --launch WebBrowser $URL
        ;;
    *)
            $BROWSER $URL
        ;;
esac

[snip]

I guess the bug is in -remote openURL\($URL,new-window\).

i92guboj 09-02-2009 03:42 AM

Yes, so it seems. I think that even simply removing the opera*) section altogether would work, the general case *) should work for most browsers anyway. Certainly opera open local URIs ok by just doing "opera <localuri>". If you get the chance report it upstream, so they can fix it. It's quite trivial but I am sure that you are not the first one to be bothered by this bug, and you will surely not be the last one either.

catkin 09-02-2009 02:47 PM

Quote:

Originally Posted by i92guboj (Post 3666493)
Yes, so it seems. I think that even simply removing the opera*) section altogether would work, the general case *) should work for most browsers anyway. Certainly opera open local URIs ok by just doing "opera <localuri>". If you get the chance report it upstream, so they can fix it. It's quite trivial but I am sure that you are not the first one to be bothered by this bug, and you will surely not be the last one either.

Done. Xfce bugzilla 5724

The following command does work perfectly as you thought
Code:

opera file:///usr/share/xfce4/doc/C/index.html
Environment variable $BROWSER is not set, as I thought it might be, by setting Opera as the preferred browser in Xfce. Setting $BROWSER to opera is not a workaround because it results in two instances of Opera -- one showing Xfce Help and the other the default start page.

That leaves setting $BROWSER to anything not matched in the case statement as a workaround. export BROWSER='Internet Explorer' should do the trick!


All times are GMT -5. The time now is 11:06 PM.