I am happy to announce that I have finished my native Gemini client for Haiku, named Bemini.
It is now ready for use, and is the native Gemini client that some of us (might have) been waiting for.
You can find the code here:
https://github.com/coolcoder613eb/Bemini
Any plans to package it for HaikuPorts?
Not until Haiku-PyAPI gets updated on HaikuPorts.
I really like the idea of having a native Gemini client,but for me it doesn’t work at all unfortunately.
Dark mode is unsupported in a way that the text is completely hidden since it’s hardcoded to black while the background of the page area adopts system colors (which is a black background coming from B_DOCUMENT_BACKGROUND_COLOR
most likely)
And when trying to open any Gemini page,it crashes completely.
The error log can be seen in the Terminal on the screenshot.
It doesn’t matter which site I’m trying to access,I tried different ones with always the same result.
It’s fixed now, although I have no idea how it worked last week.
I can confirm that the crashes are fixed,but the color issue is not.
I’m still getting black text on a black background in dark mode.
In C++ I’d do SetHighUIColor(B_DOCUMENT_TEXT_COLOR)
on the page view to make the text white (or whatever the text color is set to be) and I assume you need to do something similar,but I have no idea about Python.
That doesn’t seem to have any effect.
Well,now I had a quick look at the code and made a patch ready for you.
You’re totally right,using SetHighUIColor() doesn’t work here because the page content is a BTextView.
Trying to fix up dark mode support when a BTextView is involved always gives me headache.
Since different portions of the text can be formatted differently,you can’t set one color once and for all,but you have to do it separately for each text portion.
I solved that by always setting run.color = ui_color(B_DOCUMENT_TEXT_COLOR)
which can later get overwritten in case there’s a special color for that text portion.
Also I cleaned color handling up a big - run.color
already is a rgb_color
so there’s need to create one named color
and overwrite run.color
with it.
Instead we can just call set_to()
directly on run.color
.
My patch works fine as long as you don’t touch your system color settings,which should be good enough for 99% of the use cases.
Live-updating does not work,because that would require the whole page content to be re-rendered and there’s no really elegant solution for that.
But when loading the next page after changing the system colors,the page colors are fine again.
Here’s the patch: https://up.sceptique.eu/f/24102009/2a062510/0001-make-page-content-readable-in-dark-mode.patch
Another thing I noticed is the white background behind the top bar.
Interestingly,that color correctly gets live-updated to B_PANEL_BACKGROUND_COLOR
when I change my system colors,but when launching the application it’s always white and I see no function in your code that may cause this.
Calling SetViewUIColor(B_PANEL_BACKGROUND_COLOR)
failed at multiple tries since you work directly on the BWindow
and not within a BView
.
Usually in some of Haikus own applications,window content is wrapped into a BView
called topView
on which you can then call functions like SetViewUIColor
.
But that rework is going to be too big for my very very basic Python knowledge so I leave it to you if you want to fix it.
The white background,while looking a bit odd,isn’t as bad as the completely unreadable text after all.
As a last thing,rendering on some pages looks quite broken:
Opening the HTTPS-proxied version of the same page in LibreWolf results in a clean page with no rendering issues,so it’s probably not the page that is broken:
https://geminiprotocol.net/history/
Seems to be the “→” characters in
(“web log” → “blog”, “gopher log” → “phlog”)
That are causing the issue.
My theory is that text_runs go by bytes, and python len
does not.
All fixed!
Pull the latest Haiku-PyAPI and Bemini.
Wow, that was fast, thanks.
I’m not at home currently, will try it later.
Latest Haiku-PyAPI has to be pulled because I had to add all the rgb_color
methods, which hadn’t been bound yet (I think they where added in Beta5).
If you are looking for a test page you can use gemini://gemini.ctrl-c.club/~coolcoder613/test.gmi
Haiku-PyAPI has been updated at Haikuports, and although Bemini is not on haikuports, you can install it by from the hpkg at Releases · coolcoder613eb/Bemini · GitHub.