Hands on: Let's build a system tray application that shows us the current local time, with the possibility to choose some other countries.
We are ...
For further actions, you may consider blocking this person and/or reporting abuse
I'm learning Go now and I haven't done a .exe since ages, now it would be a good time to make some developer tools.
:( Tons of ideas - shortage of time.
Good article Oscar, I was implementing a sys tray icon for Iris using this library some months ago but it's not really cross-platform by-default, it requires from user to install some dependencies, i.e some linux packages (on windows systems it works out-of-the-box), so be careful when using this library, your users will not be able to run your package with just
go get
!proof-of-concept: github.com/kataras/iris/tree/witht...
Thank you @kataras ! I will run this on different OS and update the requirements :)
Hi, I think your program may eventually crash if you are unlucky.
Indeed, you have 2 concurrent processes that try to read/write
timezone
variable. You should have a lock on this variable.More generally, your algorithm could be more efficient I think, by calling
systray.SetTooltip(timezone + " timezone")
only when timezone is changed (directly after your switch-case) and callingsystray.SetTitle(getClockTime(timezone))
right at the same moment to avoid having a possible 1 second delay between your click and time being changed.Did you ever try to use this systray package together with some GUI golang package?
I tried to use GTK gotk3 to build some windows and run it together with github.com/getlantern/systray/ and i was not success.
This systray package blocks access to xwindows system from GTK package.
Do you have such experience?
Had the same issue with webview. Found this fork where the problem is solved, take a look: github.com/ghostiam/systray
Huh, that's really cool. I didn't know that library existed. Thanks for sharing Oscar!
Has anyone tried it on Windows 11? It won't work for me.