Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ a section is written.

## [Unreleased]

## [0.5.0] - 2026-11-16

Windows' Startup list starts the watcher now, with a switch in Settings,
instead of a scheduled task that Office's updates could end; the startup
commands are renamed, and every release file is attested.

### Added

- Each release file comes with GitHub's attestation that the release workflow
Expand All @@ -26,14 +32,20 @@ a section is written.
### Changed

- Windows starts the watcher at logon from your `Run` key instead of a
scheduled task; an upgrade removes the old task.
scheduled task, a few seconds later than the task did. Office's updates
ended what the task started, the watcher among them, and spared what the
`Run` key started over a month of them. An upgrade removes the old task and
keeps the configuration it named.
- `install-task` and `uninstall-task` are now `add-to-startup` and
`remove-from-startup`. The old names work until 1.0.0; `--delay` is gone.
`remove-from-startup`. The old names work until 1.0.0.

### Removed

- The 15-second delay after logon, and `--delay` with it: accepted and
ignored until 1.0.0.

### Fixed

- Office's updates no longer stop the watcher. They ended whatever a
scheduled task had started, the watcher included.
- `purge` removes its folders even when they are marked read-only, as a
folder copied back from a OneDrive backup is.

Expand Down Expand Up @@ -205,7 +217,8 @@ and when it stops, on Windows' own signal that a game is running.
including the scheduled tasks a program that needs administrator rights
requires, and a Windows power plan.

[Unreleased]: https://github.com/Geeooff/GameModeExecutor/compare/v0.4.0...HEAD
[Unreleased]: https://github.com/Geeooff/GameModeExecutor/compare/v0.5.0...HEAD
[0.5.0]: https://github.com/Geeooff/GameModeExecutor/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/Geeooff/GameModeExecutor/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/Geeooff/GameModeExecutor/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/Geeooff/GameModeExecutor/compare/v0.1.0...v0.2.0
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "game-mode-executor"
version = "0.4.0"
version = "0.5.0"
authors = ["Geoffrey Vancoetsem"]
edition = "2024"
# Let chains, stable since 1.88.
Expand Down Expand Up @@ -78,6 +78,9 @@ windows = { version = "0.62", features = [
# reads, without what PDH keeps for the process's life (Lot 16).
"Win32_System_Performance",
"Win32_System_SystemInformation",
# ITaskService: the configuration an earlier version's logon task
# passed, read before `add-to-startup` removes that task (Lot 19).
"Win32_System_TaskScheduler",
"Win32_System_Threading",
"Win32_System_WinRT",
] }
Expand Down
5 changes: 5 additions & 0 deletions docs/design/13-updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ dictates anyway and it would exist for symmetry alone. The cost of that
freedom is a rule, in `AGENTS.md`: a change to any of those commands is
verified on all three paths.

*Since [Lot 19](19-startup-list.md), in 0.5.0: `add-to-startup` and
`remove-from-startup` in place of `install-task` and `uninstall-task`, the
watcher started through Explorer rather than its task, and the failure path
runs `add-to-startup` rather than `schtasks /Run`. Noted 2026-11-16.*

## What the release answers, measured 2026-09-18 against `v0.1.0`

