Skip to content

Commit 2209bb2

Browse files
committed
Hotkey tab window add close window on Esc key press
1 parent 8f411d9 commit 2209bb2

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

Flow.Launcher/CustomQueryHotkeySetting.xaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
ResizeMode="NoResize"
77
WindowStartupLocation="CenterScreen"
88
Title="Custom Plugin Hotkey" Height="200" Width="674.766">
9+
<Window.InputBindings>
10+
<KeyBinding Key="Escape" Command="Close"/>
11+
</Window.InputBindings>
12+
<Window.CommandBindings>
13+
<CommandBinding Command="Close" Executed="cmdEsc_OnPress"/>
14+
</Window.CommandBindings>
915
<Grid>
1016
<Grid.RowDefinitions>
1117
<RowDefinition />

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using Flow.Launcher.Core.Resource;
2+
using Flow.Launcher.Infrastructure.Hotkey;
3+
using Flow.Launcher.Infrastructure.UserSettings;
4+
using NHotkey;
5+
using NHotkey.Wpf;
6+
using System;
37
using System.Collections.ObjectModel;
48
using System.Linq;
59
using System.Windows;
6-
using NHotkey;
7-
using NHotkey.Wpf;
8-
using Flow.Launcher.Core.Resource;
9-
using Flow.Launcher.Infrastructure.Hotkey;
10-
using Flow.Launcher.Infrastructure.UserSettings;
10+
using System.Windows.Input;
1111

1212
namespace Flow.Launcher
1313
{
@@ -125,5 +125,10 @@ private void SetHotkey(HotkeyModel hotkey, EventHandler<HotkeyEventArgs> action)
125125
MessageBox.Show(errorMsg);
126126
}
127127
}
128+
129+
private void cmdEsc_OnPress(object sender, ExecutedRoutedEventArgs e)
130+
{
131+
Close();
132+
}
128133
}
129134
}

0 commit comments

Comments
 (0)