Repository navigation
Desktop widgets (transparent background) and an audio widget sample - #25
Merged
Merged
Conversation
- Sketch.Widget(transparent, alwaysOnTop, draggable), called in Settings(): no borders, a see-through background where the system allows it (IsTransparentWindow says), above other windows, moved by dragging, a right-click menu, and its position remembered per sketch. WindowX/WindowY give the window's position for inertia effects. - AvaloniaSketchWindow runs Settings() before showing so it can become the widget; the IDE's canvas opens it on the desktop and shows a card, with Stop, Run, Hot Reload, pause and crashes going through as usual. Sample previews stay inline. - Audio widget sample: the audio-reactive terminal's blobs on a transparent widget; they swing when it's dragged; demo motion where there's no system-audio capture (macOS, Linux). - Card text now wraps between words; SketchApp picks the host's UI language from the system. - Docs (Widget entry), keywords, examples.json and reference index updated; tests for the API, placement and the sample.
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.
Widgets
A sketch calls
Widget()inSettings()and runs as a desktop widget:alwaysOnTop). Dragging it anywhere moves it (draggable: false→ Alt + drag, so left clicks reach the sketch).Clear()leaves (and any alpha below 255) shows the desktop.IsTransparentWindowsays whether the system granted it. Windows and macOS do; Linux only with a compositor. Without it, those pixels come out black and the sketch draws aBackground().WindowX/WindowY: the window's position on screen, for inertia.How it works: the canvas already keeps alpha end to end (a premultiplied RGBA offscreen surface blitted over a cleared lease). What was missing was the window:
Background = TransparentplusTransparencyLevelHint = Transparent, read back fromActualTransparencyLevel.Where it applies:
SketchApp.Run()(NuGet/VS Code): the window itself becomes the widget. Settings() now runs before the window shows, and only once.Audio widget sample
The TerminalAudio blobs on a transparent widget (560×220):
Also
Widgetentry in Sketch structure, keywords, andexamples.json(87 examples).Checks
Generated by Claude Code