Gpui Liquid Glass logo

Gpui Liquid Glass

Community
sxhxliang
gpui-liquid-glass

在 Rust GPUI / GPUI Kit 桌面应用中实现、修复或分析 Apple Liquid Glass:用 macOS AppKit 原生材质做侧栏、工具栏胶囊、标签轨道和独立窗口外框,并让按钮、菜单和弹层采用一致的玻璃造型;处理背景合成、布局同步、多窗口和旧系统降级。普通 GPUI 布局、网页玻璃效果和 SwiftUI 应用不使用此技能。

Overview

Publishersxhxliang
Repositorygpui-liquid-glass
Skill namegpui-liquid-glass
Stars
54
Forks
4
Bundled files
7
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by sxhxliang on GitHub. Read the source before you install it.

Installation

Install the Gpui Liquid Glass AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/sxhxliang/gpui-liquid-glass/tree/main/skills/gpui-liquid-glass
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/sxhxliang/gpui-liquid-glass.git /tmp/gpui-liquid-glass
mkdir -p .claude/skills
cp -r /tmp/gpui-liquid-glass/skills/gpui-liquid-glass .claude/skills/gpui-liquid-glass
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Gpui Liquid Glass in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Gpui Liquid Glass on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Gpui Liquid Glass is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

GPUI Liquid Glass

把 Apple 原生玻璃材质接入 GPUI,同时保留应用自己的控件、主题和交互。下面的结论来自一个 GPUI Kit 应用的完整接入,并在 macOS 26+ 实机上确认过。先用它们划定范围,再写代码。

划定真玻璃的范围

GPUI 把整窗画进一个 Metal 图层,原生玻璃只能放在这个图层下方。放在上方会把 GPUI 自己画的文字和图标一起模糊掉(已用 Swift 原型复现)。由此:

  • 可以做真玻璃:下方没有 GPUI 内容的区域,包括悬浮侧栏和检查器、工具栏胶囊、标签轨道、停靠在布局里的底栏,以及设置、预览等独立窗口的外框。
  • 不能做真玻璃:浮在正文或图片上方的菜单、搜索面板、弹层和卡片。它们改用玻璃的实体形态,即系统“减少透明度”时的样子:不透明的材质色,加上 Tahoe 几何(加倍的同心圆角、内缘高光、细外缘、柔和的深阴影)。不要用半透明填充或整窗模糊冒充玻璃。
  • 会和滚动正文重叠的条(例如底部格式栏)改为停靠进布局,让正文不从玻璃下方经过;做不到就用实体形态。
  • 用户要求折射应用内正文时,说明这需要改变渲染结构(正文与控件分属不同的原生表面,或由后端提供背景纹理采样),先评估再提方案。

每个玻璃面板还要选背景来源:

面板背景原生底色层
贴近窗口边缘的侧栏、检查器、设置导航桌面和后方窗口在面板处镂空
内容区里的胶囊、标签轨道、停靠条窗口的主题底色不镂空

内容区中间的胶囊如果采样桌面,看起来就像窗口上开了一个洞。

实现

接入顺序:

  1. 能力与开关。 设置开启且平台有材质时,才发布“玻璃生效”的全局状态;渲染代码只读这个状态来选择布局。非 macOS 和测试构建中它恒为关闭,原有界面保持不变。
  2. 窗口。 创建时就设为透明背景,避免先出现一帧不透明窗口。红绿灯位置在创建参数里给出;运行时切换玻璃时,用 Window::set_traffic_light_position 移动它们。
  3. 清空背景链。 玻璃区域上方的每一层都不能绘制底色:GPUI Kit Root(其插件会刷主题背景)、应用外层包装、各窗口的根、工具栏行和标签行、面板自身。底色改由玻璃下方的原生底色层提供。
  4. 每个窗口的帧协议。 render 开头同步窗口透明状态;面板里放一个记录布局后 bounds 的透明测量元素;根元素的最后一个子元素统一提交。凡是有玻璃面板的窗口都要自己提交;关闭玻璃时也要提交,以拆除原生视图。
  5. 动画与裁剪。 原生视图不受 GPUI 裁剪:隐藏面板时让它滑出窗口,不要裁窄。淡入淡出要把透明度显式传给原生视图,完全透明后停止注册。
  6. 控件与主题。 状态色改为前景色的低透明度;组件库的填充通过主题 token 调整,单个实例只改形状和边缘;每次主题应用后重新执行玻璃适配。

NSGlassEffectContainerView 的 spacing 默认为 0,需要相邻面板融合时要明确设置并实测。一个圆角 div,或一个从未被调用的玻璃辅助函数,都不代表界面已经接入了材质。

高代价陷阱

  • hover 只能设置一次。 对同一元素第二次调用 .hover() 或 .active() 会触发 GPUI 的调试断言 “hover style already set”,调试构建和测试中直接 panic。给 GPUI Kit Button 或已带 hover 的辅助函数再加玻璃 hover 就会崩溃;状态样式要作为构造参数传入。
  • Button 重放实例样式。 GPUI Kit Button 会在 selected 和 disabled 状态中重放调用方的实例样式,实例 .bg() 会盖住选中和禁用的填充。填充改用主题 token。
  • 透明了却仍是实色。 沿背景链逐层排查;临时把原生底色层涂成红色,看不到红色就说明 GPUI 的某一层在整窗刷底色。
  • 截图会骗人。 单窗口截图不包含窗口后方的内容:取样桌面的玻璃显示为平灰,控件周围可能出现斑块。不要为这些伪影改代码,以真实屏幕上的观察为准。
  • 旧系统查找类会 panic。 downcast_ref::<NSGlassEffectView>()、class() 和 alloc() 都会查找类,类不存在时直接 panic;要按创建时记录的后端分派。

分析现有实现

逐个窗口沿着“设置 → 窗口透明 → 背景链 → 面板注册 → 原生提交 → 实际调用位置”追踪代码。说明哪些区域是真玻璃、各自的背景来源,哪些只是实体形态的造型,以及系统负责的材质效果和应用负责的布局与控件效果。源码注释里的设计目标,要有调用链和视觉结果支撑。分析请求保持只读。

验证与交付

读取 references/verification.md。用无头 GPUI 测试强制开启玻璃,渲染整套外框并逐个悬停控件,再关闭玻璃,确认布局完全还原。材质取样、主题和系统偏好只能在真实窗口中确认。交付时注明接入区域、背景来源、支持范围、已执行的验证,以及尚未实机验证的部分。

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Gpui Liquid Glass AI skill do?

在 Rust GPUI / GPUI Kit 桌面应用中实现、修复或分析 Apple Liquid Glass:用 macOS AppKit 原生材质做侧栏、工具栏胶囊、标签轨道和独立窗口外框,并让按钮、菜单和弹层采用一致的玻璃造型;处理背景合成、布局同步、多窗口和旧系统降级。普通 GPUI 布局、网页玻璃效果和 SwiftUI 应用不使用此技能。

Why use Gpui Liquid Glass on TypingMind?

Because you install it once and use it with any model. Gpui Liquid Glass is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Gpui Liquid Glass in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/sxhxliang/gpui-liquid-glass/tree/main/skills/gpui-liquid-glass. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Gpui Liquid Glass?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Gpui Liquid Glass?

As many as you like. As long as a model supports skills, you can use Gpui Liquid Glass with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Gpui Liquid Glass AI skill free?

It is published on GitHub by sxhxliang. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