Switch from Asuka to MyGo, keeping the API client and the feature set: - servers: saved servers, passwordless and password login, proxy, self-signed certificates, per-server device tokens (Keystore), connect form, instance list sheet with switch/disconnect - sessions: virtualized list, search, new session, rename/archive/delete, running indicator, event stream keeps it live - chat: pushed window with system back bar, streaming Markdown via ui/markdown, reasoning and tool rows with image previews, footer menu (read aloud via a Kotlin TTS plugin, copy, fork), user message menu (copy, revert, fork), context usage ring and detail sheet, attachments (photos/files via the document picker), permissions - release builds allow plain http:// LAN servers (Go's net/http dials directly, no cleartext manifest needed) - a local fork of MyGo (third_party/mygo) lowers the Android host's minSdk to 24 (Android 7.0); Go 1.27.4 via mise Version 0.3.0.
57 lines
2.3 KiB
Markdown
57 lines
2.3 KiB
Markdown
# glass
|
|
|
|
Liquid Glass for [MyGo](https://github.com/egoist/mygo) apps of native UI,
|
|
as macOS 26 and later draw it, on every platform: a material that what is
|
|
under an element shows through, frosted and bent along its edges.
|
|
|
|
```go
|
|
import "github.com/egoist/mygo/plugins/glass"
|
|
|
|
ui.Row(c).Padding(8, 16).Radius(22).Material(glass.Glass{}).Children(func() {
|
|
ui.Text(c, "On glass")
|
|
})
|
|
```
|
|
|
|
`glass.Group` merges panes of glass that nearly touch into one surface,
|
|
as AppKit's `NSGlassEffectContainerView` does:
|
|
|
|
```go
|
|
g := glass.NewGroup(c)
|
|
g.Radius = 22
|
|
g.Gap(6).Children(func() {
|
|
g.Pane(ui.Box(c).Padding(8, 16).Center().Children(func() { ui.Text(c, "Cut") }))
|
|
g.Pane(ui.Box(c).Padding(8, 16).Center().Children(func() { ui.Text(c, "Copy") }))
|
|
})
|
|
```
|
|
|
|
On macOS 26 and later, `glass.Glass{Native: true}` draws a toolbar over a
|
|
`ui.WebView` with the system's `NSGlassEffectView`, which samples the page;
|
|
elsewhere it falls back to the shader. With Reduce Transparency, the
|
|
materials draw opaque surfaces.
|
|
|
|
`glass.ScrollEdge` is macOS's scroll edge effect, which content scrolling
|
|
under a bar fades (soft) or frosts (hard) under, and `glass.Blur` blurs
|
|
what is under an element without the glass, evenly or, with a mask,
|
|
progressively:
|
|
|
|
```go
|
|
ui.Box(c).Absolute().Top(0).Left(0).Right(0).Height(74).PassThrough().Material(glass.ScrollEdge{})
|
|
ui.Box(c).Absolute().Top(0).Left(0).Right(0).Height(88).PassThrough().
|
|
Material(glass.Blur{Radius: 6, Mask: &ui.LinearGradient{From: ui.RGB(0, 0, 0), To: ui.Transparent, Angle: 180}})
|
|
```
|
|
|
|
See [the documentation](../../docs/plugins/glass.md), and the Glass page of
|
|
`examples/gallery`.
|
|
|
|
The glass and the blur, which a hard scroll edge draws with, are effects
|
|
of MyGo's renderers (`scene.Effect`): their shaders in Metal Shading
|
|
Language, HLSL and GLSL (`glass.metal`, `glass.hlsl`, `glass.glsl`, and
|
|
`blur.*`), and their twins for the CPU renderer (`pixels.go`, `blur.go`),
|
|
which must draw the same pixels; the tests compare each GPU's drawing
|
|
with the CPU's.
|
|
`go generate` compiles the shaders ahead of time where it can: the Metal
|
|
library on macOS, with Xcode (`shaders_darwin.go`), and the Direct3D
|
|
bytecode on Windows (`shaders_windows.go`). Renderers compile the source
|
|
when the code compiled ahead of time is older than it or than their own
|
|
part of the shader.
|