4
4
using System . Drawing ;
5
5
using System . Text . Json . Serialization ;
6
6
using System . Windows ;
7
+ using Flow . Launcher . Infrastructure . Hotkey ;
7
8
using Flow . Launcher . Plugin ;
8
9
using Flow . Launcher . Plugin . SharedModels ;
9
10
using Flow . Launcher . ViewModel ;
10
11
11
12
namespace Flow . Launcher . Infrastructure . UserSettings
12
13
{
13
- public class Settings : BaseModel
14
+ public class Settings : BaseModel , IHotkeySettings
14
15
{
15
16
private string language = "en" ;
16
17
private string _theme = Constant . DefaultTheme ;
@@ -207,17 +208,17 @@ public string QuerySearchPrecisionString
207
208
208
209
public double WindowLeft { get ; set ; }
209
210
public double WindowTop { get ; set ; }
210
-
211
+
211
212
/// <summary>
212
213
/// Custom left position on selected monitor
213
214
/// </summary>
214
215
public double CustomWindowLeft { get ; set ; } = 0 ;
215
-
216
+
216
217
/// <summary>
217
218
/// Custom top position on selected monitor
218
219
/// </summary>
219
220
public double CustomWindowTop { get ; set ; } = 0 ;
220
-
221
+
221
222
public int MaxResultsToShow { get ; set ; } = 5 ;
222
223
public int ActivateTimes { get ; set ; }
223
224
@@ -229,7 +230,7 @@ public string QuerySearchPrecisionString
229
230
[ JsonIgnore ]
230
231
public ObservableCollection < BuiltinShortcutModel > BuiltinShortcuts { get ; set ; } = new ( )
231
232
{
232
- new BuiltinShortcutModel ( "{clipboard}" , "shortcut_clipboard_description" , Clipboard . GetText ) ,
233
+ new BuiltinShortcutModel ( "{clipboard}" , "shortcut_clipboard_description" , Clipboard . GetText ) ,
233
234
new BuiltinShortcutModel ( "{active_explorer_path}" , "shortcut_active_explorer_path" , FileExplorerHelper . GetActiveExplorerPath )
234
235
} ;
235
236
@@ -253,7 +254,7 @@ public bool HideNotifyIcon
253
254
254
255
[ JsonConverter ( typeof ( JsonStringEnumConverter ) ) ]
255
256
public SearchWindowScreens SearchWindowScreen { get ; set ; } = SearchWindowScreens . Cursor ;
256
-
257
+
257
258
[ JsonConverter ( typeof ( JsonStringEnumConverter ) ) ]
258
259
public SearchWindowAligns SearchWindowAlign { get ; set ; } = SearchWindowAligns . Center ;
259
260
@@ -273,6 +274,82 @@ public bool HideNotifyIcon
273
274
274
275
// This needs to be loaded last by staying at the bottom
275
276
public PluginsSettings PluginSettings { get ; set ; } = new PluginsSettings ( ) ;
277
+
278
+ [ JsonIgnore ]
279
+ public List < RegisteredHotkeyData > RegisteredHotkeys
280
+ {
281
+ get
282
+ {
283
+ var list = new List < RegisteredHotkeyData >
284
+ {
285
+ new ( "Up" , "HotkeyLeftRightDesc" ) ,
286
+ new ( "Down" , "HotkeyLeftRightDesc" ) ,
287
+ new ( "Left" , "HotkeyUpDownDesc" ) ,
288
+ new ( "Right" , "HotkeyUpDownDesc" ) ,
289
+ new ( "Escape" , "HotkeyESCDesc" ) ,
290
+ new ( "F5" , "ReloadPluginHotkey" ) ,
291
+ new ( "Alt+Home" , "HotkeySelectFirstResult" ) ,
292
+ new ( "Alt+End" , "HotkeySelectLastResult" ) ,
293
+ new ( "Ctrl+R" , "HotkeyRequery" ) ,
294
+ new ( "Ctrl+H" , "ToggleHistoryHotkey" ) ,
295
+ new ( "Ctrl+OemCloseBrackets" , "QuickWidthHotkey" ) ,
296
+ new ( "Ctrl+OemOpenBrackets" , "QuickWidthHotkey" ) ,
297
+ new ( "Ctrl+OemPlus" , "QuickHeightHotkey" ) ,
298
+ new ( "Ctrl+OemMinus" , "QuickHeightHotkey" ) ,
299
+ new ( "Ctrl+Shift+Enter" , "HotkeyCtrlShiftEnterDesc" ) ,
300
+ new ( "Shift+Enter" , "OpenContextMenuHotkey" ) ,
301
+ new ( "Enter" , "HotkeyRunDesc" ) ,
302
+ new ( "Ctrl+Enter" , "OpenContainFolderHotkey" ) ,
303
+ new ( "Alt+Enter" , "HotkeyOpenResult" ) ,
304
+ new ( "Ctrl+F12" , "ToggleGameModeHotkey" ) ,
305
+ new ( "Ctrl+Shift+C" , "CopyFilePathHotkey" ) ,
306
+
307
+ new ( $ "{ OpenResultModifiers } +D1", "HotkeyOpenResultN" , 1 ) ,
308
+ new ( $ "{ OpenResultModifiers } +D2", "HotkeyOpenResultN" , 2 ) ,
309
+ new ( $ "{ OpenResultModifiers } +D3", "HotkeyOpenResultN" , 3 ) ,
310
+ new ( $ "{ OpenResultModifiers } +D4", "HotkeyOpenResultN" , 4 ) ,
311
+ new ( $ "{ OpenResultModifiers } +D5", "HotkeyOpenResultN" , 5 ) ,
312
+ new ( $ "{ OpenResultModifiers } +D6", "HotkeyOpenResultN" , 6 ) ,
313
+ new ( $ "{ OpenResultModifiers } +D7", "HotkeyOpenResultN" , 7 ) ,
314
+ new ( $ "{ OpenResultModifiers } +D8", "HotkeyOpenResultN" , 8 ) ,
315
+ new ( $ "{ OpenResultModifiers } +D9", "HotkeyOpenResultN" , 9 ) ,
316
+ new ( $ "{ OpenResultModifiers } +D0", "HotkeyOpenResultN" , 10 )
317
+ } ;
318
+
319
+ if ( ! string . IsNullOrEmpty ( Hotkey ) )
320
+ list . Add ( new ( Hotkey , "flowlauncherHotkey" , ( ) => Hotkey = "" ) ) ;
321
+ if ( ! string . IsNullOrEmpty ( PreviewHotkey ) )
322
+ list . Add ( new ( PreviewHotkey , "previewHotkey" , ( ) => PreviewHotkey = "" ) ) ;
323
+ if ( ! string . IsNullOrEmpty ( AutoCompleteHotkey ) )
324
+ list . Add ( new ( AutoCompleteHotkey , "autoCompleteHotkey" , ( ) => AutoCompleteHotkey = "" ) ) ;
325
+ if ( ! string . IsNullOrEmpty ( AutoCompleteHotkey2 ) )
326
+ list . Add ( new ( AutoCompleteHotkey2 , "autoCompleteHotkey" , ( ) => AutoCompleteHotkey2 = "" ) ) ;
327
+ if ( ! string . IsNullOrEmpty ( SelectNextItemHotkey ) )
328
+ list . Add ( new ( SelectNextItemHotkey , "SelectNextItemHotkey" , ( ) => SelectNextItemHotkey = "" ) ) ;
329
+ if ( ! string . IsNullOrEmpty ( SelectNextItemHotkey2 ) )
330
+ list . Add ( new ( SelectNextItemHotkey2 , "SelectNextItemHotkey" , ( ) => SelectNextItemHotkey2 = "" ) ) ;
331
+ if ( ! string . IsNullOrEmpty ( SelectPrevItemHotkey ) )
332
+ list . Add ( new ( SelectPrevItemHotkey , "SelectPrevItemHotkey" , ( ) => SelectPrevItemHotkey = "" ) ) ;
333
+ if ( ! string . IsNullOrEmpty ( SelectPrevItemHotkey2 ) )
334
+ list . Add ( new ( SelectPrevItemHotkey2 , "SelectPrevItemHotkey" , ( ) => SelectPrevItemHotkey2 = "" ) ) ;
335
+ if ( ! string . IsNullOrEmpty ( SettingWindowHotkey ) )
336
+ list . Add ( new ( SettingWindowHotkey , "SettingWindowHotkey" , ( ) => SettingWindowHotkey = "" ) ) ;
337
+ if ( ! string . IsNullOrEmpty ( OpenContextMenuHotkey ) )
338
+ list . Add ( new ( OpenContextMenuHotkey , "OpenContextMenuHotkey" , ( ) => OpenContextMenuHotkey = "" ) ) ;
339
+ if ( ! string . IsNullOrEmpty ( SelectNextPageHotkey ) )
340
+ list . Add ( new ( SelectNextPageHotkey , "SelectNextPageHotkey" , ( ) => SelectNextPageHotkey = "" ) ) ;
341
+ if ( ! string . IsNullOrEmpty ( SelectPrevPageHotkey ) )
342
+ list . Add ( new ( SelectPrevPageHotkey , "SelectPrevPageHotkey" , ( ) => SelectPrevPageHotkey = "" ) ) ;
343
+
344
+ foreach ( var customPluginHotkey in CustomPluginHotkeys )
345
+ {
346
+ if ( ! string . IsNullOrEmpty ( customPluginHotkey . Hotkey ) )
347
+ list . Add ( new ( customPluginHotkey . Hotkey , "customQueryHotkey" , ( ) => customPluginHotkey . Hotkey = "" ) ) ;
348
+ }
349
+
350
+ return list ;
351
+ }
352
+ }
276
353
}
277
354
278
355
public enum LastQueryMode
@@ -288,7 +365,7 @@ public enum ColorSchemes
288
365
Light ,
289
366
Dark
290
367
}
291
-
368
+
292
369
public enum SearchWindowScreens
293
370
{
294
371
RememberLastLaunchLocation ,
@@ -297,7 +374,7 @@ public enum SearchWindowScreens
297
374
Primary ,
298
375
Custom
299
376
}
300
-
377
+
301
378
public enum SearchWindowAligns
302
379
{
303
380
Center ,
0 commit comments