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,78 @@ 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 ( "Escape" , "Escape" ) , // TODO
286
+ new ( "F5" , "ReloadPluginHotkey" ) , // TODO
287
+ new ( "Alt+Home" , "Select last result" ) , // TODO
288
+ new ( "Alt+End" , "Select last result" ) , // TODO
289
+ new ( "Ctrl+R" , "Requery" ) , // TODO
290
+ new ( "Ctrl+H" , "ToggleHistoryHotkey" ) , // TODO
291
+ new ( "Ctrl+OemCloseBrackets" , "QuickWidthHotkey" ) , // TODO
292
+ new ( "Ctrl+OemOpenBrackets" , "QuickWidthHotkey" ) , // TODO
293
+ new ( "Ctrl+OemPlus" , "QuickHeightHotkey" ) , // TODO
294
+ new ( "Ctrl+OemMinus" , "QuickHeightHotkey" ) , // TODO
295
+ new ( "Ctrl+Shift+Enter" , "HotkeyCtrlShiftEnterDesc" ) , // TODO
296
+ new ( "Shift+Enter" , "OpenContextMenuHotkey" ) , // TODO
297
+ new ( "Enter" , "HotkeyRunDesc" ) , // TODO
298
+ new ( "Ctrl+Enter" , "Open result" ) , // TODO
299
+ new ( "Alt+Enter" , "Open result" ) , // TODO
300
+ new ( "Ctrl+F12" , "ToggleGameModeHotkey" ) , // TODO
301
+ new ( "Ctrl+Shift+C" , "Copy alternative" ) , // TODO
302
+
303
+ new ( $ "{ OpenResultModifiers } +D1", "Open Result" ) , // TODO
304
+ new ( $ "{ OpenResultModifiers } +D2", "Open Result" ) , // TODO
305
+ new ( $ "{ OpenResultModifiers } +D3", "Open Result" ) , // TODO
306
+ new ( $ "{ OpenResultModifiers } +D4", "Open Result" ) , // TODO
307
+ new ( $ "{ OpenResultModifiers } +D5", "Open Result" ) , // TODO
308
+ new ( $ "{ OpenResultModifiers } +D6", "Open Result" ) , // TODO
309
+ new ( $ "{ OpenResultModifiers } +D7", "Open Result" ) , // TODO
310
+ new ( $ "{ OpenResultModifiers } +D8", "Open Result" ) , // TODO
311
+ new ( $ "{ OpenResultModifiers } +D9", "Open Result" ) , // TODO
312
+ new ( $ "{ OpenResultModifiers } +D0", "Open Result" ) , // TODO
313
+ } ;
314
+
315
+ if ( ! string . IsNullOrEmpty ( Hotkey ) )
316
+ list . Add ( new ( Hotkey , "Open main window" , ( ) => Hotkey = "" ) ) ; // TODO
317
+ if ( ! string . IsNullOrEmpty ( PreviewHotkey ) )
318
+ list . Add ( new ( PreviewHotkey , "Preview Hotkey" , ( ) => PreviewHotkey = "" ) ) ; // TODO
319
+ if ( ! string . IsNullOrEmpty ( AutoCompleteHotkey ) )
320
+ list . Add ( new ( AutoCompleteHotkey , "AutoCompleteHotkey" , ( ) => AutoCompleteHotkey = "" ) ) ; // TODO
321
+ if ( ! string . IsNullOrEmpty ( AutoCompleteHotkey2 ) )
322
+ list . Add ( new ( AutoCompleteHotkey2 , "AutoCompleteHotkey" , ( ) => AutoCompleteHotkey2 = "" ) ) ; // TODO
323
+ if ( ! string . IsNullOrEmpty ( SelectNextItemHotkey ) )
324
+ list . Add ( new ( SelectNextItemHotkey , "SelectNextItemHotkey" , ( ) => SelectNextItemHotkey = "" ) ) ; // TODO
325
+ if ( ! string . IsNullOrEmpty ( SelectNextItemHotkey2 ) )
326
+ list . Add ( new ( SelectNextItemHotkey2 , "SelectNextItemHotkey" , ( ) => SelectNextItemHotkey2 = "" ) ) ; // TODO
327
+ if ( ! string . IsNullOrEmpty ( SelectPrevItemHotkey ) )
328
+ list . Add ( new ( SelectPrevItemHotkey , "SelectPrevItemHotkey" , ( ) => SelectPrevItemHotkey = "" ) ) ; // TODO
329
+ if ( ! string . IsNullOrEmpty ( SelectPrevItemHotkey2 ) )
330
+ list . Add ( new ( SelectPrevItemHotkey2 , "SelectPrevItemHotkey" , ( ) => SelectPrevItemHotkey2 = "" ) ) ; // TODO
331
+ if ( ! string . IsNullOrEmpty ( SettingWindowHotkey ) )
332
+ list . Add ( new ( SettingWindowHotkey , "SettingWindowHotkey" , ( ) => SettingWindowHotkey = "" ) ) ; // TODO
333
+ if ( ! string . IsNullOrEmpty ( OpenContextMenuHotkey ) )
334
+ list . Add ( new ( OpenContextMenuHotkey , "OpenContextMenuHotkey" , ( ) => OpenContextMenuHotkey = "" ) ) ; // TODO
335
+ if ( ! string . IsNullOrEmpty ( SelectNextPageHotkey ) )
336
+ list . Add ( new ( SelectNextPageHotkey , "SelectNextPageHotkey" , ( ) => SelectNextPageHotkey = "" ) ) ; // TODO
337
+ if ( ! string . IsNullOrEmpty ( SelectPrevPageHotkey ) )
338
+ list . Add ( new ( SelectPrevPageHotkey , "SelectPrevPageHotkey" , ( ) => SelectPrevPageHotkey = "" ) ) ; // TODO
339
+
340
+ foreach ( var customPluginHotkey in CustomPluginHotkeys )
341
+ {
342
+ if ( ! string . IsNullOrEmpty ( customPluginHotkey . Hotkey ) )
343
+ list . Add ( new ( customPluginHotkey . Hotkey , "Custom plugin hotkey" , ( ) => customPluginHotkey . Hotkey = "" ) ) ; // TODO
344
+ }
345
+
346
+ return list ;
347
+ }
348
+ }
276
349
}
277
350
278
351
public enum LastQueryMode
@@ -288,7 +361,7 @@ public enum ColorSchemes
288
361
Light ,
289
362
Dark
290
363
}
291
-
364
+
292
365
public enum SearchWindowScreens
293
366
{
294
367
RememberLastLaunchLocation ,
@@ -297,7 +370,7 @@ public enum SearchWindowScreens
297
370
Primary ,
298
371
Custom
299
372
}
300
-
373
+
301
374
public enum SearchWindowAligns
302
375
{
303
376
Center ,
0 commit comments