launcher: option to close the terminal after a clean exit #1869

Manually merged
github merged 1 commit from gh-pr/1869/head into gh-pr/1869/base 2026-11-26 10:07:31 +00:00
Owner

@⁠MrBigBritches on GitHub · 2026-10-23 23:07 UTC · original
MrBigBritches:launcher-close-terminal → main · +86 −114 · 4 files · 1 commits · merged 2026-10-24 18:06 UTC

Adds a "Close terminal window automatically" checkbox to the General section of the launcher's Global settings. When it's enabled, the terminal window, which is opened when a game is started from the launder, will close automatically iff the emulator exits cleanly (exit code 0). If a clean exit does not occur, the window stays open so the output can still be read.

Behaviour

Platform Option off (default) Option on
Windows cmd /K keeps the window open, as before The /K command ends in && exit, so cmd closes only after exit code 0; otherwise the prompt stays open with the output
Linux The script ends with "Press any key..." After exit code 0 the script exits before the prompt; otherwise it prints Exited with code N. and waits for a key

A normal exit (closing the emulator window) ends with std::quick_exit(0), so it counts as clean. Fatal errors exit with a non-zero code and keep the window open.

Details

  • The setting is stored with the launcher's own settings (close_terminal_on_clean_exit), next to the add-ons folder. It isn't saved per game and isn't part of game-settings import/export.
  • It's shown only in Global settings and hidden in per-game settings.
  • It's off by default, so existing setups behave as before.

Testing

  • Windows, option on: close the game window; the terminal closes.
  • Windows, option on: emulator exits with an error; the terminal stays open.
  • Windows, option off: the terminal stays open, as before.
image
**@⁠MrBigBritches** on GitHub · 2026-10-23 23:07 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869) `MrBigBritches:launcher-close-terminal` → `main` · +86 −114 · 4 files · 1 commits · merged 2026-10-24 18:06 UTC Adds a **"Close terminal window automatically"** checkbox to the **General** section of the launcher's **Global settings**. When it's enabled, the terminal window, which is opened when a game is started from the launder, will close automatically iff the emulator exits cleanly (exit code 0). If a clean exit does not occur, the window stays open so the output can still be read. ### Behaviour | Platform | Option off (default) | Option on | |---|---|---| | Windows | `cmd /K` keeps the window open, as before | The `/K` command ends in `&& exit`, so `cmd` closes only after exit code 0; otherwise the prompt stays open with the output | | Linux | The script ends with "Press any key..." | After exit code 0 the script exits before the prompt; otherwise it prints `Exited with code N.` and waits for a key | A normal exit (closing the emulator window) ends with `std::quick_exit(0)`, so it counts as clean. Fatal errors exit with a non-zero code and keep the window open. ### Details - The setting is stored with the launcher's own settings (`close_terminal_on_clean_exit`), next to the add-ons folder. It isn't saved per game and isn't part of game-settings import/export. - It's shown only in Global settings and hidden in per-game settings. - It's off by default, so existing setups behave as before. ### Testing - [x] Windows, option on: close the game window; the terminal closes. - [x] Windows, option on: emulator exits with an error; the terminal stays open. - [x] Windows, option off: the terminal stays open, as before. <img width="2201" height="1117" alt="image" src="https://github.com/user-attachments/assets/ed90b337-732f-49c0-ad8a-560cfa4c2017" />
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:07:28 +00:00
github manually merged commit 72e7e21052 into gh-pr/1869/base 2026-11-26 10:07:31 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-23 23:13 UTC · original · edited 2026-10-24 16:57 UTC

Review in Change Stack →

No actionable comments were generated in the recent review.

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 38c7204be1baaea91a1f4be2d557ddfddab1efe0 and 3027e1c33e361b1c3d2527fc808d295018f7dcb7.

📒 Files selected for processing: 1
  • src/launcher/src/configurationEditDialog.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Walkthrough

