Opening links in several different browsers
Some websites don’t seem to work in Firefox, like GitLab. I just can’t log in to it anymore because Cloudflare is stuck in a perpetual loop of checking whether I’m human. So I’ve had to resort to using Chromium for GitLab. As an avid keyboard enthusiast, I had to undertake several extra steps to open a link in the right browser, but with mimeo (together with xdg-utils-mimeo) I solved it.
After installing, I created ~/.config/mimeo/associations.txt:
/usr/bin/chromium %U
^https?://(www\.)?gitlab\.com(/.*|$)
/usr/bin/firefox -P personal %U
^https?://(.*\.)?sng\.rs(/.*|$)
/usr/bin/firefox -P work %U
^https?://
Note that the rule order matters, as soon as a match is found it will be executed.
Now to check whether this works (--command or -c to print the command that would be executed):
$ mimeo -c "https://gitlab.com"
/usr/bin/chromium https://gitlab.com
$ mimeo -c "https://sng.rs"
/usr/bin/firefox -P personal https://sng.rs
$ mimeo -c "https://wiki.archlinux.org"
/usr/bin/firefox -P work https://wiki.archlinux.org
Now xdg-open will open links in the specified browser using this setup, thanks to xdg-utils-mimeo, which patches the tools to make use of mimeo.