Skip to content

Conversation

@VictoriousRaptor
Copy link
Contributor

@VictoriousRaptor VictoriousRaptor commented Dec 22, 2025

Show taskbar when Flow is opened

Tested

  • Taskbar shows up when Flow is opened
  • Taskbar hides when Flow is closed

@github-actions github-actions bot added this to the 2.1.0 milestone Dec 22, 2025
@gitstream-cm
Copy link

gitstream-cm bot commented Dec 22, 2025

🥷 Code experts: Jack251970

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

See details

Flow.Launcher.Infrastructure/NativeMethods.txt

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV
OCT
SEP 6 additions & 1 deletions
AUG
JUL 7 additions & 10 deletions

Knowledge based on git-blame:
Jack251970: 76%

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV
OCT 31 additions & 52 deletions
SEP 2 additions & 3 deletions
AUG
JUL 45 additions & 4 deletions 582 additions & 0 deletions

Knowledge based on git-blame:
Jack251970: 91%

Flow.Launcher.Infrastructure/Win32Helper.cs

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV
OCT
SEP 118 additions & 6 deletions
AUG
JUL 57 additions & 20 deletions 795 additions & 0 deletions

Knowledge based on git-blame:
Jack251970: 93%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV
OCT 13 additions & 10 deletions
SEP 14 additions & 6 deletions
AUG 4 additions & 0 deletions
JUL 48 additions & 13 deletions

Knowledge based on git-blame:
Jack251970: 94%

Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV
OCT 405 additions & 348 deletions
SEP 2 additions & 2 deletions
AUG
JUL 41 additions & 36 deletions

Knowledge based on git-blame:
Jack251970: 91%

Flow.Launcher/ViewModel/MainViewModel.cs

Activity based on git-commit:

Jack251970 jjw24
DEC
NOV 106 additions & 94 deletions
OCT 125 additions & 88 deletions
SEP 13 additions & 15 deletions
AUG
JUL 76 additions & 51 deletions

Knowledge based on git-blame:
Jack251970: 85%

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

@gitstream-cm
Copy link

gitstream-cm bot commented Dec 22, 2025

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

@coderabbitai coderabbitai bot added the enhancement New feature or request label Dec 22, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 22, 2025

📝 Walkthrough

Walkthrough

Adds a user setting and UI toggle to temporarily show/hide the Windows taskbar when Flow Launcher opens: new native MonitorFromWindow declaration, Win32Helper Show/Hide taskbar APIs, Settings property and UI binding, localization keys, and MainViewModel coordination to show/hide per-instance.

Changes

Cohort / File(s) Summary
Win32 / Native API
Flow.Launcher.Infrastructure/NativeMethods.txt, Flow.Launcher.Infrastructure/Win32Helper.cs
Added MonitorFromWindow native declaration and a Taskbar region with ShowTaskbar() and HideTaskbar() that locate Shell_TrayWnd/Shell_SecondaryTrayWnd, call MonitorFromWindow, and post the TrayBarFlag (0x05D1).
Settings & UI
Flow.Launcher.Infrastructure/UserSettings/Settings.cs, Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Added ShowTaskbarWhenInvoked boolean property (default false) and a SettingsCard toggle bound to it in the General settings pane.
Localization
Flow.Launcher/Languages/en.xaml
Added showTaskbarWhenOpened and showTaskbarWhenOpenedToolTip localization keys.
Main View Logic
Flow.Launcher/ViewModel/MainViewModel.cs
Added per-instance _taskbarShownByFlow flag; Show() calls Win32Helper.ShowTaskbar() when enabled and not already shown; Hide() calls Win32Helper.HideTaskbar() when Flow previously showed it and resets the flag.

Sequence Diagram

