Skip to content

Support Showing Search Window at Topmost #3541

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
merged 7 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 31 additions & 8 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,19 @@ public string Language
get => _language;
set
{
_language = value;
OnPropertyChanged();
if (_language != value)
{
_language = value;
OnPropertyChanged();
}
}
}
public string Theme
{
get => _theme;
set
{
if (value != _theme)
if (_theme != value)
{
_theme = value;
OnPropertyChanged();
Expand Down Expand Up @@ -297,9 +300,12 @@ public SearchPrecisionScore QuerySearchPrecision
get => _querySearchPrecision;
set
{
_querySearchPrecision = value;
if (_stringMatcher != null)
_stringMatcher.UserSettingSearchPrecision = value;
if (_querySearchPrecision != value)
{
_querySearchPrecision = value;
if (_stringMatcher != null)
_stringMatcher.UserSettingSearchPrecision = value;
}
}
}

Expand Down Expand Up @@ -366,13 +372,30 @@ public bool HideNotifyIcon
get => _hideNotifyIcon;
set
{
_hideNotifyIcon = value;
OnPropertyChanged();
if (_hideNotifyIcon != value)
{
_hideNotifyIcon = value;
OnPropertyChanged();
}
}
}
public bool LeaveCmdOpen { get; set; }
public bool HideWhenDeactivated { get; set; } = true;

private bool _showAtTopmost = true;
public bool ShowAtTopmost
{
get => _showAtTopmost;
set
{
if (_showAtTopmost != value)
{
_showAtTopmost = value;
OnPropertyChanged();
}
}
}

public bool SearchQueryResultsWithDelay { get; set; }
public int SearchDelayTime { get; set; } = 150;

Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/Languages/en.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@
<system:String x:Key="historyResultsForHomePage">Show History Results in Home Page</system:String>
<system:String x:Key="historyResultsCountForHomePage">Maximum History Results Shown in Home Page</system:String>
<system:String x:Key="homeToggleBoxToolTip">This can only be edited if plugin supports Home feature and Home Page is enabled.</system:String>
<system:String x:Key="showAtTopmost">Show Search Window at Topmost</system:String>
<system:String x:Key="showAtTopmostToolTip">Show search window above other windows</system:String>

<!-- Setting Plugin -->
<system:String x:Key="searchplugin">Search Plugin</system:String>
Expand Down
5 changes: 5 additions & 0 deletions Flow.Launcher/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
private bool _isArrowKeyPressed = false;

// Window Sound Effects
private MediaPlayer animationSoundWMP;

Check warning on line 61 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`WMP` is not a recognized word. (unrecognized-spelling)
private SoundPlayer animationSoundWPF;

// Window WndProc
Expand All @@ -79,11 +79,13 @@

public MainWindow()
{
_settings = Ioc.Default.GetRequiredService<Settings>();

Check warning on line 82 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
_theme = Ioc.Default.GetRequiredService<Theme>();

Check warning on line 83 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
_viewModel = Ioc.Default.GetRequiredService<MainViewModel>();

Check warning on line 84 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Ioc` is not a recognized word. (unrecognized-spelling)
DataContext = _viewModel;

Topmost = _settings.ShowAtTopmost;

InitializeComponent();
UpdatePosition();

Expand All @@ -108,7 +110,7 @@
{
var handle = Win32Helper.GetWindowHandle(this, true);
_hwndSource = HwndSource.FromHwnd(handle);
_hwndSource.AddHook(WndProc);

Check warning on line 113 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
Win32Helper.HideFromAltTab(this);
Win32Helper.DisableControlBox(this);
}
Expand Down Expand Up @@ -289,6 +291,9 @@
_viewModel.QueryResults();
}
break;
case nameof(Settings.ShowAtTopmost):
Topmost = _settings.ShowAtTopmost;
break;
}
};

Expand Down Expand Up @@ -333,7 +338,7 @@
{
try
{
_hwndSource.RemoveHook(WndProc);

Check warning on line 341 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)
}
catch (Exception)
{
Expand Down Expand Up @@ -457,7 +462,7 @@
}
}

#pragma warning restore VSTHRD100 // Avoid async void methods

Check warning on line 465 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)

#endregion

Expand All @@ -472,7 +477,7 @@

#region Window Context Menu Event

#pragma warning disable VSTHRD100 // Avoid async void methods

Check warning on line 480 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)

private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs e)
{
Expand All @@ -484,11 +489,11 @@
App.API.OpenSettingDialog();
}

#pragma warning restore VSTHRD100 // Avoid async void methods

Check warning on line 492 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`VSTHRD` is not a recognized word. (unrecognized-spelling)

#endregion

#region Window WndProc

Check warning on line 496 in Flow.Launcher/MainWindow.xaml.cs

View workflow job for this annotation

GitHub Actions / Check Spelling

`Wnd` is not a recognized word. (unrecognized-spelling)

private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
Expand Down
11 changes: 11 additions & 0 deletions Flow.Launcher/SettingPages/Views/SettingsPaneGeneral.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@
OnContent="{DynamicResource enable}" />
</cc:Card>

<cc:Card
Title="{DynamicResource showAtTopmost}"
Margin="0 14 0 0"
Icon="&#xE923;"
Sub="{DynamicResource showAtTopmostToolTip}">
<ui:ToggleSwitch
IsOn="{Binding Settings.ShowAtTopmost}"
OffContent="{DynamicResource disable}"
OnContent="{DynamicResource enable}" />
</cc:Card>

<cc:CardGroup Margin="0 14 0 0">
<cc:Card Title="{DynamicResource SearchWindowPosition}" Icon="&#xe7f4;">
<StackPanel Orientation="Horizontal">
Expand Down
Loading