Skip to content

Improve Setting Window Font & Format xaml styles & Fix log message & Improve code quality #3487

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

onesounds
Copy link
Contributor

@onesounds onesounds commented Apr 24, 2025

Summary

  • Controls in the settings window now reflect changes in the configured font dynamically.
  • FontFamily no longer needs to be explicitly set for controls to adopt the user-defined font.
  • Glyph icons that should retain their original appearance are now styled separately to prevent unwanted font changes.
  • Removed previously applied FontFamily setting from the main window.
  • Replaced ui:FontIcon usage of MDL2 with Fluent UI, now used in context menu icons.
  • Format xaml styles.
  • Check startup only for release.
  • Fix log message & Improve code comments.
  • Use http client when checking proxy.
  • Improve theme preview performance.
  • Use dependency injection for setting page view models.
  • Always update main window & setting window position when window is loaded.
  • Do not save settings when setting window is still open during exiting.
  • Fix logon task issue message box & Improve startup path check.

Notes

  • Font settings defined directly in XAML should ideally override styles, but that didn’t work as expected during testing.
  • Since no further per-control font customization is planned for now, this behavior is considered acceptable.
  • If this issue becomes relevant again, further investigation will be required.

Tests

  • Setting window font change & update.
  • Plugin setting windows font change & update.
  • Context menu font change & update.

This comment has been minimized.

Copy link

gitstream-cm bot commented Apr 24, 2025

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

Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

📝 Walkthrough

Walkthrough

This update refactors the handling of application-wide font settings and improves encapsulation and dependency management throughout the codebase. The SettingWindowFont property now updates dynamic resources for consistent font application, and explicit font bindings are removed from individual windows. Numerous classes replace public Settings properties with private fields, and dependency injection is streamlined for view models. The initialization and saving of window positions and states are improved, with new event handlers ensuring settings persist on move and resize. Additionally, XAML files are reformatted for consistent attribute syntax, and several UI elements switch from direct glyph content to using FontIcon controls.

Changes

