Documentation
¶
Overview ¶
Package desktopiso makes the app that starts Claude Desktop in a folder of its own (#5671): ~/Applications/Claude Magpie.app, whose executable is a script that runs the user's Claude.app with --user-data-dir set to desktopdir.Isolated. Desktop's 3p folder is its userData with "-3p" added unless it ends so already (GY in Desktop 2.7032's and 4.4212's index.pre.js), so that folder holds magpie's whole 3p mode, and the user's own Desktop, signed in with Anthropic in ~/Library/Application Support/Claude, runs beside it untouched. The packaged Desktop drops CLAUDE_USER_DATA_DIR from its environment, so the flag is the one way in; it is no switch Desktop refuses to start with (its list: remote-debugging-port, host-rules and the like).
Tried on a Mac mini with Desktop 4.4212: started from such a bundle it read the folder's configLibrary and asked the gateway for /v1/models, while a second Desktop ran in another folder; opening the bundle again while it ran started no second copy.
macOS takes a running app for the bundle its executable is in. Run from the user's Claude.app, the isolated Desktop was that app to macOS (lsappinfo: its bundle path), so opening Claude.app, from the Dock, Finder or `open -a`, brought it forward and started nothing (baranwang on X: "claude magpie 在开启的时候无法打开 claude"). So the script runs Desktop from a copy of Claude.app of its own, in the app's Contents/Helpers (Copy): an APFS clone, which takes no room, made again when Claude.app's Info.plist differs from the copy's (Claude.app updated). Its Info.plist and signature stay Claude's own: a bundle whose Info.plist is changed is killed at start (its entitlements need the signature whole), so the copy is Claude to macOS, its icon in the Dock Claude's, a tile of its own. Where Claude.app is on another volume the copy would be a whole one (~900 MB), so none is made and Desktop runs from Claude.app as before.
Index ¶
- Constants
- Variables
- func Add(home, claudeApp, dir, claudeDir string) (string, error)
- func Badged(base image.Image, size int) *image.NRGBA
- func Copy(home string) string
- func Here(home string) string
- func Icon(claudeApp string) ([]byte, error)
- func Mine(p string) bool
- func Outdated(p string) bool
- func Path(home string) string
- func Remove(home string) (string, error)
- func Script(claudeApp, exe, dir, claudeDir string) string
Constants ¶
const BundleID = "ai.usemagpie.claude-desktop"
BundleID is its CFBundleIdentifier, which says a bundle by that name is magpie's: one without it is the user's and is never written over.
const Name = "Claude Magpie"
Name is the app's name, and its bundle's without ".app".
Variables ¶
var ErrTheirs = errors.New(Name + ".app is there already and isn't magpie's")
ErrTheirs: a bundle by the app's name is there and isn't magpie's.
Functions ¶
func Add ¶
Add makes the app for home, starting the Desktop at claudeApp on dir, its Code tab's Claude Code on claudeDir when one is given (Script), and gives its path. One of magpie's there already is made again; one that isn't magpie's stays, and Add fails (ErrTheirs).
func Badged ¶
Badged is base at size pixels with magpie's badge over its bottom right: a white disc with a hairline rim and magpie's bird in it, a little over a third of the icon across. macOS's icon grid keeps the picture inside ~80% of the canvas, so the disc sits on the artwork's corner, not the canvas's.
func Copy ¶
Copy is the copy of Claude.app the app runs Desktop from, in its Contents/Helpers, made by its script.
func Icon ¶
Icon is the app's icon, as an .icns: Claude.app's own (its CFBundleIconFile, electron.icns in 2.7032 and 4.4212), its largest picture with magpie's badge at the bottom right, at 1024, 512, 256 and 128 pixels.
func Outdated ¶
Outdated says the app at p, magpie's, has a script made before it ran Desktop from a copy of its own: such an app runs Desktop from Claude.app, which then won't open beside it.
func Remove ¶
Remove takes the app away when magpie made it, and gives the path it was at, "" when there was none of magpie's. A Desktop running from the app's copy of Claude.app is quit first: the copy goes with the app.
func Script ¶
Script is the app's executable: Desktop's own executable exe in claudeApp (else in /Applications or ~/Applications, where it may have moved since) run on dir. A Desktop already running on dir is not started a second time on it: two copies on one userData share no lock.
Run as the app's executable on a Mac, it runs Desktop from the app's copy of that Claude.app (Copy), cloned first when there is none or Claude.app's Info.plist differs from its, so that Claude.app itself still opens beside it (package doc). A copy it can't make (another volume, a clone that failed) leaves Desktop run from Claude.app. One script makes the copy at a time (Contents/.copying, one older than ten minutes taken as left behind); another runs what is there.
With claudeDir, the Claude Code Desktop's Code tab runs keeps its files there (#6459): Desktop takes CLAUDE_CONFIG_DIR from its environment when its own Settings set none (Desktop 4.23118 and 2.7032), and starts its sessions with it. "" leaves it ~/.claude, or whatever the user's own environment says.
Types ¶
This section is empty.