sequenceDiagram
    participant User
    participant MainViewModel
    participant Settings
    participant Win32Helper
    participant NativeAPI

    User->>MainViewModel: Open (Show)
    MainViewModel->>Settings: read ShowTaskbarWhenInvoked
    alt enabled & not already shown
        MainViewModel->>Win32Helper: ShowTaskbar()
        Win32Helper->>NativeAPI: FindWindow("Shell_TrayWnd"/"Shell_SecondaryTrayWnd")
        NativeAPI-->>Win32Helper: hwnd
        Win32Helper->>NativeAPI: MonitorFromWindow(hwnd)
        NativeAPI-->>Win32Helper: monitor
        Win32Helper->>NativeAPI: PostMessage(TrayBarFlag 0x05D1, WPARAM=1, monitor)
        Win32Helper-->>MainViewModel: returned (set flag)
    end

    User->>MainViewModel: Close (Hide)
    alt taskbar was shown by Flow
        MainViewModel->>Win32Helper: HideTaskbar()
        Win32Helper->>NativeAPI: FindWindow(...)
        NativeAPI-->>Win32Helper: hwnd
        Win32Helper->>NativeAPI: PostMessage(TrayBarFlag 0x05D1, WPARAM=0)
        Win32Helper-->>MainViewModel: returned (clear flag)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • jjw24
  • onesounds

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main changeset objective of adding a feature to show the taskbar when Flow Launcher opens.
Description check ✅ Passed The description is related to the changeset, describing the feature being implemented and testing done, though minimal in detail.
✨ Finishing touches
  • 📝 Generate docstrings

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.

coderabbitai[bot]

This comment was marked as resolved.

@jjw24 jjw24 enabled auto-merge (squash) December 22, 2025 23:02
@jjw24
Copy link
Member

jjw24 commented Dec 22, 2025

@Jack251970 do you have dual monitor setup to help test this?

@jjw24 jjw24 linked an issue Dec 22, 2025 that may be closed by this pull request
@VictoriousRaptor
Copy link
Contributor Author

@Jack251970 do you have dual monitor setup to help test this?

pr is not ready as the potential dual monitor issue and the issue addressed by code rabbit so I disable the auto merge now.

@jjw24 jjw24 marked this pull request as draft December 23, 2025 04:43
@Jack251970
Copy link
Member

@VictoriousRaptor Feel free to ping me if you need help with testing under dual monitor setup

@VictoriousRaptor
Copy link
Contributor Author

@VictoriousRaptor Feel free to ping me if you need help with testing under dual monitor setup

Yeah please test it if you're free.

@VictoriousRaptor VictoriousRaptor marked this pull request as ready for review December 25, 2025 16:18
@Jack251970
Copy link
Member

@VictoriousRaptor No matter on which monitor I open Flow, it is always the taskbar on the main monitor opened.

@VictoriousRaptor
Copy link
Contributor Author

@Jack251970 Hi Jack, I've just tried to implement showing or hiding taskbar on Flow's monitor only. Please check it if you're free.

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: 1

🧹 Nitpick comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

1007-1017: Minor formatting inconsistency.

The set accessor has inconsistent indentation compared to the get accessor.

🔎 Suggested formatting fix
 private bool isOnPrimaryScreen = false;
 public bool OnPrimaryScreen
