Adds new cli flag to generate subcommand: --preview/-p which prints scheme to stdout and then early returns. This is used in Services/Colors.load().
Adds short versions of existing flags (--image-path -> -i).
The "preview" state on the QML side was lazy and wasn't really a preview at all. It was effectively performing all operations for setting a wallpaper every time currentIndex updated in the wallpaper carousel, most importantly it was writing the ${Paths.state}/scheme.json file every time.
This is okay behavior, but wasteful. Due to how file watchers work by "attaching" to a specific file, when said file is overwritten by an atomic write (which we always use), then the original file no longer exists and the current watcher needs to be killed only for a new one to be spawned to watch the new file.
This PR solves this by loading the color scheme through stdout and only once the user sets/accepts the selected wallpaper will it write the scheme file, and if the user cancels then no write will happen.
Related issue
No response
Type
Bug fix
Tested
Build succeeds
Existing tests pass
Manually verified
Breaking changes?
No response
Checklist
CI passes (format, lint, typecheck)
Clean commits
No new warnings
Docs updated if needed
### What & why
Adds new cli flag to `generate` subcommand: `--preview`/`-p` which prints scheme to `stdout` and then early returns. This is used in `Services/Colors.load()`.
Adds short versions of existing flags (`--image-path` -> `-i`).
The "preview" state on the QML side was lazy and wasn't really a preview at all. It was effectively performing all operations for setting a wallpaper every time `currentIndex` updated in the wallpaper carousel, most importantly it was writing the `${Paths.state}/scheme.json` file every time.
This is okay behavior, but wasteful. Due to how file watchers work by "attaching" to a specific file, when said file is overwritten by an atomic write (which we always use), then the original file no longer exists and the current watcher needs to be killed only for a new one to be spawned to watch the new file.
This PR solves this by loading the color scheme through `stdout` and only once the user sets/accepts the selected wallpaper will it write the scheme file, and if the user cancels then no write will happen.
### Related issue
_No response_
### Type
Bug fix
### Tested
- [x] Build succeeds
- [x] Existing tests pass
- [x] Manually verified
### Breaking changes?
_No response_
### Checklist
- [ ] CI passes (format, lint, typecheck)
- [x] Clean commits
- [x] No new warnings
- [x] Docs updated if needed
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
What & why
Adds new cli flag to
generatesubcommand:--preview/-pwhich prints scheme tostdoutand then early returns. This is used inServices/Colors.load().Adds short versions of existing flags (
--image-path->-i).The "preview" state on the QML side was lazy and wasn't really a preview at all. It was effectively performing all operations for setting a wallpaper every time
currentIndexupdated in the wallpaper carousel, most importantly it was writing the${Paths.state}/scheme.jsonfile every time.This is okay behavior, but wasteful. Due to how file watchers work by "attaching" to a specific file, when said file is overwritten by an atomic write (which we always use), then the original file no longer exists and the current watcher needs to be killed only for a new one to be spawned to watch the new file.
This PR solves this by loading the color scheme through
stdoutand only once the user sets/accepts the selected wallpaper will it write the scheme file, and if the user cancels then no write will happen.Related issue
No response
Type
Bug fix
Tested
Breaking changes?
No response
Checklist
Works perfectly 😇
Reviewed python code. lgtm.