Files/Group Change Summary
Font Handling & Dynamic Resource Application
Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Flow.Launcher/Resources/CustomControlTemplate.xaml
SettingWindowFont setter now updates app-wide resources; new font resources and styles unify font usage across controls.
Flow.Launcher/App.xaml.cs Updates font resources at startup; registers view models as singletons/transients; adds Exiting property and static _mainWindow.
Removal of Explicit Font Bindings from Windows
Flow.Launcher/CustomQueryHotkeySetting.xaml
Flow.Launcher/CustomShortcutSetting.xaml
Flow.Launcher/SelectBrowserWindow.xaml
Flow.Launcher/SelectFileManagerWindow.xaml
Flow.Launcher/SettingWindow.xaml
Removes two-way FontFamily bindings to Settings.SettingWindowFont from window elements.
Encapsulation and Dependency Injection Refactoring
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs
Flow.Launcher/CustomShortcutSetting.xaml.cs
Flow.Launcher/SelectBrowserWindow.xaml.cs
Flow.Launcher/SelectFileManagerWindow.xaml.cs
Flow.Launcher/ViewModel/SettingWindowViewModel.cs
Flow.Launcher/WelcomeWindow.xaml.cs
Replaces public Settings properties with private readonly fields; updates all references accordingly.
Window State and Position Persistence
Flow.Launcher/SettingWindow.xaml.cs Refactors event handling, adds state/position update on move/resize, streamlines settings saving on close, and reorganizes code.
Main Window Notify Icon and Context Menu
Flow.Launcher/MainWindow.xaml.cs Refactors context menu initialization and event handling; adds dynamic menu text updates; re-initializes menu on font change.
Welcome Pages Initialization and ViewModel Caching
Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs
Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs
Flow.Launcher/Resources/Pages/WelcomePage3.xaml.cs
Flow.Launcher/Resources/Pages/WelcomePage4.xaml.cs
Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs
Caches WelcomeViewModel in private fields; restricts Settings setters to private; initializes components only once.
Startup Logic Centralization and Error Handling
Flow.Launcher/Resources/Pages/WelcomePage5.xaml.cs Consolidates startup logic into ChangeAutoStartup; improves error handling and settings updates.
ViewModel Construction and Dependency Resolution
Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPanePluginStore.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml.cs
Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml.cs
Obtains view models directly from IoC container; removes manual construction and redundant using directives.
SettingsPane ViewModel Constructor Updates
Flow.Launcher/SettingPages/ViewModels/SettingsPaneGeneralViewModel.cs
Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs
Changes constructor parameters to use concrete types; moves preview results and font initialization to constructor.
Proxy Testing Modernization
Flow.Launcher/SettingPages/ViewModels/SettingsPaneProxyViewModel.cs Refactors proxy test to use async HttpClient instead of synchronous HttpWebRequest.
UI Glyph Rendering Improvements
Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml
Flow.Launcher/WelcomeWindow.xaml
Replaces direct glyph content in buttons with nested FontIcon elements for icons.
Resource Key and Localization Updates
Flow.Launcher/Languages/en.xaml
Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml
Renames resource key from settingWindowFont to settingWindowFontTitle in XAML and bindings.
Formatting and Attribute Syntax Consistency
Flow.Launcher/ActionKeywords.xaml
Flow.Launcher/HotkeyControl.xaml
Flow.Launcher/HotkeyControlDialog.xaml
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml
Flow.Launcher/Resources/Pages/WelcomePage1.xaml
Flow.Launcher/Resources/Pages/WelcomePage2.xaml
Flow.Launcher/Resources/Pages/WelcomePage3.xaml
Flow.Launcher/Resources/Pages/WelcomePage4.xaml
Flow.Launcher/Resources/Pages/WelcomePage5.xaml
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml
Plugins/Flow.Launcher.Plugin.Explorer/Views/ActionKeywordSetting.xaml
Plugins/Flow.Launcher.Plugin.Program/AddProgramSource.xaml
Plugins/Flow.Launcher.Plugin.Program/ProgramSuffixes.xaml
Replaces comma-separated numeric values in Margin, Padding, BorderThickness, etc., with space-separated values for consistency.
Other Minor Updates
Flow.Launcher.Core/Plugin/JsonRPCPluginSettings.cs
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs
Flow.Launcher/ViewModel/WelcomeViewModel.cs
Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs
Flow.Launcher/SettingPages/Views/SettingsPaneProxy.xaml
Minor formatting, pattern matching, and attribute reordering; no logic changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Settings
    participant App
    participant ResourceDictionary
    participant Window

    User->>Settings: Change SettingWindowFont
    Settings->>ResourceDictionary: Update "SettingWindowFont" and "ContentControlThemeFontFamily"
    ResourceDictionary-->>Window: DynamicResource triggers font update
    Window-->>User: UI updates with new font
Loading

Possibly related PRs

  • Flow-Launcher/Flow.Launcher#3248: Refactors CustomQueryHotkeySetting to use a private _settings field instead of a public property, directly related to encapsulation changes in this PR.
  • Flow-Launcher/Flow.Launcher#3470: Introduces the initial SettingWindowFont property and two-way bindings, which this PR builds upon by refining font resource management and removing explicit bindings.

Suggested reviewers

  • onesounds

Poem

A rabbit hopped through fields of code,
Tidying fonts so styles bestowed.
With private fields and settings neat,
Each window’s font now feels complete.
Margins spaced with gentle care,
Icons shine with FontIcon flair.
Hop, hop, hooray! The UI’s bright—
This bunny’s work feels just right!

