You are not logged in.

#1 2012-04-21 22:37:45

Smarthound
Member
Registered: 2012-03-29
Posts: 23

[SOLVED] Change default web browser

In Terminator, I right click on an URL and choose 'Open link'. The link opens in Firefox. I'd like it to open in Opera, instead.

The author says it uses "Gtk's built in URI opening facility", and falls back to xdg-open. When I run

xdg-open http://archlinux.org/

the URL opens in Opera (probably following my $BROWSER environment variable), which tells me that XDG is OK, so I must need to configure GTK's built in URI opening facility, but I have no idea how to do that.

Following the Default Applications wiki page, I installed gconf-editor to see what it would show, but there're only a few things in there, related to gstreamer.

gsettings doesn't show anything about a web browser:

> gsettings list-children org.gnome.desktop.default-applications
GLib-GIO-Message: Using the 'memory' GSettings backend.  Your settings will not be saved or shared with other applications.
office     org.gnome.desktop.default-applications.office
terminal   org.gnome.desktop.default-applications.terminal

I'm not using a DE, just Openbox. I do have a few Gnome and KDE based apps installed, though.

Does anyone have any ideas?

Last edited by Smarthound (2012-04-24 21:09:06)

Offline

#2 2012-04-21 23:05:32

magicalChicken
Member
From: in the sky
Registered: 2012-03-03
Posts: 73
Website

Re: [SOLVED] Change default web browser

Even though you did not see a line there you should still be able to add that line in to the file and it should apply that setting just fine.

Offline

#3 2012-04-22 06:15:04

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: [SOLVED] Change default web browser

Even though you have your $BROWSER set to opera, did you try also putting the corresponding desktop file beside "text/html" in ~/.local/share/applications/defaults.list?

The "gtk built-in method" is gtk_show_uri(). I can't seem to find what other config file could be influencing it. Maybe something in gsettings-desktop-schemas?


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#4 2012-04-22 06:17:17

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [SOLVED] Change default web browser

Smarthound wrote:

When I run [...] the URL opens in Opera (probably following my $BROWSER environment variable), which tells me that XDG is OK

Are you sure about that?

Run "sudo leafpad /usr/bin/xdg-open" (or whatever text editor you use) and search for the first line:

# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
    BROWSER=firefox
    if [ -n "$DISPLAY" ]; then
        BROWSER=nautilus:$BROWSER
    fi
fi

"BROWSER=firefox" should be "BROWSER=opera" on your end.


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#5 2012-04-22 20:27:32

Smarthound
Member
Registered: 2012-03-29
Posts: 23

Re: [SOLVED] Change default web browser

magicalChicken wrote:

Even though you did not see a line there you should still be able to add that line in to the file and it should apply that setting just fine.

What line? What file?

ConnorBehan wrote:

Even though you have your $BROWSER set to opera, did you try also putting the corresponding desktop file beside "text/html" in ~/.local/share/applications/defaults.list?

I don't have that file. I do have this file, though:

> grep text/html .local/share/applications/mimeapps.list 
text/html=opera-browser.desktop;firefox.desktop;

I did

echo text/html=opera-browser.desktop\; > .local/share/applications/defaults.list

but it didn't make any difference.

DSpider wrote:

Are you sure about that?

Fairly sure. /usr/bin/xdg-open has this:

    for browser in $BROWSER; do
        if [ x"$browser" != x"" ]; then

            browser_with_arg=`printf "$browser" "$1" 2>/dev/null`
            if [ $? -ne 0 ]; then
                browser_with_arg=$browser;
            fi

            if [ x"$browser_with_arg" = x"$browser" ]; then
                "$browser" "$1";
            else eval '$browser_with_arg'$xdg_redirect_output;
            fi

            if [ $? -eq 0 ]; then
                exit_success;
            fi
        fi
    done

and later:

# if BROWSER variable is not set, check some well known browsers instead
if [ x"$BROWSER" = x"" ]; then
    BROWSER=links2:links:lynx:w3m
    if [ -n "$DISPLAY" ]; then
        BROWSER=firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER
    fi
fi

I changed that line to

BROWSER=opera:firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER

and later

BROWSER=opera-browser:firefox:mozilla:epiphany:konqueror:chromium-browser:google-chrome:$BROWSER

but no difference was seen in either case.

I've since installed exo, and configured the default browser with exo-preferred-applications. That works, but it means I have to keep exo installed, because as soon as I remove it, the default browser goes back to being Firefox. (When I reinstall exo, and run exo-preferred-applications again, I see it remembered my settings from last time.)

Offline

#6 2012-04-23 13:25:12

debdj
Member
Registered: 2012-01-19
Posts: 163

Re: [SOLVED] Change default web browser

try adding   x-scheme-handler/http=opera-browser.desktop   to the  [Added Associations]  in  ~/.local/share/applications/mimeapps.list

Offline

#7 2012-04-24 21:08:42

Smarthound
Member
Registered: 2012-03-29
Posts: 23

Re: [SOLVED] Change default web browser

debdj wrote:

try adding   x-scheme-handler/http=opera-browser.desktop   to the  [Added Associations]  in  ~/.local/share/applications/mimeapps.list

Success! That was it. I also noticed that exo had put its settings there, too. Thank you.

Offline

#8 2018-06-21 11:45:06

waqleh
Member
Registered: 2018-06-21
Posts: 1

Re: [SOLVED] Change default web browser

debdj wrote:

try adding   x-scheme-handler/http=opera-browser.desktop   to the  [Added Associations]  in  ~/.local/share/applications/mimeapps.list

this is exactly what I need however with chrome as default. and the above only works for HTTP and not HTTPS so just added another line for HTTPS,

It should look something like this:

[Default Applications]
...
...
...
x-scheme-handler/http=google-chrome.desktop
x-scheme-handler/https=google-chrome.desktop

Offline

#9 2018-06-21 11:50:39

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,300

Re: [SOLVED] Change default web browser

Glad to hear. however please pay attention to the dates and don't necrobump 6 year old threads.

Closing.

Online

Board footer

Powered by FluxBB