@@ -57,22 +57,7 @@ internal static void OnHotkey(object sender, HotkeyEventArgs e)
57
57
{
58
58
if ( ! ShouldIgnoreHotkeys ( ) )
59
59
{
60
- if ( settings . LastQueryMode == LastQueryMode . Empty )
61
- {
62
- mainViewModel . ChangeQueryText ( string . Empty ) ;
63
- }
64
- else if ( settings . LastQueryMode == LastQueryMode . Preserved )
65
- {
66
- mainViewModel . LastQuerySelected = true ;
67
- }
68
- else if ( settings . LastQueryMode == LastQueryMode . Selected )
69
- {
70
- mainViewModel . LastQuerySelected = false ;
71
- }
72
- else
73
- {
74
- throw new ArgumentException ( $ "wrong LastQueryMode: <{ settings . LastQueryMode } >") ;
75
- }
60
+ UpdateLastQUeryMode ( ) ;
76
61
77
62
mainViewModel . ToggleFlowLauncher ( ) ;
78
63
e . Handled = true ;
@@ -87,14 +72,37 @@ private static bool ShouldIgnoreHotkeys()
87
72
return settings . IgnoreHotkeysOnFullscreen && WindowsInteropHelper . IsWindowFullscreen ( ) ;
88
73
}
89
74
75
+ private static void UpdateLastQUeryMode ( )
76
+ {
77
+ switch ( settings . LastQueryMode )
78
+ {
79
+ case LastQueryMode . Empty :
80
+ mainViewModel . ChangeQueryText ( string . Empty ) ;
81
+ break ;
82
+ case LastQueryMode . Preserved :
83
+ mainViewModel . LastQuerySelected = true ;
84
+ break ;
85
+ case LastQueryMode . Selected :
86
+ mainViewModel . LastQuerySelected = false ;
87
+ break ;
88
+ default :
89
+ throw new ArgumentException ( $ "wrong LastQueryMode: <{ settings . LastQueryMode } >") ;
90
+
91
+ }
92
+ }
93
+
90
94
private static void SetCustomPluginHotkey ( )
91
95
{
92
96
if ( settings . CustomPluginHotkeys == null ) return ;
93
97
foreach ( CustomPluginHotkey hotkey in settings . CustomPluginHotkeys )
94
98
{
95
99
SetHotkey ( hotkey . Hotkey , ( s , e ) =>
96
100
{
97
- if ( ShouldIgnoreHotkeys ( ) ) return ;
101
+ if ( ShouldIgnoreHotkeys ( ) )
102
+ return ;
103
+
104
+ UpdateLastQUeryMode ( ) ;
105
+
98
106
mainViewModel . MainWindowVisibility = Visibility . Visible ;
99
107
mainViewModel . ChangeQueryText ( hotkey . ActionKeyword ) ;
100
108
} ) ;
0 commit comments