Skip to content

Add option to skip confirmation for power actions (Sys Plugin)#4273

Merged
onesounds merged 5 commits intoFlow-Launcher:devfrom
onesounds:20250220_SkipConfirm
Feb 21, 2026
Merged

Add option to skip confirmation for power actions (Sys Plugin)#4273
onesounds merged 5 commits intoFlow-Launcher:devfrom
onesounds:20250220_SkipConfirm

Conversation

@onesounds
Copy link
Contributor

@onesounds onesounds commented Feb 20, 2026

Description

This PR adds a new setting option that allows users to skip the confirmation dialog when executing power-related commands such as Shutdown, Restart, Restart with Advanced, Logoff. Default is off.

image

Changes

  • Added SkipPowerActionConfirmation property to Settings.cs.
  • Implemented the toggle UI in SysSettings.xaml.
  • Updated Main.cs to check the setting before showing the MessageBox.
  • Integrated with the existing localization system using flowlauncher_plugin_sys_skip_confirm.

Summary by cubic

Adds a setting to skip confirmation dialogs for shutdown, restart (including advanced), and logoff to remove repeated prompts. Context: Sys plugin settings UI with default off; closes the feature request to allow skipping power action confirmations.

  • New Features

    • New setting and checkbox: Settings.SkipPowerActionConfirmation (default false) in SysSettings.xaml with localized label (flowlauncher_plugin_sys_skip_confirm).
    • When enabled, all power actions bypass the MessageBox; shutdown/restart still save settings before exit.
  • Refactors

    • Made Commands an instance method; added braces and cleaned power action handlers.
    • Optimized SkipPowerActionConfirmation setter to avoid redundant OnPropertyChanged; minor code quality and style fixes.

Written for commit a99b839. Summary will update on new commits.

@onesounds onesounds self-assigned this Feb 20, 2026
@github-actions github-actions bot added this to the 2.1.0 milestone Feb 20, 2026
@onesounds onesounds added the enhancement New feature or request label Feb 20, 2026
@prlabeler prlabeler bot added the bug Something isn't working label Feb 20, 2026
@gitstream-cm
Copy link

gitstream-cm bot commented Feb 20, 2026

🥷 Code experts: jjw24, Jack251970

jjw24, Jack251970 have most 👩‍💻 activity in the files.
jjw24, Jack251970 have most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml

Activity based on git-commit:

jjw24 Jack251970
FEB
JAN
DEC
NOV
OCT
SEP 5 additions & 0 deletions

Knowledge based on git-blame:
jjw24: 94%
Jack251970: 6%

Plugins/Flow.Launcher.Plugin.Sys/Main.cs

Activity based on git-commit:

jjw24 Jack251970
FEB 1 additions & 1 deletions
JAN
DEC
NOV
OCT 25 additions & 22 deletions
SEP 60 additions & 62 deletions

Knowledge based on git-blame:
jjw24: 86%
Jack251970: 14%

Plugins/Flow.Launcher.Plugin.Sys/Settings.cs

Activity based on git-commit:

jjw24 Jack251970
FEB
JAN
DEC
NOV
OCT
SEP 3 additions & 3 deletions

Knowledge based on git-blame:
jjw24: 98%
Jack251970: 2%

Plugins/Flow.Launcher.Plugin.Sys/SettingsViewModel.cs

Activity based on git-commit:

jjw24 Jack251970
FEB
JAN
DEC
NOV
OCT
SEP 2 additions & 7 deletions

Knowledge based on git-blame:
jjw24: 71%
Jack251970: 29%

Plugins/Flow.Launcher.Plugin.Sys/SysSettings.xaml

Activity based on git-commit:

jjw24 Jack251970
FEB
JAN
DEC
NOV
OCT
SEP

Knowledge based on git-blame:
jjw24: 100%

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

@gitstream-cm
Copy link

gitstream-cm bot commented Feb 20, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

1 similar comment
@gitstream-cm
Copy link

gitstream-cm bot commented Feb 20, 2026

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@onesounds onesounds requested a review from Copilot February 20, 2026 08:25
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="Plugins/Flow.Launcher.Plugin.Sys/Settings.cs">