((\
( -.-)
o_(")(")


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 755ddb4 and c35eca2.

📒 Files selected for processing (1)
  • Flow.Launcher/Helper/AutoStartup.cs (6 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
Flow.Launcher/Helper/AutoStartup.cs (3)
Flow.Launcher.Infrastructure/Constant.cs (1)
  • Constant (7-59)
Flow.Launcher/App.xaml.cs (2)
  • App (29-374)
  • App (54-131)
Flow.Launcher/PublicAPIInstance.cs (1)
  • LogError (216-217)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (7)
Flow.Launcher/Helper/AutoStartup.cs (7)

8-9: Good addition of nullable reference types!

Enabling nullable reference types improves type safety and helps prevent potential null reference exceptions at compile time.


64-72: Great improvement to task action validation!

This change adds robust validation to ensure the scheduled task points to the correct executable path. The code now properly checks if the task action matches the current executable path and updates it if necessary, which helps maintain correct startup behavior across application updates or relocations.


79-79: Helpful comment explaining exception propagation.

This comment clearly explains why the exception is rethrown, improving code maintainability by making the error handling flow more transparent.


91-106: Excellent registry validation enhancement!

This change adds similar validation and fixing logic for registry auto-startup as was added for the task scheduler. The code now checks if the registry entry points to the current executable and updates it if necessary, providing a more robust startup mechanism. The null check before accessing the registry key also prevents potential null reference exceptions.


109-110: Improved error logging with clear intent.

Both the error logging and the follow-up comment clearly indicate what happens with the exception, making the code easier to maintain.


142-142: Great refactoring to use dedicated helper methods!

Using the newly created helper methods for registry operations improves code organization and maintainability by following the DRY principle.

Also applies to: 162-162


222-234: Well-designed helper methods for registry operations!

These new methods properly encapsulate registry operations, improving code organization and maintainability. The methods use null-conditional operators correctly to prevent null reference exceptions and handle cases where the registry key or value might not exist.

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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 (3)
Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml (1)

61-63: Remove redundant Button FontSize
Since the nested <ui:FontIcon> explicitly sets FontSize, the FontSize="14" on the <Button> is redundant and can be removed to simplify the markup.

Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml (1)

106-107: Improve accessibility of icon-only Button
The <Button> contains only a <ui:FontIcon> and no textual content, which may not be accessible. Consider adding an AutomationProperties.Name or tooltip to convey its purpose to screen readers.

Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)

117-117: Consider adding error handling for invalid font names.

The current implementation creates a new FontFamily instance directly without validating if the font exists or handling potential exceptions when an invalid font name is provided.

- Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
+ try {
+     Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
+ } catch (Exception ex) {
+     Log.Error($"Failed to set font '{value}': {ex.Message}", ex);
+     // Consider falling back to a default font
+     // Application.Current.Resources["SettingWindowFont"] = new FontFamily(Win32Helper.GetSystemDefaultFont(false));
+ }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3da3c59 and f50f2ff.

📒 Files selected for processing (12)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (2 hunks)
  • Flow.Launcher/CustomQueryHotkeySetting.xaml (0 hunks)
  • Flow.Launcher/CustomShortcutSetting.xaml (0 hunks)
  • Flow.Launcher/Languages/en.xaml (1 hunks)
  • Flow.Launcher/Resources/CustomControlTemplate.xaml (1 hunks)
  • Flow.Launcher/Resources/SettingWindowStyle.xaml (1 hunks)
  • Flow.Launcher/SelectBrowserWindow.xaml (0 hunks)
  • Flow.Launcher/SelectFileManagerWindow.xaml (0 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml (2 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml (1 hunks)
  • Flow.Launcher/SettingWindow.xaml (0 hunks)
  • Flow.Launcher/WelcomeWindow.xaml (1 hunks)
💤 Files with no reviewable changes (5)
  • Flow.Launcher/CustomShortcutSetting.xaml
  • Flow.Launcher/SelectFileManagerWindow.xaml
  • Flow.Launcher/SettingWindow.xaml
  • Flow.Launcher/SelectBrowserWindow.xaml
  • Flow.Launcher/CustomQueryHotkeySetting.xaml
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#0
File: :0-0
Timestamp: 2025-04-23T15:14:49.986Z
Learning: In WPF applications like Flow.Launcher, font styling should be applied using implicit styles instead of setting the FontFamily property on individual controls. Define implicit styles in a ResourceDictionary using <Style TargetType="{x:Type Button}"> format and merge it into App.xaml, which automatically applies the font to all instances of the control type while still allowing explicit overrides where needed.
Flow.Launcher/Resources/SettingWindowStyle.xaml (1)
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#0
File: :0-0
Timestamp: 2025-04-23T15:14:49.986Z
Learning: In WPF applications like Flow.Launcher, font styling should be applied using implicit styles instead of setting the FontFamily property on individual controls. Define implicit styles in a ResourceDictionary using <Style TargetType="{x:Type Button}"> format and merge it into App.xaml, which automatically applies the font to all instances of the control type while still allowing explicit overrides where needed.
Flow.Launcher/Resources/CustomControlTemplate.xaml (1)

undefined

<retrieved_learning>
Learnt from: onesounds
PR: Flow-Launcher/Flow.Launcher#0
File: :0-0
Timestamp: 2025-04-23T15:14:49.986Z
Learning: In WPF applications like Flow.Launcher, font styling should be applied using implicit styles instead of setting the FontFamily property on individual controls. Define implicit styles in a ResourceDictionary using <Style TargetType="{x:Type Button}"> format and merge it into App.xaml, which automatically applies the font to all instances of the control type while still allowing explicit overrides where needed.
</retrieved_learning>

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (6)
Flow.Launcher/Resources/SettingWindowStyle.xaml (1)

10-10: Verify resource dictionary merging
Ensure that SettingWindowStyle.xaml is included in the application’s merged dictionaries (e.g., in App.xaml), so that the SettingWindowFont resource is available at runtime.

Flow.Launcher/Languages/en.xaml (1)

358-358: Verify localization key replacement
Confirm that the old "settingWindowFont" key was removed to avoid duplicate resource entries, and that all references now use "settingWindowFontTitle".

Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml (1)

149-149: Resource key rename approved
The binding has been updated to {DynamicResource settingWindowFontTitle}, matching the new key in en.xaml.

Flow.Launcher/WelcomeWindow.xaml (1)

144-146: Ensure FontIcon style is applied globally
These buttons now use nested <ui:FontIcon> elements. Verify that a global style for ui:FontIcon (e.g., setting FontFamily="Segoe Fluent Icons") is defined and merged so that icons render correctly throughout the app.

Also applies to: 153-155

Flow.Launcher.Infrastructure/UserSettings/Settings.cs (1)

110-118: Good implementation of the centralized font management approach!

This change centralizes font application through the resource dictionary, which aligns with WPF best practices for styling. By setting the FontFamily resource when the property changes, all UI elements using this resource will automatically update.

I see this supports the learnings about using implicit styles in WPF applications rather than setting FontFamily properties directly on controls.

Flow.Launcher/Resources/CustomControlTemplate.xaml (1)

7-19: Well-implemented global font styling approach!

This change correctly implements a centralized approach to font styling by defining implicit styles that set the font family for various UI element types. Rather than setting FontFamily directly on individual controls throughout the application, these styles apply the font consistently via dynamic resources.

The approach follows WPF best practices by:

  1. Setting icon-specific fonts for ui:FontIcon elements
  2. Using a dynamic resource SettingWindowFont for text elements
  3. Providing consistent styling across all control types
  4. Supporting automatic font application while still allowing explicit overrides where needed

This implementation perfectly aligns with the recommendation to use implicit styles for font management in WPF applications.

@onesounds
Copy link
Contributor Author

@coderabbitai Review it.

Copy link
Contributor

coderabbitai bot commented Apr 24, 2025

Tip

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

@Jack251970 Jack251970 added this to the 1.20.0 milestone Apr 24, 2025
@Jack251970 Jack251970 added kind/ui related to UI, icons, themes, etc Dev branch only An issue or fix for the Dev branch build labels Apr 24, 2025

This comment has been minimized.

Copy link

gitstream-cm bot commented Apr 24, 2025

🥷 Code experts: Jack251970

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

See details

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

onesounds Jack251970
APR 102 additions & 38 deletions 31 additions & 81 deletions
MAR 10 additions & 0 deletions 142 additions & 94 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions
DEC 1 additions & 1 deletions
NOV

Knowledge based on git-blame:
onesounds: 22%
Jack251970: 21%

Flow.Launcher/App.xaml.cs

Activity based on git-commit:

onesounds Jack251970
APR 39 additions & 24 deletions
MAR 168 additions & 94 deletions
FEB 79 additions & 40 deletions
JAN 86 additions & 66 deletions
DEC
NOV

Knowledge based on git-blame:
Jack251970: 64%

Flow.Launcher/CustomQueryHotkeySetting.xaml

Activity based on git-commit:

onesounds Jack251970
APR 1 additions & 0 deletions 1 additions & 1 deletions
MAR 14 additions & 14 deletions
FEB 1 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 51%
Jack251970: 10%

Flow.Launcher/CustomShortcutSetting.xaml

Activity based on git-commit:

onesounds Jack251970
APR 14 additions & 13 deletions
MAR
FEB 1 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
Jack251970: 9%
onesounds: 7%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

onesounds Jack251970
APR 44 additions & 22 deletions 21 additions & 21 deletions
MAR 8 additions & 3 deletions 67 additions & 42 deletions
FEB 15 additions & 9 deletions
JAN 1 additions & 0 deletions
DEC
NOV

Knowledge based on git-blame:
onesounds: 43%
Jack251970: 9%

Flow.Launcher/Resources/CustomControlTemplate.xaml

Activity based on git-commit:

onesounds Jack251970
APR 167 additions & 118 deletions
MAR 15 additions & 5 deletions
FEB 31 additions & 14 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 100%

Flow.Launcher/Resources/SettingWindowStyle.xaml

Activity based on git-commit:

onesounds Jack251970
APR
MAR
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 100%

Flow.Launcher/SelectBrowserWindow.xaml

Activity based on git-commit:

onesounds Jack251970
APR 25 additions & 26 deletions 1 additions & 1 deletions
MAR
FEB 1 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 98%
Jack251970: 1%

Flow.Launcher/SelectFileManagerWindow.xaml

Activity based on git-commit:

onesounds Jack251970
APR 1 additions & 0 deletions 1 additions & 1 deletions
MAR
FEB 1 additions & 4 deletions
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 95%
Jack251970: 1%

Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml

Activity based on git-commit:

onesounds Jack251970
APR 40 additions & 8 deletions 5 additions & 2 deletions
MAR 9 additions & 1 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 63%
Jack251970: 3%

Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml

Activity based on git-commit:

onesounds Jack251970
APR 84 additions & 43 deletions 10 additions & 20 deletions
MAR 45 additions & 43 deletions
FEB
JAN
DEC
NOV

Knowledge based on git-blame:
onesounds: 81%
Jack251970: 7%

Flow.Launcher/WelcomeWindow.xaml

Activity based on git-commit:

onesounds Jack251970
APR
MAR 15 additions & 10 deletions
FEB 1 additions & 4 deletions
JAN
DEC
NOV 15 additions & 14 deletions

Knowledge based on git-blame:
onesounds: 90%
Jack251970: 10%

To learn more about /:\ gitStream - Visit our Docs

This comment has been minimized.

@onesounds onesounds requested a review from Copilot April 24, 2025 02:27
Copy link
Contributor

@Copilot 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 pull request improves the font management in the settings window by adding dynamic updates and separating icon styling.

  • Dynamically updates the application resource "SettingWindowFont" to reflect user changes.
  • Removes direct FontFamily settings from controls and centralizes the update logic.
  • Replaces MDL2 with Fluent UI for context menu icons.

Reviewed Changes

Copilot reviewed 2 out of 12 changed files in this pull request and generated 2 comments.

File Description
Flow.Launcher/App.xaml.cs Sets the "SettingWindowFont" resource during main window initialization.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Updates the "SettingWindowFont" resource in the property setter for dynamic font updates.
Files not reviewed (10)
  • Flow.Launcher/CustomQueryHotkeySetting.xaml: Language not supported
  • Flow.Launcher/CustomShortcutSetting.xaml: Language not supported
  • Flow.Launcher/Languages/en.xaml: Language not supported
  • Flow.Launcher/Resources/CustomControlTemplate.xaml: Language not supported
  • Flow.Launcher/Resources/SettingWindowStyle.xaml: Language not supported
  • Flow.Launcher/SelectBrowserWindow.xaml: Language not supported
  • Flow.Launcher/SelectFileManagerWindow.xaml: Language not supported
  • Flow.Launcher/SettingPages/Views/SettingsPaneAbout.xaml: Language not supported
  • Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml: Language not supported
  • Flow.Launcher/WelcomeWindow.xaml: Language not supported

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Jack251970
Jack251970 previously approved these changes Apr 24, 2025
@Jack251970
Copy link
Contributor

I put all changes in #3486. And all things look good to me. Tested.

This comment has been minimized.

@Jack251970 Jack251970 requested a review from Copilot April 24, 2025 14:07
Copy link
Contributor

@Copilot 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 refactors several components to improve the dynamic update of font settings, refines view model initialization, updates error logging, and cleans up dependency injection setup.

  • Dynamically update and synchronize font resources for settings and content controls.
  • Refactor view model initialization for welcome pages and update notify icon/context menu handling.
  • Improve dependency injection, error logging, and code comments for clarity.

Reviewed Changes

Copilot reviewed 43 out of 54 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs Refactored view model initialization and updated Settings access modifiers.
Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs Similar refactoring as WelcomePage2 with improved dependency injection.
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs Enhanced null-check handling using pattern matching.
Flow.Launcher/MainWindow.xaml.cs Reorganized notify icon and context menu initialization; improved logging.
Flow.Launcher/CustomShortcutSetting.xaml.cs Removed redundant dependency injection for Settings.
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs Updated settings injection pattern.
Flow.Launcher/App.xaml.cs Refined dependency injection and dynamic resource updates; improved logging.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Updated font setter to update dynamic resources on change.
Flow.Launcher/Core/Plugin/JsonRPCPluginSettings.cs Minor change in control creation logic with null-forgiving operator.
Files not reviewed (11)
  • Flow.Launcher/ActionKeywords.xaml: Language not supported
  • Flow.Launcher/CustomQueryHotkeySetting.xaml: Language not supported
  • Flow.Launcher/CustomShortcutSetting.xaml: Language not supported
  • Flow.Launcher/HotkeyControl.xaml: Language not supported
  • Flow.Launcher/HotkeyControlDialog.xaml: Language not supported
  • Flow.Launcher/Languages/en.xaml: Language not supported
  • Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml: Language not supported
  • Flow.Launcher/Resources/CustomControlTemplate.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage1.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage2.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage3.xaml: Language not supported

@@ -270,6 +271,9 @@ private async void OnLoaded(object sender, RoutedEventArgs _)
case nameof(Settings.KeepMaxResults):
SetupResizeMode();
break;
case nameof(Settings.SettingWindowFont):
InitializeContextMenu();
Copy link
Preview

Copilot AI Apr 24, 2025

Choose a reason for hiding this comment

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

Reinitializing the entire context menu when the font setting changes may lead to unintended side effects. Consider updating only the context menu text or related dynamic styles to better isolate the font change behavior.

Suggested change
InitializeContextMenu();
foreach (var item in _contextMenu.Items)
{
if (item is MenuItem menuItem)
{
menuItem.FontFamily = new FontFamily(_settings.SettingWindowFont);
menuItem.FontSize = _settings.FontSize; // Assuming FontSize is part of settings
}
}

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@Jack251970 Jack251970 Apr 24, 2025

Choose a reason for hiding this comment

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

It cannot work here. We must recreate menu items here.

Comment on lines +160 to +163
// Update dynamic resources base on settings
Current.Resources["SettingWindowFont"] = new FontFamily(_settings.SettingWindowFont);
Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(_settings.SettingWindowFont);

Copy link
Preview

Copilot AI Apr 24, 2025

Choose a reason for hiding this comment

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

Dynamic resource updates for font families are performed both here and in the Settings property setter. Consider consolidating this logic to a single location to avoid redundant or conflicting updates.

Suggested change
// Update dynamic resources base on settings
Current.Resources["SettingWindowFont"] = new FontFamily(_settings.SettingWindowFont);
Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(_settings.SettingWindowFont);
// Update dynamic resources based on settings
UpdateFontFamilyResources();

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Choose a reason for hiding this comment

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

No need to do so

.AddSingleton<IAlphabet, PinyinAlphabet>()
.AddSingleton<StringMatcher>()
.AddSingleton<Internationalization>()
.AddSingleton<IPublicAPI, PublicAPIInstance>()
.AddSingleton<MainViewModel>()
.AddSingleton<Theme>()
// Welcome view model & setting window view model is very simple so we just use one instance
Copy link
Member

Choose a reason for hiding this comment

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

I am not convinced by this logic. What do you mean by simple and complex?

Copy link
Contributor

Choose a reason for hiding this comment

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

Previous version may confuse you and I have improved the code comments.

@Jack251970 Jack251970 added the enhancement New feature or request label Apr 25, 2025

This comment has been minimized.

@Jack251970 Jack251970 requested a review from taooceros April 25, 2025 01:09

This comment has been minimized.

This comment has been minimized.

Jack251970
Jack251970 previously approved these changes Apr 25, 2025
@Jack251970 Jack251970 requested a review from Copilot April 25, 2025 01:17
Copy link
Contributor

@Copilot 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 improves the settings window font behavior, refines XAML style formatting, adjusts log messages, and enhances overall code quality and dependency injection across the application. Key changes include dynamic font updates without explicit FontFamily settings for controls, refactored viewmodel and settings initialization, and revised context menu/notify icon handling for better responsiveness.

Reviewed Changes

Copilot reviewed 44 out of 55 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Flow.Launcher/Resources/Pages/WelcomePage2.xaml.cs Refactored settings and viewmodel initialization to use private setters and fields.
Flow.Launcher/Resources/Pages/WelcomePage1.xaml.cs Similar refactoring with duplicate settings property removal and improved dependency injection.
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs Updated dependency property change handling using pattern matching for cleaner code.
Flow.Launcher/MainWindow.xaml.cs Revised context menu initialization and notify icon event handling, with enhanced logging and comments.
Flow.Launcher/CustomShortcutSetting.xaml.cs Removed direct injection of Settings to favor a more explicit dependency approach.
Flow.Launcher/CustomQueryHotkeySetting.xaml.cs Improved consistency by replacing a public Settings property with a private field.
Flow.Launcher/App.xaml.cs Adjusted dependency injection setup, dynamic resource updates, and log message formatting.
Flow.Launcher/Infrastructure/UserSettings/Settings.cs Added dynamic updating of application resources when the SettingWindowFont property changes.
Flow.Launcher/Core/Plugin/JsonRPCPluginSettings.cs Introduced an explicit check for creating a setting panel, with a null-forgiving operator usage.
Files not reviewed (11)
  • Flow.Launcher/ActionKeywords.xaml: Language not supported
  • Flow.Launcher/CustomQueryHotkeySetting.xaml: Language not supported
  • Flow.Launcher/CustomShortcutSetting.xaml: Language not supported
  • Flow.Launcher/HotkeyControl.xaml: Language not supported
  • Flow.Launcher/HotkeyControlDialog.xaml: Language not supported
  • Flow.Launcher/Languages/en.xaml: Language not supported
  • Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml: Language not supported
  • Flow.Launcher/Resources/CustomControlTemplate.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage1.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage2.xaml: Language not supported
  • Flow.Launcher/Resources/Pages/WelcomePage3.xaml: Language not supported
Comments suppressed due to low confidence (1)

Flow.Launcher/Core/Plugin/JsonRPCPluginSettings.cs:157

  • Using the null-forgiving operator to return null may hide potential null reference issues at runtime. Consider explicitly returning null or handling the case so that callers can safely process a missing setting panel.
if (!NeedCreateSettingPanel()) return null!;

Copy link

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors Count
❌ forbidden-pattern 24
⚠️ non-alpha-in-dictionary 19

See ❌ Event descriptions for more information.

Forbidden patterns 🙅 (1)

In order to address this, you could change the content to not match the forbidden patterns (comments before forbidden patterns may help explain why they're forbidden), add patterns for acceptable instances, or adjust the forbidden patterns themselves.

These forbidden patterns matched content:

s.b. workaround(s)

\bwork[- ]arounds?\b
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

@onesounds onesounds enabled auto-merge April 25, 2025 02:24
@onesounds onesounds merged commit 25ae2da into Flow-Launcher:dev Apr 25, 2025
5 checks passed
@jjw24 jjw24 removed bug Something isn't working Dev branch only An issue or fix for the Dev branch build labels Apr 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Quality enhancement New feature or request kind/ui related to UI, icons, themes, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants