For quite some time, I have tried to get links in Thunderbird to open automatically in Chrome or Chromium instead of defaulting to Firefox. Moreover, I have Chromium start in incognito mode by default, and I would like those links to do the same. This has been a problem for me since I don’t use a full desktop environment like KDE, GNOME, or even XFCE. As I’m really a minimalist, I only have my window manager (which is Openbox), and the applications that I use on a regular basis.
One thing I found, though, is that by using PCManFM as my file manager, I do have a few other related applications and utilities that help me customise my workspace and workflows. One such application is libfm-pref-apps, which allows for setting preferred applications. I found that I could do just what I wanted to do without mucking around with manually setting MIME types, writing custom hooks for Thunderbird, or any of that other mess.
Here’s how it was done:
/usr/bin/libfm-pref-appsfrom your terminal emulator of choice
- Under “Web Browser,” select “Customise” from the drop-down menu
- Select the “Custom Command Line” tab
- In the “Command line to execute” box, type
/usr/bin/chromium --incognito --start-maximized %U
- In the “Application name” box, type “Chromium incognito” (or however else you would like to identify the application)
Voilà! After restarting Thunderbird, my links opened just like I wanted them to. The only modification that you might need to make is the “Command line to execute” portion. If you use the binary of Chrome instead of building the open-source Chromium browser, you would need to change it to the appropriate executable (and the path may be different for you, depending on your system and distribution). Also, in the command line that I have above, here are some notes about the switches used:
- –incognito starts Chromium in incognito mode by default (that one should be obvious)
- –start-maximized makes the browser window open in the full size of your screen
- %U allows Chromium to accept a URL or list of URLs, and thus, opens the link that you clicked in Thunderbird
Under the hood, it seems like libfm-pref-apps is adding some associations in the
~/.config/mimeapps.list file. The relevant lines that I found were:
x-scheme-handler/http=userapp-chromium --incognito --start-maximized-8KZNYX.desktop;
x-scheme-handler/https=userapp-chromium --incognito --start-maximized-8KZNYX.desktop;
Hope this information helps you get your links to open in your browser of choice (and with the command-line arguments that you want)!