daemon: read CLAWDEX_SCALE env var to override window scale#1
Open
MondoBoricua wants to merge 1 commit into
Open
daemon: read CLAWDEX_SCALE env var to override window scale#1MondoBoricua wants to merge 1 commit into
MondoBoricua wants to merge 1 commit into
Conversation
… in README Follows the existing CLAWDEX_SOCK env var pattern in main.swift. PetWindow already accepts a scale parameter (default 0.75) — this just plumbs an env-var override through. Value parsed as Double, NaN/infinity rejected, clamped to 0.25–4.0 so a typo can't produce a window larger than the screen. No behavior change for existing users: when the var is unset, the daemon still calls PetWindow(scale: 0.75) effectively. No CLI flags, no socket protocol changes. README gets a small "Customization" section showing the values from the existing PetWindow.swift comment (0.5 pixel-perfect / 0.75 default / 1.0 2x-doubled) and the launchd plist snippet to persist it across reboots.
There was a problem hiding this comment.
Pull request overview
Adds an optional CLAWDEX_SCALE environment variable so users can adjust the pet window scale at daemon startup without recompiling, mirroring the existing CLAWDEX_SOCK pattern. The value is parsed as a Double, validated against NaN/infinity, and clamped to 0.25–4.0. README gets a new Customization section documenting the variable plus a launchd plist snippet.
Changes:
- Read and validate
CLAWDEX_SCALEinAppDelegate.applicationDidFinishLaunching, passing the result toPetWindow(scale:). - Document the new env var, scale guidance, and launchd persistence in README.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Sources/ClawdexApp/main.swift | Parse CLAWDEX_SCALE, fall back to 0.75 on invalid input, clamp to [0.25, 4.0], pass into PetWindow. |
| README.md | Add Customization section explaining CLAWDEX_SCALE and launchd plist usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
CLAWDEX_SCALEenv var that lets users override the on-screen pet size without rebuilding from source. Default behavior is unchanged.Why
The default
0.75scale (hardcoded inPetWindow.init) looks great on most setups but feels oversized on some screens — I ended up patching the source locally to get a smaller sprite. Figured an env var would save the next person that same dance, since the pattern already exists in the daemon (CLAWDEX_SOCK).How
main.swiftreadsCLAWDEX_SCALEonce at startup, parses asDouble, rejects NaN/infinity, clamps to0.25–4.0, and passes the result into the existingPetWindow(scale:)initializer. No CLI flag, no socket protocol changes, no new types — same pattern as the existingCLAWDEX_SOCKhandling a few lines below.The README gets a small Customization section reusing the scale guide that's already in the
PetWindow.swiftcomment (0.5pixel-perfect /0.75default /1.02× pixel-doubled) plus a launchd plist snippet to persist it across reboots.Behavior
CLAWDEX_SCALEPetWindow(scale: 0.75)— identical to today0.51.0foo/NaN/ empty0.750.01/9990.25/4.0Tested
swift build -c releasecleanCLAWDEX_SCALE=0.5andCLAWDEX_SCALE=1.0— sprite resized correctly, state machine + dragging still work0.75as expectedOut of scope (happy to follow up if you want)
launchctl kickstart -k gui/\$(id -u)/dev.clawdex.daemon)clawdex wake --scale 0.5— would need socket protocol additions, felt too heavy for thispet.json— different design question (whose preference wins?)Thanks for clawdex by the way — it's great.