| Request | Answer |
Expand Down
72 changes: 67 additions & 5 deletions docs/design/19-startup-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ reason: Office's updates end what a logon task started, and spare what the
- [x] `startup`: the `Run` value written and removed, the watcher started through Explorer, `task` reduced to removing a 0.4 task — 2026-11-16
- [x] `add-to-startup` and `remove-from-startup`, the old names as hidden aliases; the package, the zip's updater and `purge` on them — 2026-11-16
- [x] The user pages, the reference, the changelog — 2026-11-16
- [x] Explorer starts the watcher from a person's terminal and from the package's action — 2026-11-16, below; from the zip's shell at the 0.5.0 update
- [x] Explorer starts the watcher from a person's terminal and from the package's action — 2026-11-16, below
- [ ] Explorer starts it from the zip's shell, at the 0.5.0 update
- [x] The 0.4 task removed by `add-to-startup`; `uninstall-task` works as an alias — 2026-11-16, below
- [ ] An upgrade from the published 0.4.0, by the package and by the zip
- [x] An upgrade from the published 0.4.0 by the package, a configuration path of the task's kept — 2026-11-16, below
- [ ] An upgrade from the published 0.4.0 by the zip, at the 0.5.0 update
- [x] The switch: off, then a logon; on again — 2026-11-16, below
- [x] `remove-from-startup` takes the switch's entry too; `purge` lists the entry and no task — 2026-11-16, below
- [ ] `purge` carried out, at the next full purge
Expand Down Expand Up @@ -103,8 +105,10 @@ Two edge cases, neither leaving the program unstartable:
shell's `schtasks /Run` finds no task. The old version's uninstall would
not know the value; the next upgrade cleans it.
- **A 0.4 zip copy whose update fails** puts its old executables back and
registers the task again beside the value: two starts at logon, and the
single-instance mutex ends the second.
runs its own `install-task`, its task intact. *A second case stood here,
the task registered again beside the value; it cannot happen: 0.4's shell
falls back only when unpacking or copying threw, before the new binary
ran. Corrected 2026-11-16, from the review below.*

The verbs: `install-task` names something it would no longer do. A new
name, with `install-task` and `uninstall-task` kept as aliases for the
Expand Down Expand Up @@ -156,11 +160,59 @@ The maintainer took the lot and the recommendation, and named the verbs.
- **The migration lives in the commands.** `add-to-startup` removes the
0.4 task after writing the value; `remove-from-startup` and `purge`
remove one left over. That removal stays past 1.0.0: it protects a copy
that skips versions.
that skips versions. Before it goes, the task's `--config` is read,
through Task Scheduler's interface, and becomes the value's, so a path
chosen with 0.4's `install-task` survives the upgrade, as
[Lot 8](08-distribution.md) promised (added after the review below).
- **No `Registry` row**: the program stays the one writer of the value.
- **Failing over the 0.4 task is a `warn`**, in `add-to-startup` and in
`remove-from-startup` alike: neither an install nor an uninstall rolls
back for it.
- **A failure to start the watcher now is a `warn`**, not an error: the
install goes on, and the next logon starts it.

## Reviewed before 0.5.0, 2026-11-16

A second agent, asked to argue against the release, read the branch
against `AGENTS.md`. Taken:

- **The configuration a 0.4 task named was lost on upgrade**: the value
took the default path. Now read from the task, as above.
- **The `SAFETY` comment of the Explorer call was untrue**: a failure keeps
the failing object's error information, which was read and released
after `CoUninitialize`. The error is now text before COM is let go.
- **A kept entry was started unchecked.** One naming a missing file would
have had Explorer show a dialog; it is now said at `warn` and not
started. One naming another copy is said, and started, since Windows
starts that one at logon.
- **The switch was described as stronger than it is**: an install or an
update starts the watcher once even when it is off. Said so in the
module and the reference.
- **`remove()`** missed an empty value and a switch left without its
value, and the switch's removal was at `debug`; one `info` line now says
what went. `install-task --delay` exits 2 no more: accepted and ignored
until 1.0.0, as `run --hidden` is.
- The changelog claimed a fix not yet seen on the watcher itself; it now
says what was measured. The test scratch folder asserts it stays under
the temporary directory before emptying it. *How it works* had the
watcher at about 2 MB, a figure taken at start; the 2.7 MB of
[Lot 16](16-footprint.md) after twenty minutes is beside it now.

Not taken: running 0.4's zip shell by hand before the tag. The shell is
0.4's, unchanged, and passes `install-task` alone, which a test pins; the
0.5.0 update will exercise it for real, as 0.4.0's did in
[Lot 17](17-log-rotation.md).

Risks named, not measured:

- A hung Explorer would hold the package's deferred action, since a
cross-process call has no timeout.
- A rollback after `AddToStartup` finds the new watcher holding its
executable, so the old file comes back at the next restart. 0.4's start
through the task had the same exposure.
- Without Explorer, asking for the shell's window list starts its
registered server before it fails.

## Measured in the field, 2026-11-16

On the maintainer's machine, with the branch's release build (`54802623`),
Expand All @@ -186,6 +238,16 @@ page:
logon, no watcher. Turned on at 15:48: `00` and zeros, and at the next
logon the watcher started 7 s after Explorer, its child. The value itself
never changed: the switch is Windows' alone, as the module keeps it.
- **An upgrade from the published 0.4.0**, after the review, with the
0.5.0 package built from the release commit (`5ddf2313`). The published
0.4.0 installed at 16:29:03 registered its task and started its watcher;
`install-task --force --config` pointed the task at a copy of the
configuration, `config-test.toml`. The 0.5.0 package at 16:29:24: 0.4.0's
`stop --handover`, no `UnregisterTask`, *Configuration kept*, the task's
configuration read (*… names this configuration, so the startup entry
takes it*), the value written with `config-test.toml`, the task removed,
*Watcher started through Explorer*, 0.5.0 starting, its parent
`explorer.exe`. `add-to-startup --force` then put the default path back.
- **Removal**, from the maintainer's terminal at 15:51: `remove-from-startup`
removed the value and the switch's entry, which was then gone;
`add-to-startup` put the value back. `purge`, answered no, listed *remove
Expand Down
2 changes: 1 addition & 1 deletion docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Measured on a gaming PC in September 2026, private memory (Task Manager's

| When | Processor | Memory |
| --- | --- | --- |
| Waiting for a game | 0.03 % of one core | about 2 MB |
| Waiting for a game | 0.03 % of one core | about 2 MB at start, 2.7 MB after twenty minutes *(the second figure added 2026-11-16)* |
| During a game | nothing measurable | unchanged |
| Naming a game from the graphics card | | 0.25 MB, once |
| The menu, first opened | | about 1 MB, once |
Expand Down
6 changes: 3 additions & 3 deletions docs/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for the reasons, the [design record](design/).
| `trigger start\|stop` | Run one event's commands now, to test them. |
| `validate` | Check the configuration; exits 3 or 4 on a problem. |
| `init [--force]` | Write the starter configuration to `%APPDATA%\GameModeExecutor`; an existing one is kept unless `--force`. |
| `add-to-startup [--force]` | Add `gamemode-executorw.exe` to the programs Windows starts at logon, remove the logon task of a version up to 0.4, and have Explorer start the watcher. An existing entry is kept unless `--force`. |
| `add-to-startup [--force]` | Add `gamemode-executorw.exe` to the programs Windows starts at logon, with the configuration the logon task of a version up to 0.4 named if there was one, remove that task, and have Explorer start the watcher. An existing entry is kept unless `--force`. |
| `remove-from-startup` | Remove that entry, its switch in Settings, and the logon task of a version up to 0.4. |
| `update [--check]` | Look for a newer release on GitHub; without `--check`, download, verify against `SHA256SUMS.txt` and install it. The only command that connects to anything. |
| `stop [--handover]` | Stop the running watcher as *Quit* does, and wait for it to go. With `--handover`, an open game session is left to the next watcher, nothing run. |
Expand All @@ -35,7 +35,7 @@ else `%APPDATA%\GameModeExecutor\config.toml`.
The setup commands (`init`, `add-to-startup`, `remove-from-startup`, `stop`)
log what they did under `setup`, `update` under `update`. `install-task` and
`uninstall-task`, the old names of the startup commands, still work until
1.0.0; `--delay` went with the task.
1.0.0, and `--delay` is accepted and ignored until then.

## Configuration

Expand Down Expand Up @@ -169,7 +169,7 @@ the file at once; lines never interleave, since each is one append.
| Log | `%LOCALAPPDATA%\GameModeExecutor\logs\` | disposable |
| Session marker | `%LOCALAPPDATA%\GameModeExecutor\pending-stop-actions` | a game session not yet closed. `state = open` while a watcher holds it, `left` once one stopped and left it to the next start; `open` found at a start means that watcher ended without stopping. |
| Fault marker | `%LOCALAPPDATA%\GameModeExecutor\configuration-fault` | the configuration was unusable when last read, so the next usable read says the fault is over |
| Startup entry | `GameModeExecutor` under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` | the watcher's and the configuration's absolute paths; removed on uninstall, kept on upgrade. Its switch in Settings is Windows': turned off, it stays off. |
| Startup entry | `GameModeExecutor` under `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` | the watcher's and the configuration's absolute paths; removed on uninstall, kept on upgrade. Its switch in Settings is Windows': turned off, the watcher no longer starts at logon, though an install or an update still starts it once. |
| Updates | `%LOCALAPPDATA%\GameModeExecutor\updates\` | a release being installed; emptied at the next start, the installer's log kept if the update failed |

## Building and releasing
Expand Down
34 changes: 25 additions & 9 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ pub enum Command {
/// For an unattended instance use `gamemode-executorw.exe`, which is the
/// same watcher with no console at all. `add-to-startup` adds that one.
Run {
/// Accepted and ignored. A task registered before this binary had a
/// windowless twin still passes it, and refusing it would stop that
/// task dead at the next logon.
/// Accepted and ignored. A logon task registered before this binary
/// had a windowless twin still passes it, until `add-to-startup`
/// removes that task, and refusing it would stop the task dead at the
/// next logon.
#[arg(long, hide = true)]
hidden: bool,
},
Expand Down Expand Up @@ -96,6 +97,10 @@ pub enum Command {
/// Replace an entry that is already there.
#[arg(long)]
force: bool,
/// Accepted and ignored until 1.0.0, with the old name: the logon
/// task's delay, which went with the task.
#[arg(long, hide = true)]
delay: Option<String>,
},
/// Remove the watcher from the programs Windows starts at logon.
#[command(alias = "uninstall-task")]
Expand Down Expand Up @@ -157,16 +162,23 @@ pub fn run(cli: Cli, console: bool) -> Result<()> {
config::write_starter(&path, force)?;
return Ok(());
}
Some(Command::AddToStartup { force }) => {
Some(Command::AddToStartup { force, .. }) => {
setup_logging(cli.config.as_deref(), cli.log_level.as_deref(), console)?;
let path = resolve_config_path(cli.config)?;
// A path given now wins; then the one an earlier version's logon
// task passed, so an upgrade keeps it; then the default.
let path = match cli.config {
Some(path) => path,
None => match task::configuration() {
Some(path) => path,
None => resolve_config_path(None)?,
},
};
startup::add(&path, force)?;
return Ok(());
}
Some(Command::RemoveFromStartup) => {
setup_logging(cli.config.as_deref(), cli.log_level.as_deref(), console)?;
startup::remove()?;
return task::remove_leftover();
return startup::remove();
}
Some(Command::Stop { handover }) => {
setup_logging(cli.config.as_deref(), cli.log_level.as_deref(), console)?;
Expand Down Expand Up @@ -637,7 +649,7 @@ mod tests {
));
assert!(matches!(
parse(&["add-to-startup", "--force"]).command,
Some(Command::AddToStartup { force: true })
Some(Command::AddToStartup { force: true, .. })
));
assert!(matches!(
parse(&["remove-from-startup"]).command,
Expand All @@ -660,7 +672,11 @@ mod tests {
fn the_old_names_of_the_startup_commands_still_work_unoffered() {
assert!(matches!(
parse(&["install-task"]).command,
Some(Command::AddToStartup { force: false })
Some(Command::AddToStartup { force: false, .. })
));
assert!(matches!(
parse(&["install-task", "--delay", "1m", "--force"]).command,
Some(Command::AddToStartup { force: true, .. })
));
assert!(matches!(
parse(&["uninstall-task"]).command,
Expand Down
2 changes: 1 addition & 1 deletion src/purge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ pub fn discover(config: Option<&config::Config>, config_path: &Path) -> Layout {
let log_dir = config.map_or_else(config::default_log_dir, |config| config.general.log_dir());
Layout {
watcher_running: win::SingleInstance::is_held(service::INSTANCE),
startup_entry: startup::entry().is_some(),
startup_entry: startup::exists(),
task_registered: task::exists(),
config_candidates: candidates,
log_dir,
Expand Down
Loading