The launcher adds a global, default-false setting to close the terminal after a clean game exit. The setting appears in global settings, is saved and loaded with launcher preferences, and is copied into game configurations. Linux scripts and Windows launch commands use the setting to close the terminal after success while keeping it open after failure.

Suggested reviewers: pipe530

Priority: Low

Change: Feature

Merge Risk: Minimal · up to 3027e

The new option to close the terminal after a clean exit is off by default, and clearing global settings now restores that default. No remaining merge-blocking risk is evident.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 6 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: adding an option to close the terminal after a clean launcher exit.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description clearly explains the new launcher setting, its platform-specific behavior, storage scope, default state, and testing. It matches the changeset.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-23 23:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869#issuecomment-6376597555) · edited 2026-10-24 16:57 UTC <!-- coderabbit-ai-generated:v1 --> <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1869?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=3"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg?v=3" alt="Review in Change Stack →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. <details> <summary><strong>ℹ️ Recent review info</strong></summary> <dl> <dd> <details> <summary><strong>⚙️ Run configuration</strong></summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/6aaa53329614ee709b1b6fa5122598b252600d2e/.coderabbit.yaml>) - **Commit**: [6aaa533](<https://github.com/KytyPS5/KytyPS5/commit/6aaa53329614ee709b1b6fa5122598b252600d2e>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `ca0865c2-126c-4503-a476-e5ae694ad763` </dd> </dl> </details> <details> <summary><strong>📥 Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 38c7204be1baaea91a1f4be2d557ddfddab1efe0 and 3027e1c33e361b1c3d2527fc808d295018f7dcb7. </dd> </dl> </details> <details> <summary><strong>📒 Files selected for processing: 1</strong></summary> <dl> <dd> * `src/launcher/src/configurationEditDialog.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review. </dd> </dl> </details> <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> The launcher adds a global, default-false setting to close the terminal after a clean game exit. The setting appears in global settings, is saved and loaded with launcher preferences, and is copied into game configurations. Linux scripts and Windows launch commands use the setting to close the terminal after success while keeping it open after failure. **Suggested reviewers:** `pipe530` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <strong>Priority: <picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/priority-low-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Low</strong> <!-- change_assessment_commit:"3027e1c33e361b1c3d2527fc808d295018f7dcb7" --> **Change:** Feature <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>3027e</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `3027e` --> <!-- final_review_risk_coverage:{"sourceCommitId":"3027e1c33e361b1c3d2527fc808d295018f7dcb7","coveredCommitId":"3027e1c33e361b1c3d2527fc808d295018f7dcb7","kind":"reviewed"} --> The new option to close the terminal after a clean exit is off by default, and clearing global settings now restores that default. No remaining merge-blocking risk is evident. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 13.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 6 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title clearly and concisely describes the main change: adding an option to close the terminal after a clean launcher exit. | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description clearly explains the new launcher setting, its platform-specific behavior, storage scope, default state, and testing. It matches the changeset. | </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autofix</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1869)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>❤️ Share</strong></summary> <dl> <dd> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </dd> </dl> </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-23 23:13 UTC · original · reviewed

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Reset the close-terminal checkbox when clearing global… · configurationEditDialog.cpp:563

src/launcher/src/configurationEditDialog.cpp:563
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Reset the close-terminal checkbox when clearing global settings.

If a user selects Clear while this checkbox is checked, Init(default_info) does not change its state. Save then retains the preference instead of restoring its default. Set m_close_terminal_check to false in the global-settings branch of clear().


ℹ️ Review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 6aaa533296 and 38c7204be1baaea91a1f4be2d557ddfddab1efe0.

