Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Circumflex, browse HN in your terminal (github.com/bensadeh)
180 points by bensadeh on Oct 14, 2022 | hide | past | favorite | 63 comments
Some two years ago, I found myself spending a lot of time in the terminal between learning vim and discovering new command line tools. I was surprised to see that the niche of HN clis was (relatively) small, and so I decided to write my own command line tool for browsing HN called `circumflex`(`clx`).

`clx` is written in Go using Bubble Tea[1]. You can read the comment section or the linked article in reader mode in the pager `less`.

Using `lesskey` to add custom keybindings, the replies can be collapsed and expanded in real-time (but not individual replies, only all replies at once). Behind the scenes I am appending invisible unicode characters to each line so that I can use the custom keybindings to filter them out. The same technique is used to allow for jumping between top-level comments.

I spent a lot of time thinking about syntax highlighting and finding relevant bits to highlight while also not going overboard with colors. The end result is highlighting of things I find useful for providing context in the comment section, like indicating parent poster and original poster, coloring references, coloring indentations as well as formatting YC startups.

Other quality of life features include adding submissions as favorites (it is stored as a pretty-printed json so you can check it into your vcs to allow for readable diffs). Submissions are marked as read and new comments are indicated with a bullet point.

[1] https://github.com/charmbracelet/bubbletea




Very cool project! Definitely going to check it out.

If you don't mind a bit of a shameless plug, I've also recently built a terminal client for HN [1], although with a slightly different objective - to make it look less like a website, and more like a traditional mail/news reader (i.e. mutt/slrn)

It's not going to have any advanced features because I mostly wrote it for my own use, but maybe someone finds it useful.

[1] https://luke8086.neocities.org/retronews.html


Here's a single file, no dependency nntp / Usenet server library in python3 I wrote. It includes an HN gateway as an example. I have used it with slrn (tui), meli (tui), pan (gui) and thunderbird (gui)

https://github.com/epilys/nntpserver.py


This is neat, but.. HN is already a really snazzy looking website in elinks and the other terminal browsers :)


That looks like a really nice client, thanks for writing it. I'll try it out.

I'm very happy with glider on mobile but still looking for something in the terminal.


I've just installed Glider to write this comment. Thanks for the recommendation!


Sadly, Android only.


Oh yeah good point, I didn't realise it was not available for iOS as I don't use that. But I'm sure iOS has other good clients as people say, especially because this site is very US-developer centric which is an iOS stronghold in terms of marketshare :)


Hacki is also nice, and looks like it works on both Android and iOS.

https://github.com/Livinglist/Hacki


I tried this one out the other day but it felt very non-native - similar to other Flutter apps I've tried.


I like HACK on iOS


This is a fantastic case study in great text-only user Interfaces. Rarely do you see someone getting so many details right.


I really like this client, but I get this error every time I open a link or comments:

  There is no lesskey-src=/var/folders/sv/<filename> option ("less --help" for help)
  Press RETURN to continue
Less version information:

  less --version
  less 581.2 (POSIX regular expressions)
  Copyright (C) 1984-2021  Mark Nudelman
(Edit: formatting)


`clx` depends on the latest version of `less` which at the moment is v 608. Can you update to the latest version and see if you still get the same error message?


You're right, updating to less v608 fixed the issue! Thanks a lot! Maybe you can add a check in clx and show a message, in case the version of less is too old?

For the record: less v581.2 is the one being shipped by macOS 12.6 Monterey, I simply updated with "brew install less"


Great! Thank you for letting me know! I should add a check and also update the brew formula to fetch the latest version of less as well.


my freebsd less is 563. stable debian is 551.

less 608 was releaseed september 2nd 2022...

this happens so often... i find a new cool cli tool, only for it to have a dependency on a newer version of something. so i can't use it until next OS upgrade, and by then, i've forgotten about it cause i never got to test it out.

i guess devs just don't use OS packages and compile every single tool they use?

i used to do that, when i used slackware in the '90s.


Latest buntu/mint at 590.


This is awesome! I only wish the comments were more integrated, so that j/k moved selection between comments and I could collapse trees at any depth (rather than having h/l toggle all collapses).

But I guess that would mean moving away from less for the comments.


Yes, collapsing specific replies is a bit of a limitation at the moment, but moving between comments with j/k is something that can be implemented!


Great UI, easy to use (especially for Vim users). Thanks for building this.


Looks very cool... But it doesn't seem to be getting/displaying any of the comments. Anything I press <enter> on always gives me 0 comments 0 points

https://imgur.com/a/4PrpwTc

I installed using brew on linux mint. The "correct" version of less seems to be in the path

  ~$ less --version
  less 608 (PCRE2 regular expressions)
  Copyright (C) 1984-2022  Mark Nudelman


Not good. Would you be able to open a ticket on GitHub? It would be easier to continue the troubleshooting from there.


I like using 3rd party HN tools and was thinking to try terminal clients.

From the top of my head this is my personal list of minimum requirements such an app would have to support:

1. Text search within all of comments in a thread.

2. Easy command collapse/expand workflow when viewing threads.

Glancing through the doc it seems that this app doesn't (yet) support either of these requirements, is this correct?


1. The cool thing about using `less` as the pager is everything you get out of the box, including search. Search from within less with `/`.

2. You can collapse / expand the comment section with h/l or left arrow and right arrow. The limitation to this is that it is not possible to collapse specific threads / replies, only all replies at once.


> 1. The cool thing about using `less` as the pager is everything you get out of the box, including search. Search from within less with `/`.

Sure, but doesn't this assume running `less` in this case only to search specific text strings? So this means if you wanted to apply any other operations, you'd have to exit out of the $PAGER back into the main terminal app?

What if I wanted to combine it with other operations such as collapse / expand comments? Speaking of:

> 2. You can collapse / expand the comment section with h/l or left arrow and right arrow. The limitation to this is that it is not possible to collapse specific threads / replies, only all replies at once.

So an collapse / expand operation is applied to _all_ comments in a thread? Hmm, in that case for me in terms of usability the browser is still superior.


Love this! Bubbletea is a great library for TUIs. I've been a long time user of hnterm (https://github.com/ggerganov/hnterm) which has a nice feature for collapsing comment threads, but doesn't look as nice otherwise.


The clarity, the focus. Oh how I love text UI. I'm tired of having flashy magazines as the front-end of my applicatkions


It would be nice if this used OSC 8[1] (less supports it) so that there is an easy way to click a link if I want to go to my actual browser.

[1]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3c...


Thanks for the suggestion! That would indeed be very useful!


Any chance you could make it possible to have Circumflex open a HN link? A popup/input to paste a URL into or command line parameter that takes a URL argument? I often discover submissions via Google and would love to be able to view them in Circumflex.

clx -u --url OR clx -l --link


You can do this from the command line with `clx view [id]`. This was in the readme before, but I seem to have removed it when I last restructured the page. If you want to read the article in reader mode it is `clx read [id]`.


Nice. Thanks!


Panics with "Could not determine terminal width" on Windows 10 using cmd.exe


I'm having the same issue


Looks great at first glance, but as far as ctrl-f can tell, there is no login and I assume no ability to post / reply, and no respect for noProcrast settings.

Any interest in adding logged-in-user effects?


Not quite related to the tool itself, but great job on those README.md screencaps. For some reason the slight shadowing was a really nice touch.


Looking in the raw Markdown file, I see the shadowing is not done with CSS, it's included in the PNG image with transparency.


This actually comes out of the box for the system screenshot tool in macOS (Cmd + Shift + 4 and then Space to select window). The screenshot of the window will then have this shadowing around it.


Ooh right, I remember seeing that by chance before. Thanks for the clarification.


Does this mean HN can support color text now?



I faintly remember blinking terminal text…


Do you?


https://imgur.com/a/aqOhbKe

I'm really glad to report our eyes are safe :)


Depends which terminal you use. Apple Terminal, xterm and rxvt at least do blink.


Now I can browse HN without my boss noticing it ;)


I hope rust also has such a UI library


Looks nice, but why AGPL-3? Most of the used libraries are MIT/BSD.


Looks interesting. Any plans to make it available through MacPorts?


I would love to bring this to more package managers, including MacPorts!


Looks great! Will give it a try.

Any plans for adding login and posting support?


Right now it is somewhat out of the scope of this project as I am using less for viewing everything. But it would be great down the line to write replies in your favorite terminal editor all from within clx!


This is well done! I am loving browsing HN with it.


What font is in the screenshots? I like it


How to install on linux for a newbie?

And damn you so awesome!


Thank you!

On linux you can still install with homebrew[1], but if you prefer you can install from source as well. Follow the installation instruction for installing Go, maybe your distro has a preferred way. Then you can clone the repo and either 1. install the binary with `go install` (make sure $GOPATH/bin in in your path variable) or 2. run with `go run main.go`.

On a side note, I am looking for help to add `clx` to linux package managers.

[1] https://docs.brew.sh/Homebrew-on-Linux


Thanks!


Octal is my fav iOS HN client


this is too good to the eyes


Pretty nice!


Amazing!


I’d love to see a HN<->NNTP bridge. This would make it possible to use standard Usenet readers, which provide vastly superior functionality, from proper threading to scoring.


NNTP is one of the most under-rated internet protocols IMO. Solved a lot of problems that are worth solving, even in domains even further from its original purpose than this. Also, if I could use a news reader for HN I could take advantage of a local killfile. ;)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: