Skip to content

Add setting to select all query text on window reopen #3065

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

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions Flow.Launcher.Infrastructure/UserSettings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ public bool HideNotifyIcon
[JsonIgnore]
public bool WMPInstalled { get; set; } = true;

public bool SelectAllQueryOnReopen { get; set; } = true;

// This needs to be loaded last by staying at the bottom
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();

Expand Down
2 changes: 2 additions & 0 deletions Flow.Launcher/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Closing="OnClosing"
Deactivated="OnDeactivated"
Icon="Images/app.png"
Initialized="OnInitialized"

Check failure on line 24 in Flow.Launcher/MainWindow.xaml

View workflow job for this annotation

GitHub Actions / build

No overload for 'OnInitialized' matches delegate 'EventHandler'

Check failure on line 24 in Flow.Launcher/MainWindow.xaml

View workflow job for this annotation

GitHub Actions / build

No overload for 'OnInitialized' matches delegate 'EventHandler'
Left="{Binding Settings.WindowLeft, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Loaded="OnLoaded"
LocationChanged="OnLocationChanged"
Expand Down Expand Up @@ -248,6 +249,7 @@
FontSize="{Binding QueryBoxFontSize, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
InputMethod.PreferredImeConversionMode="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEConversionModeConverter}}"
InputMethod.PreferredImeState="{Binding StartWithEnglishMode, Converter={StaticResource BoolToIMEStateConverter}}"
Loaded="SelectAllQueryText"

Check failure on line 252 in Flow.Launcher/MainWindow.xaml

View workflow job for this annotation

GitHub Actions / build

No overload for 'SelectAllQueryText' matches delegate 'RoutedEventHandler'

Check failure on line 252 in Flow.Launcher/MainWindow.xaml

View workflow job for this annotation

GitHub Actions / build

No overload for 'SelectAllQueryText' matches delegate 'RoutedEventHandler'
PreviewDragOver="QueryTextBox_OnPreviewDragOver"
PreviewKeyUp="QueryTextBox_KeyUp"
Style="{DynamicResource QueryBoxStyle}"
Expand Down
10 changes: 10 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,9 +79,9 @@

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;

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

Check warning on line 111 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 @@ -292,6 +292,11 @@
}
};

if (_settings.SelectAllQueryOnReopen)
{
SelectAllQueryText();
}

// QueryTextBox.Text change detection (modified to only work when character count is 1 or higher)
QueryTextBox.TextChanged += (s, e) => UpdateClockPanelVisibility();

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 Down Expand Up @@ -520,7 +525,7 @@

#region Window Context Menu Event

#pragma warning disable VSTHRD100 // Avoid async void methods

Check warning on line 528 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 @@ -532,11 +537,11 @@
App.API.OpenSettingDialog();
}

#pragma warning restore VSTHRD100 // Avoid async void methods

Check warning on line 540 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 544 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 Expand Up @@ -1341,5 +1346,10 @@
}

#endregion

private void SelectAllQueryText()
{
QueryTextBox.SelectAll();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public bool StartFlowLauncherOnSystemStartup
}
}
}

public bool UseLogonTaskForStartup
{
get => Settings.UseLogonTaskForStartup;
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/SettingWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window
<Window
x:Class="Flow.Launcher.SettingWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Expand Down
Loading