[HN Gopher] Show HN: Spot - Simple, cross-platform, reactive des...
___________________________________________________________________
Show HN: Spot - Simple, cross-platform, reactive desktop GUI
toolkit for Go
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. -\\_(tsu)_/- 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
Author : da_rob
Score : 76 points
Date : 2024-05-24 19:19 UTC (3 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| ASalazarMX wrote:
| 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.
| da_rob wrote:
| 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.
| ygnasygnoimqwb wrote:
| > 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?
| da_rob wrote:
| 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.
| scosman wrote:
| 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.
| da_rob wrote:
| 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. :(
| scosman wrote:
| Too bad.
|
| I swear half the electron apps use it for ease of Xplatform
| build.
|
| I'd love something like this for giving my CLIs UIs.
| allanrbo wrote:
| Was looking for something like this some years back. Though I
| wanted Windows support too. Ended up switching to C++ to use
| wxWidgets, giving me small self contained binaries.
| da_rob wrote:
| Big fan of WxWindows, I'm just too invested into Go these days.
| :)
|
| Self-contained Spot "Hello World" is 2.3MiB on my Mac. Not
| pretty, but works for me.
| jakjak123 wrote:
| Very cool idea!
|
| If someone implements GTK I would absolutely use it, its just
| fltk is no fun in Linux world
___________________________________________________________________
(page generated 2024-05-24 23:00 UTC)