讓 Google Antigravity 在 Windows 上擁有像 OpenAI Codex Desktop 一樣的 「不搶實體滑鼠、不搶前景焦點、背景操作指定 Chrome 分頁與桌面 App、同色圓角螢光外框 + 聊天框 @ 與側邊欄分頁選擇器」 完整電腦操控能力。
- 不搶滑鼠、不搶焦點的背景操作:透過
cua-driver(Windows UI Automation + BackgroundPostMessage+ Synthetic-Pen Injection)操作桌面軟體與視窗拖曳,你可以繼續工作完全不受干擾。 - 已登入 Chrome 分頁感知(Tab-Aware)背景操作:透過
existing-profile與--autoConnect直接操作你平常已登入的 Chrome(保留所有登入狀態、Cookie、擴充功能),不會切走你正在看的分頁。 - 切到才顯示、切走即隱藏的同色圓角外框:代理層 (
bin/cua_window_glow_proxy.py) 以 30 FPS 追蹤目標視窗與分頁,外框顏色與cua-driver虛擬游標 100% 同步(agy-cursor→#4CCCE0),並嚴格釘在目標視窗正上方一層 Z-Order,絕不穿透覆蓋前景視窗。 - 聊天框
@直接點選開啟中的網頁:自動將 Chrome 分頁即時同步為trigger: manual規則(~/.gemini/config/rules/chrome-tab-*.md,未選取時 0 Token),輸入@chrome-tab或關鍵字即可指定操作該分頁。 - Antigravity 原生側邊欄「Chrome Tabs」面板 (MCP App):支援搜尋分頁、重整清單、一鍵
+ 加入對話框貼上分頁 Context Pill。 - 檔案下載/上傳無痛處理:支援透過
browser_download/browser_set_input_files繞過檔案總管彈窗直接存取檔案,也支援直接背景操作 Windows 檔案總管與「另存新檔」對話框。 - Git 驅動持續更新:外掛本體就是 Git Repository,任何電腦一條指令(或一句話請 Antigravity)即可同步最新功能。
系統需求:Windows 10 / 11、Google Antigravity、Google Chrome(建議 144+)。缺少 Git / Python 3 / Node.js /
cua-driver時,安裝腳本會自動補齊。
在任意一台新電腦打開 Google Antigravity,直接貼上這句話:
請閱讀 https://github.com/novoicefire/antigravity-computer-use 的 INSTALL_FOR_AGENT.md,依照裡面的步驟幫這台電腦自動安裝、設定並驗證 computer-use 外掛。
Antigravity 會自動幫你跑完相依套件安裝、Clone 外掛、環境健檢,並引導你完成最後一步 Chrome 開關。
打開 Windows PowerShell,直接貼上執行:
irm https://raw.githubusercontent.com/novoicefire/antigravity-computer-use/main/scripts/install.ps1 | iex腳本會自動完成:
- 檢查並透過
winget安裝 Git、Python 3.12 (py -3)、Node.js LTS (npx)(已安裝則自動略過)。 - 安裝
cua-driver(自動設定CUA_DRIVER_NO_CONNECT=1非互動安裝)。 - 將本專案 Clone 到
%USERPROFILE%\.gemini\config\plugins\computer-use(若已安裝則自動git pull更新)。 - 執行
scripts/doctor.ps1輸出完整環境健檢報告。
為了讓外掛能直接操作你已經登入好的 Chrome 分頁(無須另開空白瀏覽器或重新登入),請在平常使用的 Chrome 做一次以下設定:
- 在 Chrome 網址列輸入並前往:
chrome://inspect/#remote-debugging - 勾選 Enable remote debugging(允許遠端偵錯)
- 確認 Antigravity 的 Customizations → Plugins 中
Computer Use (Background Desktop & Chrome)已啟用(若是全新安裝,重新載入或重開一次 Antigravity 讓 MCP 啟動即可)。
若開啟 Chrome 遠端偵錯時 Chrome 跳出授權提示,按「允許」即可。
- 開著 Chrome 時,外掛會自動把各分頁同步進聊天框
@選單。 - 在聊天框輸入
@chrome-tab或網頁關鍵字(如@github、@youtube),選中分頁後直接下指令:- 「幫我整理這個分頁的重點並填寫表單,不要搶我滑鼠」
- 「在背景幫我把這個頁面的 PDF 下載到
D:\Downloads」
- 在 Antigravity 右側面板點擊
+→Chrome Tabs(或在對話中對 AI 說「打開 Chrome Tabs 選擇面板」)。 - 搜尋你想操作的網頁,按下 「+ 加入對話框」,分頁就會變成輸入框上方的 Context Pill 標籤。
直接對 Antigravity 下指令即可,例如:
- 「在背景幫我打開小算盤算
789 * 321,不要切換我的前景視窗」 - 「幫我把 Chrome 的 YouTube 分頁從最左邊拖曳到最右邊」
- 「幫我在背景打開檔案總管查看
D:\Projects裡的最新檔案」
你可以直接對 Antigravity 說:
「幫我更新
computer-use外掛」
或在 PowerShell 執行:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.gemini\config\plugins\computer-use\scripts\update.ps1"如果也要順便把底層的 cua-driver 一起升級到官方最新版,加上 -UpgradeDriver:
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.gemini\config\plugins\computer-use\scripts\update.ps1" -UpgradeDriver若更新內容包含
mcp_config.json或bin/cua_window_glow_proxy.py,更新後在 Antigravity 外掛頁面將computer-use關閉再開一次(或重開 Antigravity)即可熱重載。
powershell -NoProfile -ExecutionPolicy Bypass -File "$env:USERPROFILE\.gemini\config\plugins\computer-use\scripts\doctor.ps1"可在 %USERPROFILE%\.gemini\config\plugins\computer-use\mcp_config.json 的 cua-driver.env 調整外觀與行為:
| 環境變數 | 預設值 | 說明 |
|---|---|---|
CUA_GLOW_COLOR |
"auto" |
自動與 cua-driver 虛擬游標同色(agy-cursor → #4CCCE0),也可指定任意 #RRGGBB 色碼(如 "#A855F7") |
CUA_GLOW_HOLD_SEC |
"3.5" |
桌面視窗最後一次操作後維持發光外框的秒數(Chrome 分頁模式會至少維持 8.0 秒以便切換分頁檢視) |
單獨測試某個視窗 HWND 的圓角螢光外框效果:
py -3 "$env:USERPROFILE\.gemini\config\plugins\computer-use\bin\cua_window_glow_proxy.py" --test-hwnd <window_id> agy-cursor
antigravity-computer-use/
├── plugin.json # Antigravity 外掛清單與中繼資料
├── mcp_config.json # cua-driver (經螢光代理) + chrome-devtools MCP 設定
├── bin/
│ └── cua_window_glow_proxy.py # 同色圓角外框、30 FPS 分頁感知、@ 分頁同步與 Job Object 代理層
├── ui/
│ └── chrome_tabs_picker.html # Antigravity MCP App 側邊欄分頁選擇器
├── rules/
│ └── AGENTS.md # 背景優先、Z-Order 鎖定、Qt/LINE 鍵盤與外部動作安全規則
├── skills/
│ ├── computer-use-setup/SKILL.md # 環境診斷、修復、版本更新技能
│ └── cua-driver/ # cua-driver 完整桌面與瀏覽器操控手冊
├── scripts/
│ ├── install.ps1 # 一鍵自動安裝腳本
│ ├── update.ps1 # 一鍵持續更新腳本
│ └── doctor.ps1 # 環境健檢腳本
├── INSTALL_FOR_AGENT.md # 專給其他電腦 Antigravity 執行的自動部署手冊
├── CHANGELOG.md # 版本異動紀錄
└── assets/logo.svg # 外掛圖示
chrome-devtools顯示Could not find DevToolsActivePort- 請確認已在 Chrome 打開
chrome://inspect/#remote-debugging並勾選「允許遠端偵錯」,且 Chrome 正在執行中。
- 請確認已在 Chrome 打開
- 需要操控「以系統管理員身分執行」的視窗
- 請以「系統管理員身分」開一次 PowerShell 執行:
cua-driver autostart enable cua-driver autostart kick
- 請以「系統管理員身分」開一次 PowerShell 執行:
scripts/doctor.ps1提示找不到py -3- 代表系統裝的是不含
pylauncher 的 Python(如 Microsoft Store 版或 Conda)。建議執行winget install --id Python.Python.3.12 -e補齊官方 Launcher,或暫時將mcp_config.json的"command": "py"與"-3"改為"command": "python"。
- 代表系統裝的是不含
- 如何貢獻或二次開發?
- 直接在
%USERPROFILE%\.gemini\config\plugins\computer-use修改並即時測試,確認無誤後即可git commit/git push或發起 Pull Request!
- 直接在