From 8da182dd25f18583b88c4cff430b209008e55626 Mon Sep 17 00:00:00 2001 From: Koisu Date: Wed, 25 Jun 2025 10:37:01 -0700 Subject: [PATCH 1/2] Close window when escape pressed --- .../Views/RenameFile.xaml | 2 +- .../Views/RenameFile.xaml.cs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml index 0f1c5578a..ded2d9284 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml @@ -5,7 +5,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - Title="{DynamicResource plugin_explorer_manageactionkeywords_header}" + Title="" Height="180" MaxWidth="600" Background="{DynamicResource PopuBGColor}" diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs index 4591fa76e..0c50485f3 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs @@ -5,6 +5,7 @@ using System.Windows.Controls; using System.Windows.Input; using System.Windows.Threading; using CommunityToolkit.Mvvm.ComponentModel; +using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Plugin.Explorer.Helper; namespace Flow.Launcher.Plugin.Explorer.Views @@ -39,6 +40,14 @@ namespace Flow.Launcher.Plugin.Explorer.Views ShowInTaskbar = false; RenameTb.Focus(); + var window = Window.GetWindow(this); + window.KeyDown += (s, e) => + { + if (e.Key == Key.Escape) + { + Close(); + } + }; } /// @@ -55,10 +64,11 @@ namespace Flow.Launcher.Plugin.Explorer.Views else if (_info is FileInfo info) { string properName = Path.GetFileNameWithoutExtension(info.Name); - Application.Current.Dispatcher.Invoke(textBox.Select, DispatcherPriority.Background, textBox.Text.IndexOf(properName), properName.Length ); + Application.Current.Dispatcher.Invoke(textBox.Select, DispatcherPriority.Background, textBox.Text.IndexOf(properName), properName.Length); } } + private void OnDoneButtonClick(object sender, RoutedEventArgs e) { RenameThing.Rename(NewFileName, _info, _api); @@ -79,5 +89,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views e.Handled = true; } } + + } } From 043bf3ba0bb1e999eccd1b704668ec4027d4ee3a Mon Sep 17 00:00:00 2001 From: Koisu Date: Wed, 25 Jun 2025 10:40:30 -0700 Subject: [PATCH 2/2] remove unused using --- Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs index 0c50485f3..323bb912f 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/RenameFile.xaml.cs @@ -5,7 +5,6 @@ using System.Windows.Controls; using System.Windows.Input; using System.Windows.Threading; using CommunityToolkit.Mvvm.ComponentModel; -using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Plugin.Explorer.Helper; namespace Flow.Launcher.Plugin.Explorer.Views @@ -89,7 +88,5 @@ namespace Flow.Launcher.Plugin.Explorer.Views e.Handled = true; } } - - } }