<violation number="1" location="Plugins/Flow.Launcher.Plugin.Sys/Settings.cs:133">
P2: Raise property-changed notifications in the setter so UI bindings update when the setting changes programmatically.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A new feature is added to the Sys plugin that allows users to skip confirmation prompts for power actions (shutdown, restart, log off). This includes a new boolean setting property, UI checkbox control, updated language resource, and refactored confirmation logic in the power action handler.

Changes

Cohort / File(s) Summary
Language Resources
Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml
Added new resource string for the skip-confirmation setting label.
Settings & Configuration
Plugins/Flow.Launcher.Plugin.Sys/Settings.cs, Plugins/Flow.Launcher.Plugin.Sys/SysSettings.xaml
Introduced new SkipPowerActionConfirmation boolean property with property-changed notification; added checkbox control in settings UI bound to this property.
Power Action Logic
Plugins/Flow.Launcher.Plugin.Sys/Main.cs
Changed Commands method from static to instance; refactored confirmation flow to check the skip setting, either auto-accepting or prompting the user before executing power actions.

Sequence Diagram

sequenceDiagram
    participant User
    participant UI as SysSettings UI
    participant Settings
    participant Main as Commands Handler
    participant OS as Operating System

    User->>UI: Toggle skip confirmation checkbox
    UI->>Settings: Set SkipPowerActionConfirmation
    Settings->>Settings: OnPropertyChanged()

    User->>Main: Trigger shutdown/restart/logoff action
    Main->>Settings: Check SkipPowerActionConfirmation value
    
    alt Skip is enabled
        Settings-->>Main: true
        Main->>Main: Auto-accept (skip prompt)
    else Skip is disabled
        Settings-->>Main: false
        Main->>User: Show confirmation dialog
        User->>Main: Respond Yes/No
    end
    
    Main->>OS: Execute power action
    OS->>OS: Perform shutdown/restart/logoff
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • jjw24
  • VictoriousRaptor
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding an option to skip confirmation dialogs for power actions in the Sys Plugin.
Description check ✅ Passed The description is well-detailed and directly related to the changeset, explaining the new setting, UI implementation, code changes, and integration with localization.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs (1)

225-225: Indentation inconsistency inside the Shutdown and Restart action lambdas.

Two formatting issues introduced by this PR:

  1. Shutdown (line 225): The closing } of the lambda is indented 24 spaces, while the matching opening { (line 208) sits at 20 spaces — it should align with the lambda opener.

  2. Restart (lines 241–249): The if block and return true; are indented 28 spaces, 4 more than the equivalent blocks in Shutdown and Restart Advanced (both 24 spaces), creating visual inconsistency across otherwise identical patterns.

♻️ Proposed fix (indentation only)

Shutdown lambda closing brace:

-                        return true;
-                        }
+                        return true;
+                    }

Restart lambda body:

-                            if (result == MessageBoxResult.Yes)
-                            {
-                                Context.API.SaveAppAllSettings();
-                                if (EnableShutdownPrivilege())
-                                    PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
-                                else
-                                    Process.Start("shutdown", "/r /t 0");
-                            }
-                            return true;
+                        if (result == MessageBoxResult.Yes)
+                        {
+                            Context.API.SaveAppAllSettings();
+                            if (EnableShutdownPrivilege())
+                                PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_REBOOT, REASON);
+                            else
+                                Process.Start("shutdown", "/r /t 0");
+                        }
+                        return true;

