用命令行,掌控 Mac 窗口
Beta查询窗口、编排布局,把桌面操作接入脚本与 AI 工作流。在终端里就能完成。
安装命令行工具tangrid windows --desktop current| ID | APP |
|---|---|
| visual-studio-code1 | Visual Studio Code |
| safari1 | Safari |
tangrid mode flow
tangrid flow arrange --desktop current \
--windows visual-studio-code1,safari1 \
--style columnstangrid mode flow
tangrid flow group create \
--windows visual-studio-code1,safari1 \
--active visual-studio-code1图中 ID 仅为示例,请使用 Mac 上 tangrid windows 返回的实际 ID。
持续平铺,或按需排列
Flow 会持续调整窗口;Snap 只排列一次,之后由你自由摆放。可通过命令行切换模式。
Flow持续自动调整布局
tangrid mode flow
tangrid flow arrange --desktop current \
--all-eligible --style columnsSnap排列一次,自由摆放
tangrid mode snap
tangrid snap arrange --desktop current \
--all-eligible --style columns把常用布局写进文件
用 JSON 定义分割与标签分组。用 --dry-run 预览后再应用,窗口尺寸和位置由 Tangrid 计算。
{
"apiVersion": 1,
"desktopId": "desktop1",
"unlisted": "error",
"layout": {
"type": "split",
"orientation": "columns",
"children": [
{ "type": "window", "windowId": "visual-studio-code1" },
{ "type": "window", "windowId": "safari1" }
]
}
}tangrid flow apply --file layout.json --dry-run
tangrid flow apply --file layout.json让 AI Agent 操作本机窗口
拥有本机 shell 访问权限的 Agent,可以读取窗口状态、查询可用命令,并调整窗口布局。通过 JSON 输出和预览命令,先了解当前桌面,再执行操作。
安装 skill
从 https://tangrid.app/SKILL.md 安装 Tangrid skill
SKILL.md已复制
使用示例
帮我均分当前桌面上的窗口。
tangrid state --json
tangrid capabilities --json
tangrid mode flow
tangrid flow balance --desktop current --json在 Tangrid 中安装,在终端里使用
Beta打开 Tangrid
查询或修改窗口状态时,请保持应用运行。
安装命令行工具
在设置中打开「窗口管理 → CLI」,选择「安装 CLI」。
运行第一条命令
检查就绪状态、列出窗口,再通过内置帮助探索其他命令。
tangrid status
tangrid windows
tangrid --help直接运行应用内的 CLI
Tangrid 安装在 /Applications 时,可直接运行内置工具,或将其加入 PATH。若安装在其他位置,请相应调整路径。
/Applications/Tangrid.app/Contents/CLI/tangrid --helpexport PATH="/Applications/Tangrid.app/Contents/CLI:$PATH"将 export 命令加入 ~/.zshrc,即可在以后的终端会话中继续使用。
命令参考
W = 窗口,G = Flow 标签组,D = 桌面,M = 显示器。方括号表示可选参数,| 分隔可选值或互斥形式。
通用命令
| 命令 | 参数 | 用途 |
|---|---|---|
tangrid status | 无 | 查询应用版本、模式、就绪状态和忙碌状态。 |
tangrid capabilities | [--window W] | 列出可用命令、数据结构和使用限制。 |
tangrid state | [--desktop D] [--display M] | 读取窗口、显示器、桌面、布局及修订标识的状态快照。 |
tangrid windows | [--desktop D] [--display M] [--app BUNDLE_ID] [--title-contains TEXT] [--title-regex REGEX] [--placement tiled|floating|unmanaged] [--focused] | 按指定条件筛选并列出窗口。 |
tangrid window W | 无 | 读取单个窗口的完整状态。 |
tangrid displays | 无 | 列出显示器、几何信息、缩放比例及活跃桌面。 |
tangrid desktops | [--display M] [--include-fullscreen] | 列出桌面,可包含 macOS 原生全屏空间。 |
tangrid mode | [flow|snap|off] | 查询或切换应用的全局模式,设置会持久保存。 |
tangrid focus W | 无 | 恢复并聚焦窗口,必要时选中对应的 Flow 标签。 |
tangrid focus | --from W --direction left|right|up|down | 聚焦指定方向的相邻窗口。 |
tangrid move W | (--display M | --desktop D) [--follow] | 将窗口移至显示器或桌面,可选择跟随窗口。 |
tangrid resize W | --direction grow|shrink [--steps N] | 按配置步长及当前模式的约束调整窗口大小。 |
tangrid fill-screen W | --enabled true|false | 在当前桌面内开启或关闭「填满屏幕」。 |
tangrid fullscreen W | --enabled true|false | 进入或退出 macOS 原生全屏。 |
tangrid minimize W | --enabled true|false | 最小化或恢复窗口。 |
tangrid close W | 无 | 请求关闭窗口。 |
tangrid watch | [--events window,desktop,display,layout,group,mode] [--desktop D] | 订阅窗口、桌面、显示器、布局、标签组或模式的变化。 |
tangrid operation ID | 无 | 通过操作 ID 查询已接受的修改操作。 |
tangrid operation | --request-id UUID | 通过调用方提供的请求 ID 查询修改操作。 |
tangrid --help | 无 | 显示帮助,无需启动 Tangrid。 |
tangrid --version | 无 | 显示 CLI 版本,无需启动 Tangrid。 |
Flow 命令
| 命令 | 参数 | 用途 |
|---|---|---|
tangrid flow layout | --desktop D | 读取桌面的布局关系。 |
tangrid flow tile | --windows W1,W2 | 将窗口交回 Flow 持续管理,优先恢复到有效的原布局位置。 |
tangrid flow float | --windows W1,W2 | 将指定窗口设为浮动。 |
tangrid flow arrange | (--windows W1,W2 [--desktop D] | --desktop D --all-eligible) --style auto|columns|rows | 集中排列所选窗口,并交由 Flow 持续管理。 |
tangrid flow place | --target W_OR_G --relative-to W_OR_G --side left|right|up|down | 将窗口或标签组插入现有布局区域的指定一侧。 |
tangrid flow swap | --first W_OR_G --second W_OR_G | 交换同一桌面内的两个窗口或标签组。 |
tangrid flow balance | --desktop D | 在窗口尺寸约束内均分布局空间。 |
tangrid flow rotate | --desktop D --direction clockwise|counterclockwise | 旋转桌面布局。 |
tangrid flow flip | --around W_OR_G | 沿当前方向翻转最近一层分割。 |
tangrid flow orient | --around W_OR_G --orientation columns|rows | 将最近一层分割设为横向并排或纵向堆叠。 |
tangrid flow apply | --file FILE | --stdin | 应用完整的声明式桌面布局。 |
Flow 标签组
| 命令 | 参数 | 用途 |
|---|---|---|
tangrid flow group list | [--desktop D] | 列出 Flow 标签组。 |
tangrid flow group get G | 无 | 读取成员、标签顺序、活跃标签及布局区域。 |
tangrid flow group create | --windows W1,W2 [--active W1] [--anchor W1] | 将至少两个窗口组成标签组。 |
tangrid flow group add G | --windows W3,W4 | 将指定窗口加入标签组。 |
tangrid flow group remove G | --windows W2 [--placement tiled|floating] | 移出指定成员,默认恢复为独立平铺窗口。 |
tangrid flow group reorder G | --windows W2,W1,W3 | 设置标签组的完整标签顺序。 |
tangrid flow group dissolve G | [--placement tiled|floating] | 解散标签组,默认将成员恢复为独立平铺窗口。 |
tangrid flow group move G | (--display M | --desktop D) [--follow] | 将整个标签组移至显示器或桌面,可选择跟随。 |
Snap 命令
| 命令 | 参数 | 用途 |
|---|---|---|
tangrid snap layout | --desktop D | 读取当前几何信息及吸附关系。 |
tangrid snap arrange | (--windows W1,W2 [--desktop D] | --desktop D --all-eligible) --style auto|columns|rows | 集中排列一次,并让窗口参与后续吸附。 |
tangrid snap place | --window W --relative-to W2 --side left|right|up|down | 相对于另一窗口进行分割放置。 |
tangrid snap place | --window W --edge left|right | 按当前几何信息将窗口放置在显示器边缘。 |
tangrid snap set-floating | --windows W1,W2 --enabled true|false | 设置窗口是否排除在吸附之外,保持当前位置和大小。 |
tangrid snap apply | --file FILE | --stdin | 一次性应用声明式布局。 |
让 Mac 窗口管理更顺手。
免费试用 Tangrid 7 天。一次性买断,享 14 天退款保障。