feat(cli): add --maximized and --fullscreen flags to start the window in that mode#66
Merged
Merged
Conversation
… in that mode Introduce launch-time flags to force the window mode regardless of the config window size, mirroring the existing hand-rolled arg parsing. - add `StartupWindowMode` and `startup_window_mode()` to `cli.rs`; `--fullscreen` wins over `--maximized` when both are present - thread the parsed mode through `App::new` and apply it to the `WindowAttributes` in `resumed()` (overrides the config inner size) - document both flags in `--help` - tests for the parse matrix, precedence, and independence from `--scope`
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.
Summary
Add launch-time
--maximizedand--fullscreenflags so the window can bestarted in a specific mode regardless of the configured window size. Parsing
follows the existing hand-rolled
--scopestyle (no new dependency).Changes
src/cli.rs— newStartupWindowMode { Maximized, Fullscreen }enum andstartup_window_mode()parser.--fullscreentakes precedence over--maximizedwhen both are given. Both flags are documented in--help.src/main.rs— newApp.startup_windowfield;App::newtakes the parsedmode and
main()reads it from argv.src/winit_handler.rs—resumed()applies fullscreen / maximized to theWindowAttributeswhen the flag is set, overriding the config inner size.--maximized,--fullscreen, absent), precedence(fullscreen wins either order), independence from
--scope, and updated help-textassertions.
Added.How to test
cargo run -- --maximized— window opens maximized.cargo run -- --fullscreen— window opens fullscreen.cargo run -- --maximized --fullscreen— opens fullscreen (documented precedence).cargo run -- --help— lists both flags.cargo test startup_window_modecovers the parser.