Add CPU and memory settings to the VM start menu - #156
Open
nocell wants to merge 1 commit into
Open
Conversation
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.
The VM currently always starts with up to 8 CPU cores and 4 GiB of RAM. Add a Resources → Configure… sheet so users can choose both values before launching, including all host cores and allocations such as 12 GiB, without editing or re-signing the app.
The sheet supports Save, Cancel, and Use Defaults. It persists both settings in versioned UserDefaults, displays the effective allocation in the start menu, and passes it to QEMU for persistent and ephemeral launches. Existing defaults are preserved. CPU choices range from 4 to the host count; RAM uses whole GiB starting at 2, with allocations above 4 GiB leaving 4 GiB for macOS. Saved values that no longer fit a smaller host fall back independently without overwriting the saved preference.
The shell launcher validates canonical decimal values and host limits before touching VM storage. App launches replace inherited resource overrides with the displayed selection; storage-only resets strip the resource settings. The start menu's preferred height grows with the new row and remains capped to the screen with scrolling.
Validation:
make testpassed under Python 3.12 (uv run --no-project --python 3.12 make test): 210 Swift tests plus guest and shell suites.swift test --disable-sandboxand native release build passed.Related: #81, #82.