bensadeh / circumflex

๐ŸŒฟ It's Hacker News in your terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Configurable browser

mar10p opened this issue ยท comments

It would be awesome if there was a config file where one could set the browser command - e.g., on my Mac, instead of opening with the default browser, I prefer to open -a firefox and I imaging some folks might want to use a text-based one, keeping it all in the terminal.

As an alternative, I'd be happy with it also using an env variable BROWSER or similar.

Hi @mar10p and thanks for opening this issue.

I've added support for customizing the command when opening links in the default browser through the env variable CLX_BROWSER:

Set to a custom command to be run when opening links. The URL to the website will be appended to
CLX_BROWSER and ran as a single command.

Keep in mind that this won't work for terminal browsers, since that is a bit more complicated.

I've pushed the changes to main, let me know if they work as expected.

@bensadeh Thank you Ben, that works great for my purposes!

Works fine with a single command like this:
export CLX_BROWSER=/usr/local/bin/firefox

It did not work with any args or with a terminal browser, as expected:
export CLX_BROWSER="/usr/bin/open -g -a firefox "

However, I'd like to note for any other users that come across this issue, that the simple workaround is to add a script, and set that script as your CLX_BROWSER e.g. /usr/local/bin/mybrowser:

#!/bin/bash
/usr/bin/open -g -a firefox "$*"

Ah, thank you for clarifying. I see how it is useful if you also want to open it in the background with the -g flag.

I've added support for including arguments in the CLX_BROWSER env variable in e983358. Is this working as expected now?

@bensadeh Thanks Ben, that's even better! At first I thought it didn't work, but then I realized I forgot to recompile after pulling from upstream ๐Ÿคฆโ€โ™‚๏ธ๐Ÿ˜‚

I really appreciate the patch, it works great!

Happens to the best of us! ๐Ÿ˜‚

Glad it is working for you! I will make a new release with the changes soon!

So great to see this working in the official release, thank you so much!

I am happy it is working well for you! ๐Ÿ˜„