I use google chrome browser for private stuff, but on the same machine I have my work toolset. For work things I use Firefox, and I would be really happy If I could assign it as default for HipChat (my work communicator app).
2 Answers
I faced the same problem and here is what I've done in order to open links from the Slack application in Firefox browser while Google Chrome is my default browser.
First you have to create a bash script that will recognize environment variable. I used DEFAULT_BROWSER variable and the script is in the /home/max/.scripts/default-browser.sh file, which is displayed below :
#!/bin/bash if [ "$DEFAULT_BROWSER" == "" ] then DEFAULT_BROWSER=google-chrome fi $DEFAULT_BROWSER "$@" Then you have to create a desktop application (/usr/share/applications/default-browser.desktop):
[Desktop Entry] Version=1.0 Name=Default Web Browser GenericName=Web Browser Comment=Access the Internet Exec=/home/max/.scripts/default-browser.sh %U StartupNotify=true Terminal=false Icon=google-chrome Type=Application Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml_xml;image/webp;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp; Now you can set this new desktop app as a default browser:
xdg-settings set default-web-browser default-browser.desktop After doing all these steps you should be able to set the default browser via the environment variable. Try do the following:
DEFAULT_BROWSER=firefox slack All links you open from slack should be opened in Firefox.
However, if you don't want to set this variable every time and run Slack from the terminal you can modify /usr/share/applications/slack.desktop as seen below :
[Desktop Entry] Name=Slack StartupWMClass=Slack Comment=Slack Desktop GenericName=Slack Client for Linux Exec=env DEFAULT_BROWSER=firefox /usr/bin/slack %U Icon=/usr/share/pixmaps/slack.png Type=Application StartupNotify=true Categories=GNOME;GTK;Network;InstantMessaging; MimeType=x-scheme-handler/slack; The main line is:
Exec=env DEFAULT_BROWSER=firefox /usr/bin/slack %U Hope this helps.
1you can make a launcher to open it in firefox.
Open your favorite text editor. type the following lines:
#!/usr/bin/env xdg-open [Desktop Entry] Name=HipChat Comment=Work Chat GenericName=HipChat X-GNOME-FullName=HipChat Exec=/usr/lib/firefox-esr/firefox-esr Terminal=false X-MultipleArgs=false Type=Application Icon=firefox-esr Categories=Network;WebBrowser; MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https; StartupWMClass=Firefox-esr StartupNotify=true Save the file as HipChat.desktop. From the file manager, right click on the file and set as executable.You should now have a working launcher that opens HipChat in Firefox. To have it appear in your menu, open a terminal navigate to where your file is and type:
sudo cp hipchat.desktop /usr/share/applications NOTE: if you are not using ESR, or if it is located in a different folder on your system, edit the references to firefox as is needed.
2