Also applies to: 234-250

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs` at line 225, The closing brace and
inner block indentation for the Shutdown and Restart action lambdas are
inconsistent; locate the lambda passed to the Shutdown action (the lambda that
opens at the Shutdown handler) and align its closing brace with the lambda
opener (match indentation of the opening `{`), and for the Restart action lambda
(and Restart Advanced lambda), reduce the inner `if` block and the `return
true;` indentation by four spaces so they match the Shutdown/Restart Advanced
pattern; update indentation only—do not change logic or other tokens.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml`:
- Around line 6-8: Add the missing localization key
flowlauncher_plugin_sys_skip_confirm to every non-English language resource file
so the {DynamicResource flowlauncher_plugin_sys_skip_confirm} lookup in
SysSettings.xaml resolves; for each target language file (ar, cs, da, de, es,
es-419, fr, he, it, ja, ko, nb, nl, pl, pt-br, pt-pt, ru, sk, sr, sr-Cyrl-RS,
tr, uk-UA, vi, zh-cn, zh-tw) insert a <system:String
x:Key="flowlauncher_plugin_sys_skip_confirm">…</system:String> entry (use the
English text as a placeholder or add proper translations) matching the key used
in en.xaml so resource binding succeeds.

In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs`:
- Around line 286-295: Log off currently skips saving app settings before
calling ExitWindowsEx when _settings.SkipPowerActionConfirmation is true,
risking data loss; update the LogOff flow (the block that determines
MessageBoxResult and calls PInvoke.ExitWindowsEx) to call
Context.API.SaveAppAllSettings() immediately before invoking
PInvoke.ExitWindowsEx (mirroring Shutdown/Restart/RestartAdvanced behavior) so
settings are persisted regardless of SkipPowerActionConfirmation.

In `@Plugins/Flow.Launcher.Plugin.Sys/Settings.cs`:
- Around line 127-135: The SkipPowerActionConfirmation property's setter in
Settings currently only assigns the backing field and must notify subscribers;
update the setter in class Settings (property SkipPowerActionConfirmation) to
check for value change (compare incoming value to _skipPowerActionConfirmation)
and after assigning call OnPropertyChanged(nameof(SkipPowerActionConfirmation))
so UI bindings receive updates (BaseModel implements INotifyPropertyChanged).

---

Nitpick comments:
In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs`:
- Line 225: The closing brace and inner block indentation for the Shutdown and
Restart action lambdas are inconsistent; locate the lambda passed to the
Shutdown action (the lambda that opens at the Shutdown handler) and align its
closing brace with the lambda opener (match indentation of the opening `{`), and
for the Restart action lambda (and Restart Advanced lambda), reduce the inner
`if` block and the `return true;` indentation by four spaces so they match the
Shutdown/Restart Advanced pattern; update indentation only—do not change logic
or other tokens.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Sys plugin setting to optionally bypass the confirmation dialog for power actions (shutdown/restart/advanced restart/logoff), reducing friction for users who frequently use these commands while keeping the default behavior unchanged.

Changes:

  • Introduces Settings.SkipPowerActionConfirmation and exposes it in the Sys settings UI.
  • Updates power-action command handlers to conditionally skip the confirmation MessageBox.
  • Adds an English localization entry for the new setting label.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Sys/SysSettings.xaml Adds a new checkbox setting and adjusts grid layout rows.
Plugins/Flow.Launcher.Plugin.Sys/SettingsViewModel.cs Minor formatting-only change.
Plugins/Flow.Launcher.Plugin.Sys/Settings.cs Adds new boolean setting backing the UI/behavior change.
Plugins/Flow.Launcher.Plugin.Sys/Main.cs Applies the setting to bypass confirmation prompts in power actions.
Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml Adds EN resource string for the new checkbox label.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Add braces for better readability in shutdown/reboot logic (Main.cs).
- Prevent redundant OnPropertyChanged calls in _skipPowerActionConfirmation setter (Settings.cs).
@onesounds
Copy link
Contributor Author

@copilot @coderabbitai @cubic-dev-ai Fixed. Check the code please.

@cubic-dev-ai
Copy link

cubic-dev-ai bot commented Feb 20, 2026

@copilot @coderabbitai @cubic-dev-ai Fixed. Check the code please.

@onesounds I have started the AI code review. It will take a few minutes to complete.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 20, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the changed files to review the implementation

echo "=== Main.cs ==="
cat Plugins/Flow.Launcher.Plugin.Sys/Main.cs

echo -e "\n\n=== Settings.cs ==="
cat Plugins/Flow.Launcher.Plugin.Sys/Settings.cs

echo -e "\n\n=== SysSettings.xaml ==="
cat Plugins/Flow.Launcher.Plugin.Sys/SysSettings.xaml

echo -e "\n\n=== en.xaml ==="
cat Plugins/Flow.Launcher.Plugin.Sys/Languages/en.xaml

echo -e "\n\n=== SettingsViewModel.cs ==="
cat Plugins/Flow.Launcher.Plugin.Sys/SettingsViewModel.cs

Length of output: 38986


@onesounds The code looks great! ✅ I've reviewed all the changes and the implementation is solid:

What's working well:

  1. Settings.cs - Property correctly implemented with backing field and OnPropertyChanged() notification
  2. SysSettings.xaml - Checkbox properly bound and positioned in the UI grid structure
  3. en.xaml - Localization key added correctly
  4. Main.cs - The skip confirmation logic is properly implemented for all four power actions:
    • Shutdown ✓
    • Restart ✓
    • Restart With Advanced Boot Options ✓
    • Log Off/Sign Out ✓

The conditional pattern is consistent:

MessageBoxResult result = _settings.SkipPowerActionConfirmation
    ? MessageBoxResult.Yes
    : Context.API.ShowMsgBox(...);

Minor observation:

There's a small indentation inconsistency in the Log Off action block (lines 249-254 in Main.cs) - the if statement is indented further than the MessageBoxResult result line above it. Not a functional issue, just a style note.

The implementation correctly handles the feature - when the setting is enabled, it bypasses the confirmation dialog entirely. Nice work! 🎉

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs`:
- Around line 286-295: In Main.cs inside the Log Off handling block (the code
that sets MessageBoxResult result and calls PInvoke.ExitWindowsEx), add a call
to Context.API.SaveAppAllSettings() immediately before
PInvoke.ExitWindowsEx(EXIT_WINDOWS_FLAGS.EWX_LOGOFF, REASON) so settings are
saved whether SkipPowerActionConfirmation is true or user confirmed; keep the
SaveAppAllSettings() invocation inside the same if (result ==
MessageBoxResult.Yes) branch (and ensure the SkipPowerActionConfirmation path
also reaches that call).

@onesounds onesounds removed bug Something isn't working Code Refactor labels Feb 20, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs (1)

259-264: Minor: use explicit MessageBoxResult type for consistency.

Lines 209 (Shutdown), 234 (Restart), and 286 (Log Off) all declare MessageBoxResult result = …. Line 259 (Restart Advanced) uses var, which is a small stylistic inconsistency within the same set of four parallel blocks.

♻️ Proposed fix
-                        var result = _settings.SkipPowerActionConfirmation
+                        MessageBoxResult result = _settings.SkipPowerActionConfirmation
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs` around lines 259 - 264, The
restart-advanced confirmation uses implicit typing for the result which is
inconsistent with the other blocks; change the declaration to an explicit
MessageBoxResult (e.g., MessageBoxResult result =) when assigning from
_settings.SkipPowerActionConfirmation ? MessageBoxResult.Yes :
Context.API.ShowMsgBox(Localize.flowlauncher_plugin_sys_dlgtext_restart_computer_advanced(),
Localize.flowlauncher_plugin_sys_restart_computer(), MessageBoxButton.YesNo,
MessageBoxImage.Warning) so it matches the other declarations (see
Shutdown/Restart/LogOff blocks that use MessageBoxResult result).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs`:
- Around line 286-295: The Log Off branch omits saving settings and has extra
indentation; update the lambda handling Log Off (the block using
_settings.SkipPowerActionConfirmation, MessageBoxResult, and
PInvoke.ExitWindowsEx with EXIT_WINDOWS_FLAGS.EWX_LOGOFF and REASON) to call
Context.API.SaveAppAllSettings() immediately before invoking
PInvoke.ExitWindowsEx, and reflow the if/result/return lines to match the
indentation style used by the other power-action blocks
(Shutdown/Restart/Restart Advanced) so the if and the final return true; align
with the surrounding lambda body.

---

Nitpick comments:
In `@Plugins/Flow.Launcher.Plugin.Sys/Main.cs`:
- Around line 259-264: The restart-advanced confirmation uses implicit typing
for the result which is inconsistent with the other blocks; change the
declaration to an explicit MessageBoxResult (e.g., MessageBoxResult result =)
when assigning from _settings.SkipPowerActionConfirmation ? MessageBoxResult.Yes
:
Context.API.ShowMsgBox(Localize.flowlauncher_plugin_sys_dlgtext_restart_computer_advanced(),
Localize.flowlauncher_plugin_sys_restart_computer(), MessageBoxButton.YesNo,
MessageBoxImage.Warning) so it matches the other declarations (see
Shutdown/Restart/LogOff blocks that use MessageBoxResult result).

@prlabeler prlabeler bot added bug Something isn't working Code Refactor labels Feb 21, 2026
@Jack251970 Jack251970 removed bug Something isn't working Code Refactor labels Feb 21, 2026
Copy link
Member

@Jack251970 Jack251970 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@onesounds onesounds enabled auto-merge February 21, 2026 07:00
@onesounds onesounds merged commit 11e0f8c into Flow-Launcher:dev Feb 21, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants