Add option to skip confirmation for power actions (Sys Plugin)#4273
Add option to skip confirmation for power actions (Sys Plugin)#4273onesounds merged 5 commits intoFlow-Launcher:devfrom
Conversation
|
🥷 Code experts: jjw24, Jack251970 jjw24, Jack251970 have most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: ✨ Comment |
|
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
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
There was a problem hiding this comment.
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-aiwith guidance or docs links (includingllms.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.
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughA 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
Sequence DiagramsequenceDiagram
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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:
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.Restart (lines 241–249): The
ifblock andreturn 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.
There was a problem hiding this comment.
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.SkipPowerActionConfirmationand 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).
|
@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. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 38986
What's working well:
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 The implementation correctly handles the feature - when the setting is enabled, it bypasses the confirmation dialog entirely. Nice work! 🎉 |
There was a problem hiding this comment.
🤖 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).
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Plugins/Flow.Launcher.Plugin.Sys/Main.cs (1)
259-264: Minor: use explicitMessageBoxResulttype for consistency.Lines 209 (Shutdown), 234 (Restart), and 286 (Log Off) all declare
MessageBoxResult result = …. Line 259 (Restart Advanced) usesvar, 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).
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.
Changes
SkipPowerActionConfirmationproperty toSettings.cs.SysSettings.xaml.Main.csto check the setting before showing theMessageBox.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
Refactors
Written for commit a99b839. Summary will update on new commits.