📒 Files selected for processing: 6
  • src/launcher/include/configuration.h
  • src/launcher/include/configurationEditDialog.h
  • src/launcher/include/configurationListWidget.h
  • src/launcher/src/configurationEditDialog.cpp
  • src/launcher/src/configurationListWidget.cpp
  • src/launcher/src/mainDialog.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-23 23:13 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869#pullrequestreview-5635406235) · **reviewed** <!-- coderabbit-ai-generated:v1 --> > [!CAUTION] > Some comments are outside the diff and can’t be posted inline due to GitHub limitations. > > **⚠️ Outside diff range comments (1)** > > <details> > <summary><strong>🟡 Minor</strong> · Reset the close-terminal checkbox when clearing global… · <code>configurationEditDialog.cpp:563</code></summary><blockquote> > <dl> > <dd> > > `src/launcher/src/configurationEditDialog.cpp:563` > **🎯 Functional Correctness** | **🟡 Minor** | **⚡ Quick win** > > **Reset the close-terminal checkbox when clearing global settings.** > > If a user selects Clear while this checkbox is checked, `Init(default_info)` does not change its state. Save then retains the preference instead of restoring its default. Set `m_close_terminal_check` to `false` in the global-settings branch of `clear()`. > > <!-- cr-comment:v1:86918b1e77c5692e568ba2b9 --> > > </dd> > </dl> > </blockquote></details> --- <details> <summary>ℹ️ Review info</summary> <dl> <dd> <details> <summary>⚙️ Run configuration</summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/6aaa53329614ee709b1b6fa5122598b252600d2e/.coderabbit.yaml>) - **Commit**: [6aaa533](<https://github.com/KytyPS5/KytyPS5/commit/6aaa53329614ee709b1b6fa5122598b252600d2e>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `ae89c719-5c30-4d74-a790-1b05e87db012` </dd> </dl> </details> <details> <summary>📥 Commits</summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 6aaa53329614ee709b1b6fa5122598b252600d2e and 38c7204be1baaea91a1f4be2d557ddfddab1efe0. </dd> </dl> </details> <details> <summary>📒 Files selected for processing: 6</summary> <dl> <dd> * `src/launcher/include/configuration.h` * `src/launcher/include/configurationEditDialog.h` * `src/launcher/include/configurationListWidget.h` * `src/launcher/src/configurationEditDialog.cpp` * `src/launcher/src/configurationListWidget.cpp` * `src/launcher/src/mainDialog.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </dd> </dl> </details> <!-- This is an auto-generated comment by CodeRabbit for review status --> <!-- coderabbit-review-publication v1 publication=0558a09d-c5b5-42a5-ae51-75778fcd18f7 attempt=f70652a9-7b79-4ccd-97aa-e8f9ec39d97c batch=1/1 -->
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-24 02:38 UTC · original

Question: Would it be more efficient to have the terminal window docked to the gui window, like ShadPS4 does it?

**@⁠Crispy81** on GitHub · 2026-10-24 02:38 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869#issuecomment-6378844837) Question: Would it be more efficient to have the terminal window docked to the gui window, like ShadPS4 does it?
Author
Owner

@⁠MrBigBritches on GitHub · 2026-10-24 03:23 UTC · original · edited 2026-10-24 04:14 UTC

Question: Would it be more efficient to have the terminal window docked to the gui window, like ShadPS4 does it?

That is outside the scope of this PR. I implemented this change because the launcher will not allow a game to start while the previous terminal window is open.

This seemed like the easiest, most straightforward option. It’s opt-in, so the existing behaviour is maintained.

**@⁠MrBigBritches** on GitHub · 2026-10-24 03:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869#issuecomment-6379271042) · edited 2026-10-24 04:14 UTC > Question: Would it be more efficient to have the terminal window docked to the gui window, like ShadPS4 does it? That is outside the scope of this PR. I implemented this change because the launcher will not allow a game to start while the previous terminal window is open. This seemed like the easiest, most straightforward option. It’s opt-in, so the existing behaviour is maintained.
Author
Owner

@⁠Crispy81 on GitHub · 2026-10-24 05:40 UTC · original

All good, I like this change. Just thought I'd ask about the docked terminal window.

**@⁠Crispy81** on GitHub · 2026-10-24 05:40 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1869#issuecomment-6380483837) All good, I like this change. Just thought I'd ask about the docked terminal window.
This discussion has been locked. Commenting is limited to contributors.
No description provided.