Live data from Hacker News

Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

github.com

1–10 of 63 posts

Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#1
Hi HN, I’m excited to share Spot, a simple, cross-platform, React-like GUI library for Go. It is just a few days old and has lots of missing features but I'm happy with the results so far, and looking for some design feedback.

Spot is designed to be easy to use and provide a consistent API across different platforms (mainly Mac & Linux). It’s inspired by React, but written in Go, aiming to combine the best of both worlds: the easy tooling & performance of Go with a modern, reactive approach to UI development.

Key features:

- Cross-platform: Leveraging FLTK[1] & Cocoa[2], Spot works on Mac, Linux, and the BSDs with plans for native Windows support in the future.

- Reactive UI: Adopts a React-like model for building UIs, making it intuitive for those familiar with reactive frameworks.

- Traditional, native widget set: Utilizes native widgets where available to provide a more traditional look and feel.

Why I built it:

I was searching for a cross-platform GUI toolkit for Go that had a more traditional appearance, and none of the existing options quite met my needs. I then started playing with Gocoa and go-fltk and suddenly I worked on an experiment to see how challenging it would be to build something like React in Go, and it kinda evolved into Spot. ¯\_(ツ)_/¯

In 2024, is there a still place for classic desktop GUIs—even with a modern spin?

I’d love to hear your thoughts, feedback, and any suggestions for improvement. Also, contributions are very welcome.

Thank you for checking it out!

[1] https://github.com/pwiecz/go-fltk

[2] https://github.com/roblillack/gocoa

Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go
github.com

Re: Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#2
I don't know how to take this in. On one side, it's great to have a cross-platform GUI toolkit that's easy to use; on the other side, it feels like a React-like UI is contrary to the spirit of simplicity and resource efficiency of Go.

I'm sure it has its perfect use cases, though.

Re: Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#3

I don't know how to take this in. On one side, it's great to have a cross-platform GUI toolkit that's easy to use; on the other side, it feels like a React-like UI is contrary to the spirit of simplicity and resource efficiency of Go. I'm sure it has its perfect use cases, though.

[deleted]

Re: Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#4

I don't know how to take this in. On one side, it's great to have a cross-platform GUI toolkit that's easy to use; on the other side, it feels like a React-like UI is contrary to the spirit of simplicity and resource efficiency of Go. I'm sure it has its perfect use cases, though.

While I agree, that the virtual widget tree has a certain overhead, the typical desktop app you would create with Spot probably does not have 1000s of components—more like ten to twenty probably. Compare that to the immediate mode GUIs that currently are en vogue, that re-render all controls all the time.

Spot does not have any optimizations regarding render performance at the moment and it might never be necessary to add them.

On the other hand, due to the reactive programming model, I really like how state management get a lot clearer—especially when working with multiple goroutines.

Re: Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#9
post #6

Cool! What does building for cross platform look like? Would love if there was a command that produced my MacOs .app and Windows exe without me having to dive into package management/containers/signing headaches per platform.

The backends (FLTK/Gocoa) are using CGo, which currently does not support cross-compiling as far as I know.

So you still need to have a build pipeline with multiple operating systems, signing/notarization tools, etc. :(

Re: Show HN: Spot – Simple, cross-platform, reactive desktop GUI toolkit for Go

#10

> runtime.LockOSThread() > https://github.com/roblillack/spot/blob/main/ui/init_fltk.go... Does this imply GOMAXPROCS needs to be set to at least 2?

No, it just means that the main goroutine should not be moved onto another OS thread to ensure that it is always the same OS thread which will run UI updates.

This is necessary for most UI libraries and in Spot's case implemented for both the FLTK and the Cocoa backend.

Post reply on HN