Added SetIcon method and new IconKind type#47
Open
quadrimus wants to merge 1 commit into
Open
Conversation
meiser79
added a commit
to meiser79/AriaCast-Client-CrossPlatform
that referenced
this pull request
Jun 22, 2026
Build ----- - Vendor a patched copy of webview/webview_go (third_party/webview_go) that links against webkit2gtk-4.1 instead of the removed/deprecated webkit2gtk-4.0, wired up via a go.mod replace directive. - Fix the vendored webview.h's get_webkit_library(): it only looked up the unversioned "libwebkit2gtk-4.1.so" symlink, which is provided only by the -dev package. On any machine with just the runtime package installed, this silently broke every native Go->JS call (Eval() pushes and Bind() return values) with no error anywhere. Added the actual runtime SONAMEs (libwebkit2gtk-4.1.so.0, libwebkit2gtk-4.0.so.37) as fallbacks. - Add SetIcon([]byte) to the vendored webview_go library, extending the Windows-only approach from webview/webview_go#47 to Linux: - engine_base gains a set_icon()/set_icon_impl() pair with a default no-op so macOS and Windows compile without changes. - gtk_webkit_engine overrides set_icon_impl() using GdkPixbuf (g_memory_input_stream_new_from_data + gdk_pixbuf_new_from_stream + gtk_window_set_icon), loading the icon from raw bytes without any temp file. - webview_set_icon() C API function added alongside webview_set_title(). - Go binding: SetIcon(iconData []byte) added to the WebView interface and implemented on *webview. Linux runtime fixes -------------------- - main_linux.go was missing the appMinimize/appClose/startDrag bindings that main_windows.go already had, so the header buttons and minimize did nothing. Added them, with minimize implemented via a real gtk_window_iconify() call. The same bindings were also missing on macOS; fixed there too. - Default WEBKIT_DISABLE_COMPOSITING_MODE=1 on Linux: WebKitGTK's accelerated compositing was breaking pointer-event hit-testing (clicks/slider drags silently swallowed) on some GPU/driver combinations. - Fix a mutex deadlock in Stop(): it called setStatus() (which also locks mu) while still holding the lock via defer, hanging forever and making the stream impossible to stop. - Stop pinning an explicit capture DeviceID in miniaudio's config: this set PA_STREAM_DONT_MOVE on the PulseAudio stream, preventing pavucontrol from moving it to a different source while streaming. Protocol / streaming fixes --------------------------- - Connect /control and /stats WebSocket channels in addition to /audio, as required by the Music Assistant AriaCast receiver plugin before it considers a client connected. - POST {"isPlaying":true} to /metadata on connect (repeated every 30s, isPlaying:false on stop): the receiver plugin only starts an audio player once it observes this flag, regardless of whether audio frames are already streaming. UI -- - Set the native program icon via w.SetIcon() from an embedded PNG, shown in the WM titlebar/taskbar/Alt+Tab. - Push status/server-info updates to the page via w.Eval() (JSON- encoded, not raw string interpolation), now that the underlying webview.h bug is fixed.
meiser79
added a commit
to meiser79/AriaCast-Client-CrossPlatform
that referenced
this pull request
Jun 22, 2026
Build ----- - Vendor a patched copy of webview/webview_go (third_party/webview_go) that links against webkit2gtk-4.1 instead of the removed/deprecated webkit2gtk-4.0, wired up via a go.mod replace directive. - Fix the vendored webview.h's get_webkit_library(): it only looked up the unversioned "libwebkit2gtk-4.1.so" symlink, which is provided only by the -dev package. On any machine with just the runtime package installed, this silently broke every native Go->JS call (Eval() pushes and Bind() return values) with no error anywhere. Added the actual runtime SONAMEs (libwebkit2gtk-4.1.so.0, libwebkit2gtk-4.0.so.37) as fallbacks. - Extend webview/webview_go#47 (SetIcon, Windows-only) to Linux: - icon.go: build tag changed from !windows to !windows && !linux; remains a no-op stub for macOS and other platforms. - icon_linux.go (new, //go:build linux): converts image.Image to PNG bytes via image/png, passes them to a CGo helper (webviewSetWindowIcon) that loads them with GdkPixbuf (g_memory_input_stream_new_from_data + gdk_pixbuf_new_from_stream) and calls gtk_window_set_icon. IconKind is ignored on GTK since the WM scales a single icon itself. - icon_windows.go (new): taken directly from PR #47, unchanged. - webview.go: IconKind type and constants added, image import added, icons field added to the webview struct, w.i.free() called in Destroy(), SetIcon(image.Image, IconKind) added to the WebView interface and implemented as w.i.setIcon(w.Window(), icon, kind). - main_linux.go: decodes the embedded ui/icon.png to image.Image and calls w.SetIcon(img, webview.IconKindDefault) via Dispatch. Linux runtime fixes -------------------- - main_linux.go was missing the appMinimize/appClose/startDrag bindings that main_windows.go already had, so the header buttons and minimize did nothing. Added them, with minimize implemented via a real gtk_window_iconify() call. The same bindings were also missing on macOS; fixed there too. - Default WEBKIT_DISABLE_COMPOSITING_MODE=1 on Linux: WebKitGTK's accelerated compositing was breaking pointer-event hit-testing (clicks/slider drags silently swallowed) on some GPU/driver combinations. - Fix a mutex deadlock in Stop(): it called setStatus() (which also locks mu) while still holding the lock via defer, hanging forever and making the stream impossible to stop. - Stop pinning an explicit capture DeviceID in miniaudio's config: this set PA_STREAM_DONT_MOVE on the PulseAudio stream, preventing pavucontrol from moving it to a different source while streaming. Protocol / streaming fixes --------------------------- - Connect /control and /stats WebSocket channels in addition to /audio, as required by the Music Assistant AriaCast receiver plugin before it considers a client connected. - POST {"isPlaying":true} to /metadata on connect (repeated every 30s, isPlaying:false on stop): the receiver plugin only starts an audio player once it observes this flag, regardless of whether audio frames are already streaming. UI -- - Set the native program icon via w.SetIcon() from an embedded PNG, shown in the WM titlebar/taskbar/Alt+Tab. - Push status/server-info updates to the page via w.Eval() (JSON- encoded, not raw string interpolation).
meiser79
added a commit
to meiser79/AriaCast-Client-CrossPlatform
that referenced
this pull request
Jun 23, 2026
Build ----- - Vendor a patched copy of webview/webview_go (third_party/webview_go) that links against webkit2gtk-4.1 instead of the removed/deprecated webkit2gtk-4.0, wired up via a go.mod replace directive. - Fix the vendored webview.h's get_webkit_library(): it only looked up the unversioned "libwebkit2gtk-4.1.so" symlink, which is provided only by the -dev package. On any machine with just the runtime package installed, this silently broke every native Go->JS call (Eval() pushes and Bind() return values) with no error anywhere. Added the actual runtime SONAMEs (libwebkit2gtk-4.1.so.0, libwebkit2gtk-4.0.so.37) as fallbacks. - Extend webview/webview_go#47 (SetIcon, Windows-only) to Linux: - icon.go: build tag changed from !windows to !windows && !linux; remains a no-op stub for macOS and other platforms. - icon_linux.go (new, //go:build linux): converts image.Image to PNG bytes via image/png, passes them to a CGo helper (webviewSetWindowIcon) that loads them with GdkPixbuf (g_memory_input_stream_new_from_data + gdk_pixbuf_new_from_stream) and calls gtk_window_set_icon. IconKind is ignored on GTK since the WM scales a single icon itself. - icon_windows.go (new): taken directly from PR #47, unchanged. - webview.go: IconKind type and constants added, image import added, icons field added to the webview struct, w.i.free() called in Destroy(), SetIcon(image.Image, IconKind) added to the WebView interface and implemented as w.i.setIcon(w.Window(), icon, kind). - main_linux.go: decodes the embedded ui/icon.png to image.Image and calls w.SetIcon(img, webview.IconKindDefault) via Dispatch. Linux runtime fixes -------------------- - main_linux.go was missing the appMinimize/appClose/startDrag bindings that main_windows.go already had, so the header buttons and minimize did nothing. Added them, with minimize implemented via a real gtk_window_iconify() call. The same bindings were also missing on macOS; fixed there too. - Default WEBKIT_DISABLE_COMPOSITING_MODE=1 on Linux: WebKitGTK's accelerated compositing was breaking pointer-event hit-testing (clicks/slider drags silently swallowed) on some GPU/driver combinations. - Fix a mutex deadlock in Stop(): it called setStatus() (which also locks mu) while still holding the lock via defer, hanging forever and making the stream impossible to stop. - Stop pinning an explicit capture DeviceID in miniaudio's config: this set PA_STREAM_DONT_MOVE on the PulseAudio stream, preventing pavucontrol from moving it to a different source while streaming. Protocol / streaming fixes --------------------------- - Connect /control and /stats WebSocket channels in addition to /audio, as required by the Music Assistant AriaCast receiver plugin before it considers a client connected. - POST {"isPlaying":true} to /metadata on connect (repeated every 10s, isPlaying:false on stop): the receiver plugin only starts an audio player once it observes this flag, regardless of whether audio frames are already streaming. UI -- - Set the native program icon via w.SetIcon() from an embedded PNG, shown in the WM titlebar/taskbar/Alt+Tab. - Push status/server-info updates to the page via w.Eval() (JSON- encoded, not raw string interpolation).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current implementation works for Windows, for other platforms
SetIcondo nothing.Support for all platform is WIP and will be delivered later (if accepted).
See also: #46