| src | improve xdg-open feature | |
| .gitignore | Initial commit | |
| Cargo.lock | improve xdg-open feature | |
| Cargo.toml | improve xdg-open feature | |
| README.md | improve xdg-open feature | |
Browserthing (xdg-open on steroids)
Browsers suck. And every time you decide to try out a different one to see if it sucks less, you can't do so completely
Many operating systems have default browser functionality, which is enough to open a link in your current browser, but not for anything more like scripts
Maybe you want to try out Epiphany aka GNOME Web but rely on browser extensions for some workflows? Or maybe you just want a script to open a URL in the default browser's private mode without hardcoding any particular product?
So with this project I tried to somewhat make it easier to hop between multiple browsers
Usage
To achieve equivalent functionality to xdg-open:
browserthing open https://example.com/
Or open in incognito mode!
browserthing open -i https://example.com/
Or more! I am too lazy to list all of the flags because I know nobody will read this,
you can find them in the src/open.rs file or by running browserthing open -h
Configuration
browserthing relies on ~/.config/browserthing file which looks something like this:
firefox flatpak run net.waterfox.waterfox
chromium brave
chromium flatpak run com.brave.Browser
epiphany epiphany
chromium flatpak run io.github.ungoogled_software.ungoogled_chromium
firefox icecat
The first word is the "kind" of browser, which tells browserthing how to interact with it
It can be firefox, chromium, epiphany and other, where other means it will just be
equivalent to running xdg-open with no additional features
The others are the command to call the browser. It can be native, Flatpak, or anything runnable from the command line
I don't recommend putting the ~/.config/browserthing file in any dotfiles because it has no
mechanism of fallback due to how UNIX exec works, so it cannot skip an entry if it is not installed.
But if you are sure or only use Flatpak, then it's fine I guess
Filter
You can filter the browsers by a condition!
For example you might want a browser that's based on Chromium and supports profiles:
browserthing open --if 'kind:chromium&profiles' https://example.com/
Same thing here. If you want to see all the available conditions, see src/conditions.rs
Purpose mode
As a nice addition to filtering, browserthing also has a PURPOSE mode
if you want to script different browsers for different tasks
Then in the script you write browserthing open --purpose <whatever_string_label>,
and this at the top of the config:
PURPOSE foobar <kind> <browser command>
So for example you could have:
PURPOSE local epiphany epiphany
firefox firefox
chromium flatpak run io.github.ungoogled_software.ungoogled_chromium
epiphany epiphany
This way, when you run browserthing open, it will open the first neutral entry, so firefox
And if you run browserthing open --purpose local it will open Epiphany
if you prefer it for http://localhost pages or something
And if you tun browserthing open --purpose foobar it will open the first option
with this purpose or neutral, so firefox. --purpose is not picky like --if
If this all even makes any sense at all. If not, please disregard this feature
Installation
Since it is a Rust project:
cargo install --git https://codeberg.org/rdsq/browserthing
Though ~/.cargo/bin is usually not in PATH, so I recommend cping it into /usr/bin or something for best scripting.
Or add PATH="$PATH:$HOME/.cargo/bin" in your scripts
xdg-open
If you like browserthing so much that you'd replace all your browsers with it, you can!
browserthing set-xdg-open
And you can set it to open those in incognito mode like this in your config:
PURPOSE xdg-open INCOGNITO epiphany epiphany
# ...
epiphany epiphany
yeah this configuration thing is really crappy
Licence
Licensed under the EUPL (hopefully I'm doing this right and that's all I need to say for it to work)