44using System . Threading ;
55using System . Threading . Tasks ;
66using System . Windows ;
7- using System . Windows . Input ;
87using Flow . Launcher . Core . Plugin ;
98using Flow . Launcher . Core . Resource ;
109using Flow . Launcher . Helper ;
2423using System . Collections . Specialized ;
2524using CommunityToolkit . Mvvm . Input ;
2625using System . Globalization ;
27- using System . Windows . Threading ;
2826
2927namespace Flow . Launcher . ViewModel
3028{
3129 public partial class MainViewModel : BaseModel , ISavable
3230 {
3331 #region Private Fields
3432
35- private const string DefaultOpenResultModifiers = "Alt" ;
36-
3733 private bool _isQueryRunning ;
3834 private Query _lastQuery ;
3935 private string _queryTextBeforeLeaveResults ;
@@ -74,6 +70,9 @@ public MainViewModel(Settings settings)
7470 case nameof ( Settings . AlwaysStartEn ) :
7571 OnPropertyChanged ( nameof ( StartWithEnglishMode ) ) ;
7672 break ;
73+ case nameof ( Settings . OpenResultModifiers ) :
74+ OnPropertyChanged ( nameof ( OpenResultCommandModifiers ) ) ;
75+ break ;
7776 }
7877 } ;
7978
@@ -102,9 +101,7 @@ public MainViewModel(Settings settings)
102101
103102 RegisterViewUpdate ( ) ;
104103 RegisterResultsUpdatedEvent ( ) ;
105- RegisterClockAndDateUpdateAsync ( ) ;
106-
107- SetOpenResultModifiers ( ) ;
104+ _ = RegisterClockAndDateUpdateAsync ( ) ;
108105 }
109106
110107 private void RegisterViewUpdate ( )
@@ -136,8 +133,6 @@ async Task updateAction()
136133 Log . Error ( "MainViewModel" , "Unexpected ResultViewUpdate ends" ) ;
137134 }
138135
139- ;
140-
141136 void continueAction ( Task t )
142137 {
143138#if DEBUG
@@ -181,6 +176,7 @@ private async Task ReloadPluginDataAsync()
181176 await PluginManager . ReloadDataAsync ( ) . ConfigureAwait ( false ) ;
182177 Notification . Show ( InternationalizationManager . Instance . GetTranslation ( "success" ) , InternationalizationManager . Instance . GetTranslation ( "completedSuccessfully" ) ) ;
183178 }
179+
184180 [ RelayCommand ]
185181 private void LoadHistory ( )
186182 {
@@ -194,6 +190,7 @@ private void LoadHistory()
194190 SelectedResults = Results ;
195191 }
196192 }
193+
197194 [ RelayCommand ]
198195 private void LoadContextMenu ( )
199196 {
@@ -209,6 +206,7 @@ private void LoadContextMenu()
209206 SelectedResults = Results ;
210207 }
211208 }
209+
212210 [ RelayCommand ]
213211 private void Backspace ( object index )
214212 {
@@ -221,6 +219,7 @@ private void Backspace(object index)
221219
222220 ChangeQueryText ( $ "{ actionKeyword } { path } ") ;
223221 }
222+
224223 [ RelayCommand ]
225224 private void AutocompleteQuery ( )
226225 {
@@ -247,6 +246,7 @@ private void AutocompleteQuery()
247246 ChangeQueryText ( autoCompleteText ) ;
248247 }
249248 }
249+
250250 [ RelayCommand ]
251251 private async Task OpenResultAsync ( string index )
252252 {
@@ -281,6 +281,7 @@ private async Task OpenResultAsync(string index)
281281 SelectedResults = Results ;
282282 }
283283 }
284+
284285 [ RelayCommand ]
285286 private void OpenSetting ( )
286287 {
@@ -298,6 +299,7 @@ private void SelectFirstResult()
298299 {
299300 SelectedResults . SelectFirstResult ( ) ;
300301 }
302+
301303 [ RelayCommand ]
302304 private void SelectPrevPage ( )
303305 {
@@ -309,11 +311,13 @@ private void SelectNextPage()
309311 {
310312 SelectedResults . SelectNextPage ( ) ;
311313 }
314+
312315 [ RelayCommand ]
313316 private void SelectPrevItem ( )
314317 {
315318 SelectedResults . SelectPrevResult ( ) ;
316319 }
320+
317321 [ RelayCommand ]
318322 private void SelectNextItem ( )
319323 {
@@ -333,6 +337,12 @@ private void Esc()
333337 }
334338 }
335339
340+ [ RelayCommand ]
341+ public void ToggleGameMode ( )
342+ {
343+ GameModeStatus = ! GameModeStatus ;
344+ }
345+
336346 #endregion
337347
338348 #region ViewModel Properties
@@ -361,7 +371,7 @@ private async Task RegisterClockAndDateUpdateAsync()
361371
362372 public ResultsViewModel History { get ; private set ; }
363373
364- public bool GameModeStatus { get ; set ; }
374+ public bool GameModeStatus { get ; set ; } = false ;
365375
366376 private string _queryText ;
367377 public string QueryText
@@ -375,7 +385,6 @@ public string QueryText
375385 }
376386 }
377387
378-
379388 [ RelayCommand ]
380389 private void IncreaseWidth ( )
381390 {
@@ -513,14 +522,16 @@ public double MainWindowWidth
513522
514523 public string PluginIconPath { get ; set ; } = null ;
515524
516- public string OpenResultCommandModifiers { get ; private set ; }
525+ public string OpenResultCommandModifiers => Settings . OpenResultModifiers ;
517526
518527 public string Image => Constant . QueryTextBoxIconImagePath ;
519528
520529 public bool StartWithEnglishMode => Settings . AlwaysStartEn ;
521530
522531 #endregion
523532
533+ #region Query
534+
524535 public void Query ( )
525536 {
526537 if ( SelectedIsFromQueryResults ( ) )
@@ -874,12 +885,9 @@ private bool HistorySelected()
874885 return selected ;
875886 }
876887
877- #region Hotkey
888+ #endregion
878889
879- private void SetOpenResultModifiers ( )
880- {
881- OpenResultCommandModifiers = Settings . OpenResultModifiers ?? DefaultOpenResultModifiers ;
882- }
890+ #region Hotkey
883891
884892 public void ToggleFlowLauncher ( )
885893 {
@@ -934,18 +942,15 @@ public async void Hide()
934942 MainWindowVisibility = Visibility . Collapsed ;
935943 }
936944
937- #endregion
938-
939-
940945 /// <summary>
941946 /// Checks if Flow Launcher should ignore any hotkeys
942947 /// </summary>
943948 public bool ShouldIgnoreHotkeys ( )
944949 {
945- return Settings . IgnoreHotkeysOnFullscreen && WindowsInteropHelper . IsWindowFullscreen ( ) ;
950+ return Settings . IgnoreHotkeysOnFullscreen && WindowsInteropHelper . IsWindowFullscreen ( ) || GameModeStatus ;
946951 }
947952
948-
953+ #endregion
949954
950955 #region Public Methods
951956
0 commit comments