Rocket.Chat.Electron icon indicating copy to clipboard operation
Rocket.Chat.Electron copied to clipboard

New option for open link with browser

Open Xarkam opened this issue 6 years ago • 7 comments

Hello,

following a remark from my wife, would it be possible to add a function to configure the browser to use to open the links?

In his company, IE11 is defined as the default browser (under win7) and can not be modified.

Thanks.

Xarkam avatar May 04 '18 12:05 Xarkam

I would like to see this feature for Linux clients as well.

naidu avatar Nov 29 '18 11:11 naidu

i have default Chrome, but opened by Firefox. would like this feature too.

dmitrii-maksimov avatar Sep 06 '19 06:09 dmitrii-maksimov

This would be a great feature, and it seems to already exist in the iOS client https://github.com/RocketChat/Rocket.Chat.iOS/issues/208

philshem avatar May 20 '20 06:05 philshem

On linux, RocketChat rightfully defers to xdg for the browser. To see the current value run,

xdg-settings get default-web-browser

and to set your default browser run,

# for firefox...
xdg-settings set default-web-browser firefox.desktop

# for chrome...
xdg-settings set default-web-browser google-chrome.desktop

See /usr/share/applications for other browsers.

nicholasphair avatar Jun 16 '20 21:06 nicholasphair

Actually on Linux, I already have it set to chromium-browser:

$ xdg-settings get default-web-browser
chromium-browser.desktop

But it opens firefox.

I think its related to snapd or there is some bug inside it, it worked fine with the .deb rocketchat

purplesrl avatar Dec 02 '20 09:12 purplesrl

Update: My solution was to remove firefox from the system and then chromium worked as expected, rocketchat-desktop started using chromium. I do not have time to investigate further.

1. quit rocketchat
2. sudo apt remove firefox 
3. sudo systemctl restart snapd
4. start rocketchat

Actually I did some more research and the issue is not related to rocketchat but to snapd, xdg-open in snap is replaced with:

#!/bin/sh
exec snapctl user-open "$@"
if len(os.Args) == 3 && os.Args[1] == "user-open" {
		if err := xdgopenproxy.Run(os.Args[2]); err != nil {
			fmt.Fprintf(os.Stderr, "user-open error: %v\n", err)
			os.Exit(1)
		}
		os.Exit(0)
	}
..............
func Run(urlOrFile string) error {
	bus, err := dbus.SessionBus()
	if err != nil {
		return err
	}
	defer bus.Close()
	launcher := bus.Object("io.snapcraft.Launcher", "/io/snapcraft/Launcher")
	return launch(launcher, urlOrFile)
}
............
func openUrl(launcher dbus.BusObject, url string) error {
	return launcher.Call("io.snapcraft.Launcher.OpenURL", 0, url).Err
}


[D-BUS Service]
Name=io.snapcraft.Launcher
Exec=@bindir@/snap userd
AssumedAppArmorLabel=unconfined

purplesrl avatar Dec 04 '20 12:12 purplesrl

For Linux

xdg-settings set … wasn't enough for me.

Be sure that result of xdg-settings get default-web-browser is also set to almost all "web" values in ~/.config/mimeapps.list

Example with qutebrowser :

xdg-settings get default-web-browser
org.qutebrowser.qutebrowser.desktop

grep qutebrowser ~/.config/mimeapps.list
[Default Applications]
x-scheme-handler/http=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/https=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/ftp=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/chrome=org.qutebrowser.qutebrowser.desktop
text/html=org.qutebrowser.qutebrowser.desktop
application/x-extension-htm=org.qutebrowser.qutebrowser.desktop
application/x-extension-html=org.qutebrowser.qutebrowser.desktop
application/x-extension-shtml=org.qutebrowser.qutebrowser.desktop
application/xhtml+xml=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/about=org.qutebrowser.qutebrowser.desktop
x-scheme-handler/unknown=org.qutebrowser.qutebrowser.desktop

I also have the gnome-www-browser and x-www-browser alternatives set to qutebrowser's path :

sudo update-alternatives --config gnome-www-browser
There are 3 choices for the alternative gnome-www-browser (providing /usr/bin/gnome-www-browser).

  Selection    Path                  Priority   Status
------------------------------------------------------------
* 0            /usr/bin/qutebrowser   200       auto mode
  1            /usr/bin/chromium      40        manual mode
  2            /usr/bin/firefox-esr   70        manual mode
  3            /usr/bin/qutebrowser   200       manual mode



sudo update-alternatives --config x-www-browser
There are 3 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                  Priority   Status
------------------------------------------------------------
* 0            /usr/bin/qutebrowser   200       auto mode
  1            /usr/bin/chromium      40        manual mode
  2            /usr/bin/firefox-esr   70        manual mode
  3            /usr/bin/qutebrowser   200       manual mode

gardouille avatar Jan 21 '21 17:01 gardouille