44using System . Drawing ;
55using System . Text . Json . Serialization ;
66using System . Windows ;
7+ using Flow . Launcher . Infrastructure . Hotkey ;
78using Flow . Launcher . Plugin ;
89using Flow . Launcher . Plugin . SharedModels ;
910using Flow . Launcher . ViewModel ;
1011
1112namespace Flow . Launcher . Infrastructure . UserSettings
1213{
13- public class Settings : BaseModel
14+ public class Settings : BaseModel , IHotkeySettings
1415 {
1516 private string language = "en" ;
1617 private string _theme = Constant . DefaultTheme ;
@@ -207,17 +208,17 @@ public string QuerySearchPrecisionString
207208
208209 public double WindowLeft { get ; set ; }
209210 public double WindowTop { get ; set ; }
210-
211+
211212 /// <summary>
212213 /// Custom left position on selected monitor
213214 /// </summary>
214215 public double CustomWindowLeft { get ; set ; } = 0 ;
215-
216+
216217 /// <summary>
217218 /// Custom top position on selected monitor
218219 /// </summary>
219220 public double CustomWindowTop { get ; set ; } = 0 ;
220-
221+
221222 public int MaxResultsToShow { get ; set ; } = 5 ;
222223 public int ActivateTimes { get ; set ; }
223224
@@ -229,7 +230,7 @@ public string QuerySearchPrecisionString
229230 [ JsonIgnore ]
230231 public ObservableCollection < BuiltinShortcutModel > BuiltinShortcuts { get ; set ; } = new ( )
231232 {
232- new BuiltinShortcutModel ( "{clipboard}" , "shortcut_clipboard_description" , Clipboard . GetText ) ,
233+ new BuiltinShortcutModel ( "{clipboard}" , "shortcut_clipboard_description" , Clipboard . GetText ) ,
233234 new BuiltinShortcutModel ( "{active_explorer_path}" , "shortcut_active_explorer_path" , FileExplorerHelper . GetActiveExplorerPath )
234235 } ;
235236
@@ -253,7 +254,7 @@ public bool HideNotifyIcon
253254
254255 [ JsonConverter ( typeof ( JsonStringEnumConverter ) ) ]
255256 public SearchWindowScreens SearchWindowScreen { get ; set ; } = SearchWindowScreens . Cursor ;
256-
257+
257258 [ JsonConverter ( typeof ( JsonStringEnumConverter ) ) ]
258259 public SearchWindowAligns SearchWindowAlign { get ; set ; } = SearchWindowAligns . Center ;
259260
@@ -273,6 +274,78 @@ public bool HideNotifyIcon
273274
274275 // This needs to be loaded last by staying at the bottom
275276 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+ }
276349 }
277350
278351 public enum LastQueryMode
@@ -288,7 +361,7 @@ public enum ColorSchemes
288361 Light ,
289362 Dark
290363 }
291-
364+
292365 public enum SearchWindowScreens
293366 {
294367 RememberLastLaunchLocation ,
@@ -297,7 +370,7 @@ public enum SearchWindowScreens
297370 Primary ,
298371 Custom
299372 }
300-
373+
301374 public enum SearchWindowAligns
302375 {
303376 Center ,
0 commit comments