-{             
+{
     get => isOnPrimaryScreen;
-        set
-        {
-            isOnPrimaryScreen = value;
-            OnPropertyChanged();
-        }
+    set
+    {
+        isOnPrimaryScreen = value;
+        OnPropertyChanged();
+    }
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 471a310 and 51a8f89.

📒 Files selected for processing (2)
  • Flow.Launcher.Infrastructure/Win32Helper.cs
  • Flow.Launcher/ViewModel/MainViewModel.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher.Infrastructure/Win32Helper.cs
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-16T10:48:30.573Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:12.842Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (2)
Flow.Launcher/ViewModel/MainViewModel.cs (2)

67-68: LGTM!

Good addition of the tracking flag to ensure balanced ShowTaskbar/HideTaskbar calls, as suggested in the previous review.


2113-2118: LGTM!

The Show() implementation correctly guards against duplicate calls using the tracking flag.

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: 2

🧹 Nitpick comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

1007-1016: Naming convention inconsistency: apply underscore prefix to private field.

The backing field isOnPrimaryScreen doesn't follow the underscore prefix convention used by all other private fields in this class (_lastQuery, _taskbarShownByFlow, _isDialogJump, etc.). Consider renaming to _isOnPrimaryScreen.

-        private bool isOnPrimaryScreen = false;
+        private bool _isOnPrimaryScreen = false;
         public bool OnPrimaryScreen
         {             
-            get => isOnPrimaryScreen;
+            get => _isOnPrimaryScreen;
                 set
                 {
-                    isOnPrimaryScreen = value;
+                    _isOnPrimaryScreen = value;
                     OnPropertyChanged();
                 }
         }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51a8f89 and daf82ea.

📒 Files selected for processing (1)
  • Flow.Launcher/ViewModel/MainViewModel.cs
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-16T10:48:30.573Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:12.842Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

67-67: LGTM! Tracking flag correctly addresses the balance concern.

The _taskbarShownByFlow flag ensures that ShowTaskbar() and HideTaskbar() calls remain balanced regardless of when the setting is toggled, preventing the taskbar from being left in an unexpected state.

@Jack251970
Copy link
Member

@VictoriousRaptor It still cannot work. If I open and hide the Flow window in primary screen, the task bar in primary screen will be shown and hidden. But if I open it in non-primary screen, the task bar in primary screen will be shown but will not be hidden when Flow window is hidden.

I've added some logging lines. Please post the log when you're trying to opening and hiding Flow on a secondary screen. If it's not working we may follow the original API way that Copilot has pointed.

Here you are:
Primary screen:

Showing taskbar: primaryTaskbar:True: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:True: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper

Non-primary screen:

Showing taskbar: primaryTaskbar:True: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:False: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper

@VictoriousRaptor
Copy link
Contributor Author

@Jack251970 I guess it's about when we detect Flow's screen. Maybe main window is moved after we detected. Anyways I wanna make it simple. Is showing all taskbars acceptable? Or what's Windows' solution, when you press WIN key on a monitor? Are all taskbars shown?

Non-primary screen:

Showing taskbar: primaryTaskbar:True: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:False: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper

@Jack251970
Copy link
Member

@Jack251970 I guess it's about when we detect Flow's screen. Maybe main window is moved after we detected. Anyways I wanna make it simple. Is showing all taskbars acceptable? Or what's Windows' solution, when you press WIN key on a monitor? Are all taskbars shown?

Non-primary screen:

Showing taskbar: primaryTaskbar:True: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:False: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper

No matter which screen I click on, the taskbar of the main screen is always displayed

@Jack251970
Copy link
Member

I think we do not need to consider the task bar in the non-primary screen (At least Microsoft did not consider this)

@Jack251970
Copy link
Member

@VictoriousRaptor Hi, I fixed the primary window detection. But it still cannot work though. The task bar in the non-primary window cannot be shown and hidden either

@Jack251970
Copy link
Member

Jack251970 commented Dec 30, 2025

Logs seems to be correct now:

Showing taskbar: primaryTaskbar:True: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:True: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper
Showing taskbar: primaryTaskbar:False: Win32Helper
Showing taskbar: taskbarHwnd is null :False: Win32Helper
Hiding taskbar: primaryTaskbar:False: Win32Helper
Hiding taskbar: taskbarHwnd is null :False: Win32Helper

@Jack251970
Copy link
Member

I just cannot get it work for non-primary task bar....

@VictoriousRaptor
Copy link
Contributor Author

VictoriousRaptor commented Dec 30, 2025

I just cannot get it work for non-primary task bar....

it's possible because we're currently using an undocumented way. I think working on primary is good engouh though, considering Microsoft uses the primary too. I've read an article saying that primary taskbar is not on primary screen somtimes so making it perfect would be more complicated.

Just in case you're interested to explore how to make it work, you can check the first commit of this pr and set the taskbar to always on top mode.

@Jack251970
Copy link
Member

Well, let us revert to the original version which just operates the task bar in the primary screen

@Jack251970
Copy link
Member

And I have removed the third todo

Moved taskbar show logic to after keyboard layout switch in Show().Ensures consistent taskbar state when invoking or hiding the app.
@VictoriousRaptor VictoriousRaptor force-pushed the copilot/add-show-taskbar-option branch from 362ac27 to 2c00b31 Compare December 30, 2025 11:34
@VictoriousRaptor
Copy link
Contributor Author

Well, let us revert to the original version which just operates the task bar in the primary screen

I did a git push -f.

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: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 362ac27 and 2c00b31.

📒 Files selected for processing (1)
  • Flow.Launcher/ViewModel/MainViewModel.cs
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3593
File: Flow.Launcher/HotkeyControlDialog.xaml:6-6
Timestamp: 2025-09-05T11:56:27.267Z
Learning: In Flow.Launcher's migration to iNKORE.UI.WPF.Modern UI framework, dialog resource keys like PopuBGColor, PopupButtonAreaBGColor, PopupButtonAreaBorderColor, and PopupTextColor are provided by the iNKORE.UI.WPF.Modern framework itself, not defined locally in the codebase theme files.
Learnt from: Yusyuriv
Repo: Flow-Launcher/Flow.Launcher PR: 3057
File: Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs:0-0
Timestamp: 2024-11-03T07:40:11.014Z
Learning: In Flow Launcher, when using Windows Forms dialogs (e.g., in `JsonRPCPluginSettings.cs`), path validation is enabled by default in `OpenFileDialog` and `FolderBrowserDialog`, preventing users from selecting invalid paths, but it's possible to opt out of this validation on individual dialogs.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:246-262
Timestamp: 2025-07-21T09:19:49.684Z
Learning: In Flow Launcher's App.xaml.cs, the asynchronous plugin initialization task (containing AbstractPluginEnvironment.PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, and AutoPluginUpdates) does not require additional try-catch error handling according to maintainer Jack251970, as these operations are designed to handle exceptions internally.
📚 Learning: 2025-10-16T10:48:30.573Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
Flow.Launcher/ViewModel/MainViewModel.cs (3)

67-67: LGTM: Tracking flag correctly implemented.

The _taskbarShownByFlow field properly tracks whether Flow has shown the taskbar, ensuring balanced show/hide operations even if the user toggles the setting while Flow is open. This addresses previous review feedback.


2150-2156: Tracking flag correctly used, but inherits monitor detection issue.

The condition correctly checks both the setting and the tracking flag before showing the taskbar, ensuring balanced show/hide calls (addressing previous review feedback ✅). However, this code still uses isOnPrimaryScreen without detecting which monitor Flow is actually on—see the critical issue at lines 1007-1016.


2225-2230: Tracking flag correctly used, but inherits monitor detection issue.

The condition correctly relies solely on _taskbarShownByFlow without checking the setting value, ensuring balanced hide operations (addressing previous review feedback ✅). However, this code still uses isOnPrimaryScreen without detecting which monitor Flow is on—see the critical issue at lines 1007-1016.

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: 1

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2c00b31 and ef34938.

📒 Files selected for processing (1)
  • Flow.Launcher/ViewModel/MainViewModel.cs
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
📚 Learning: 2025-10-16T10:48:30.573Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:12.842Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
Flow.Launcher/ViewModel/MainViewModel.cs (2)

67-67: LGTM! Tracking flag correctly addresses past review feedback.

The _taskbarShownByFlow field properly tracks whether Flow showed the taskbar, ensuring balanced show/hide operations regardless of when the setting is toggled. This addresses the concern raised in previous reviews about unbalanced calls.


2214-2219: Critical: Undefined variable causes compilation error.

isOnPrimaryScreen is used at line 2217 but is never declared or initialized. This code will not compile.

Based on the PR discussion and past review iterations, monitor detection remains unresolved. The simplest fix is to call HideTaskbar() without parameters, matching the ShowTaskbar() call at line 2143 and using the default primaryTaskbar = true value.

🔎 Proposed fix
 // Hide the taskbar if the setting is enabled
 if (_taskbarShownByFlow)
 {
-    Win32Helper.HideTaskbar(isOnPrimaryScreen);
+    Win32Helper.HideTaskbar();
     _taskbarShownByFlow = false;
 }

Likely an incorrect or invalid review comment.

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: 0

🧹 Nitpick comments (2)
Flow.Launcher/ViewModel/MainViewModel.cs (2)

2140-2145: Logic is correct; consider optional exception handling.

The implementation correctly checks both the setting and the tracking flag before showing the taskbar, preventing redundant Win32 calls. The simplified primary-taskbar-only approach aligns with the PR discussion outcome.

Optional: Add exception handling for robustness

While FindWindowEx and PostMessage are stable Win32 APIs, wrapping the call in a try-catch could prevent unexpected failures from affecting the launcher's visibility:

 // Show the taskbar if the setting is enabled
 if (Settings.ShowTaskbarWhenInvoked && !_taskbarShownByFlow)
 {
-    Win32Helper.ShowTaskbar();
-    _taskbarShownByFlow = true;
+    try
+    {
+        Win32Helper.ShowTaskbar();
+        _taskbarShownByFlow = true;
+    }
+    catch (Exception ex)
+    {
+        App.API.LogException(ClassName, "Failed to show taskbar", ex);
+    }
 }

2214-2219: Correctly implements balanced hide logic.

The condition properly relies solely on _taskbarShownByFlow, ensuring the taskbar is restored even if the user toggled the setting while Flow was open. This directly addresses the critical issue flagged in previous reviews.

Optional: Add exception handling for robustness

Similar to the Show() method, consider wrapping the Win32 call:

 // Hide the taskbar if the setting is enabled
 if (_taskbarShownByFlow)
 {
-    Win32Helper.HideTaskbar();
-    _taskbarShownByFlow = false;
+    try
+    {
+        Win32Helper.HideTaskbar();
+        _taskbarShownByFlow = false;
+    }
+    catch (Exception ex)
+    {
+        App.API.LogException(ClassName, "Failed to hide taskbar", ex);
+        _taskbarShownByFlow = false; // Reset flag even on failure
+    }
 }

Note: Resetting the flag even on failure prevents the state from getting stuck in an inconsistent state.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef34938 and 69d3dcc.

📒 Files selected for processing (1)
  • Flow.Launcher/ViewModel/MainViewModel.cs
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3593
File: Flow.Launcher/HotkeyControlDialog.xaml:6-6
Timestamp: 2025-09-05T11:56:27.267Z
Learning: In Flow.Launcher's migration to iNKORE.UI.WPF.Modern UI framework, dialog resource keys like PopuBGColor, PopupButtonAreaBGColor, PopupButtonAreaBorderColor, and PopupTextColor are provided by the iNKORE.UI.WPF.Modern framework itself, not defined locally in the codebase theme files.
📚 Learning: 2025-10-16T10:48:30.573Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher/ViewModel/MainViewModel.cs
🧬 Code graph analysis (1)
Flow.Launcher/ViewModel/MainViewModel.cs (2)
Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)
  • Settings (16-632)
Flow.Launcher.Infrastructure/Win32Helper.cs (3)
  • Win32Helper (33-1047)
  • ShowTaskbar (1023-1033)
  • HideTaskbar (1035-1044)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (1)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

67-67: LGTM: Tracking flag correctly addresses previous review concerns.

The _taskbarShownByFlow flag properly ensures balanced show/hide calls regardless of when the user toggles the setting, which was a critical issue flagged in previous reviews.

Jack251970
Jack251970 previously approved these changes Dec 30, 2025
@Jack251970
Copy link
Member

Thanks for your contribution!

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: 0

🧹 Nitpick comments (2)
Flow.Launcher.Infrastructure/Win32Helper.cs (2)

1022-1022: The unsafe keyword appears unnecessary.

The method accesses mon.Value which is a property access, not a pointer operation. The underlying CsWin32-generated code handles pointer operations internally.

🔎 Proposed fix
-public static unsafe void ShowTaskbar()
+public static void ShowTaskbar()

1024-1043: Consider extracting common taskbar window finding logic.

Both methods duplicate the taskbar window lookup and the TrayBarFlag constant. Extracting these would improve maintainability.

🔎 Proposed refactor
+private const uint TrayBarFlag = 0x05D1;
+
+private static HWND FindTaskbarWindow()
+{
+    return PInvoke.FindWindowEx(HWND.Null, HWND.Null, "Shell_TrayWnd", null);
+}
+
 public static void ShowTaskbar()
 {
     // Find the taskbar window
-    var taskbarHwnd = PInvoke.FindWindowEx(HWND.Null, HWND.Null, "Shell_TrayWnd", null);
+    var taskbarHwnd = FindTaskbarWindow();
     if (taskbarHwnd == HWND.Null) return;
 
     // Magic from https://github.com/Oliviaophia/SmartTaskbar
-    const uint TrayBarFlag = 0x05D1;
     var mon = PInvoke.MonitorFromWindow(taskbarHwnd, Windows.Win32.Graphics.Gdi.MONITOR_FROM_FLAGS.MONITOR_DEFAULTTONEAREST);
     PInvoke.PostMessage(taskbarHwnd, TrayBarFlag, new WPARAM(1), new LPARAM((nint)mon.Value));
 }
 
 public static void HideTaskbar()
 {
     // Find the taskbar window
-    var taskbarHwnd = PInvoke.FindWindowEx(HWND.Null, HWND.Null, "Shell_TrayWnd", null);
+    var taskbarHwnd = FindTaskbarWindow();
     if (taskbarHwnd == HWND.Null) return;
 
     // Magic from https://github.com/Oliviaophia/SmartTaskbar
-    const uint TrayBarFlag = 0x05D1;
     PInvoke.PostMessage(taskbarHwnd, TrayBarFlag, new WPARAM(0), IntPtr.Zero);
 }
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69d3dcc and d947ba5.

📒 Files selected for processing (1)
  • Flow.Launcher.Infrastructure/Win32Helper.cs
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:318-318
Timestamp: 2025-06-08T14:12:12.842Z
Learning: In Flow.Launcher, the App.NotifyIcon static property is initialized in the App class before MainWindow creation, so null checks are not needed when accessing App.NotifyIcon in MainWindow lifecycle methods.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3854
File: Flow.Launcher/App.xaml.cs:252-275
Timestamp: 2025-10-16T10:48:30.573Z
Learning: In Flow Launcher's App.xaml.cs, the plugin initialization block (lines 252-275) that includes PreStartPluginExecutablePathUpdate, PluginManager.LoadPlugins, PluginManager.InitializePluginsAsync, _mainVM.QueryResults(), and API.SaveAppAllSettings() does not require additional Task.Run wrappers or Dispatcher.InvokeAsync calls according to maintainer Jack251970, as the threading model is already safe as designed.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3593
File: Flow.Launcher/HotkeyControlDialog.xaml:6-6
Timestamp: 2025-09-05T11:56:27.267Z
Learning: In Flow.Launcher's migration to iNKORE.UI.WPF.Modern UI framework, dialog resource keys like PopuBGColor, PopupButtonAreaBGColor, PopupButtonAreaBorderColor, and PopupTextColor are provided by the iNKORE.UI.WPF.Modern framework itself, not defined locally in the codebase theme files.
📚 Learning: 2025-06-08T14:12:21.348Z
Learnt from: Jack251970
Repo: Flow-Launcher/Flow.Launcher PR: 3672
File: Flow.Launcher/MainWindow.xaml.cs:244-247
Timestamp: 2025-06-08T14:12:21.348Z
Learning: In Flow.Launcher, App.NotifyIcon is created before MainWindow creation, so null checks for App.NotifyIcon are not necessary when accessing it from MainWindow code.

Applied to files:

  • Flow.Launcher.Infrastructure/Win32Helper.cs
🧬 Code graph analysis (1)
Flow.Launcher.Infrastructure/Win32Helper.cs (2)
Flow.Launcher.Infrastructure/PInvokeExtensions.cs (1)
  • PInvoke (7-45)
Flow.Launcher.Infrastructure/DialogJump/Models/WindowsExplorer.cs (1)
  • HWND (115-120)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Flow.Launcher.Infrastructure/Win32Helper.cs (1)

1020-1045: Implementation correctly targets the primary taskbar.

The logic finds Shell_TrayWnd (the primary taskbar) and uses MonitorFromWindow to get its monitor handle. This aligns with the PR objective to operate only on the primary taskbar after dual-monitor toggling proved unreliable.

Note: As indicated in the PR discussion, this implementation does not support showing/hiding taskbars on non-primary monitors in multi-monitor setups. The taskbar shown/hidden will always be the primary monitor's taskbar.

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.

Tested and good to go!

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

This PR adds a new user setting to temporarily show the Windows taskbar when Flow Launcher is opened, which is particularly useful when the taskbar is configured to auto-hide. When the setting is enabled, Flow will show the taskbar upon opening and hide it again when closed.

Key Changes:

  • Added ShowTaskbarWhenInvoked setting with a default value of false
  • Implemented taskbar show/hide functionality using Windows messages (message 0x05D1) to control taskbar visibility
  • Added UI controls and localization for the new setting in the General settings pane

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Flow.Launcher/ViewModel/MainViewModel.cs Added _taskbarShownByFlow flag and integrated taskbar show/hide calls in the Show() and Hide() methods
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml Added UI toggle switch for the new taskbar setting
Flow.Launcher/Languages/en.xaml Added English localization strings for the setting name and tooltip
Flow.Launcher.Infrastructure/Win32Helper.cs Implemented ShowTaskbar() and HideTaskbar() methods using Win32 API calls
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Added ShowTaskbarWhenInvoked boolean property
Flow.Launcher.Infrastructure/NativeMethods.txt Added MonitorFromWindow to the list of P/Invoke methods

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

@VictoriousRaptor VictoriousRaptor merged commit 8e80c3b into dev Dec 31, 2025
12 checks passed
@VictoriousRaptor VictoriousRaptor deleted the copilot/add-show-taskbar-option branch December 31, 2025 10:05
TBM13 pushed a commit to TBM13/Flow.Launcher that referenced this pull request Jan 1, 2026
…r#4177)

* Add option to show taskbar when Flow Launcher is invoked

Co-authored-by: VictoriousRaptor <[email protected]>

* Fix: Use ABM_ACTIVATE instead of ABM_SETSTATE for temporary taskbar showing

Co-authored-by: VictoriousRaptor <[email protected]>

* Remove unnecessary unsafe keyword from ShowTaskbar method

Co-authored-by: VictoriousRaptor <[email protected]>

* Fix missing closing braces in Win32Helper.cs

Co-authored-by: VictoriousRaptor <[email protected]>

* Change wording from 'invoked' to 'opened' in localization strings

Co-authored-by: VictoriousRaptor <[email protected]>

* Show/hide tasking when showing/hiding Flow

* Remove unused APPBARDATA

* Guard HideTaskbar() with state so show/hide stay balanced

* Improve taskbar visibility management in MainViewModel

Moved taskbar show logic to after keyboard layout switch in Show().Ensures consistent taskbar state when invoking or hiding the app.

* Clean code

* Clean code

* Remove blank line

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: Jack Ye <[email protected]>
Co-authored-by: Jack251970 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 min review enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option to show taskbar when FL is invoked

4 participants