Skip to content

Commit ae66a2c

Browse files
Merge branch 'dev' into add_nodejs_env
2 parents d386735 + 990ae3b commit ae66a2c

File tree

21 files changed

+65
-67
lines changed

21 files changed

+65
-67
lines changed

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Infrastructure.Hotkey;
1+
using Flow.Launcher.Infrastructure.Hotkey;
22
using Flow.Launcher.Infrastructure.UserSettings;
33
using System;
44
using NHotkey;
@@ -25,7 +25,7 @@ internal static void Initialize(MainViewModel mainVM)
2525

2626
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
2727
{
28-
if (!mainViewModel.ShouldIgnoreHotkeys() && !mainViewModel.GameModeStatus)
28+
if (!mainViewModel.ShouldIgnoreHotkeys())
2929
mainViewModel.ToggleFlowLauncher();
3030
}
3131

@@ -74,7 +74,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
7474
{
7575
SetHotkey(hotkey.Hotkey, (s, e) =>
7676
{
77-
if (mainViewModel.ShouldIgnoreHotkeys() || mainViewModel.GameModeStatus)
77+
if (mainViewModel.ShouldIgnoreHotkeys())
7878
return;
7979

8080
mainViewModel.Show();

Flow.Launcher/MainWindow.xaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,10 @@
8686
Key="O"
8787
Command="{Binding LoadContextMenuCommand}"
8888
Modifiers="Ctrl" />
89-
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
90-
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
9189
<KeyBinding
9290
Key="H"
9391
Command="{Binding LoadHistoryCommand}"
9492
Modifiers="Ctrl" />
95-
<KeyBinding Key="Right" Command="{Binding LoadContextMenuCommand}" />
96-
<KeyBinding Key="Left" Command="{Binding EscCommand}" />
9793
<KeyBinding
9894
Key="OemCloseBrackets"
9995
Command="{Binding IncreaseWidthCommand}"
@@ -181,6 +177,10 @@
181177
Command="{Binding OpenResultCommand}"
182178
CommandParameter="9"
183179
Modifiers="{Binding OpenResultCommandModifiers}" />
180+
<KeyBinding
181+
Key="F12"
182+
Command="{Binding ToggleGameModeCommand}"
183+
Modifiers="Ctrl"/>
184184
</Window.InputBindings>
185185
<Grid>
186186
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ private void OnCopy(object sender, ExecutedRoutedEventArgs e)
7070
_viewModel.ResultCopy(QueryTextBox.SelectedText);
7171
}
7272
}
73+
7374
private async void OnClosing(object sender, CancelEventArgs e)
7475
{
7576
_settings.WindowTop = Top;
@@ -100,6 +101,7 @@ private void OnLoaded(object sender, RoutedEventArgs _)
100101
// since the default main window visibility is visible
101102
// so we need set focus during startup
102103
QueryTextBox.Focus();
104+
103105
_viewModel.PropertyChanged += (o, e) =>
104106
{
105107
switch (e.PropertyName)
@@ -168,9 +170,12 @@ private void OnLoaded(object sender, RoutedEventArgs _)
168170
_viewModel.QueryTextCursorMovedToEnd = false;
169171
}
170172
break;
171-
173+
case nameof(MainViewModel.GameModeStatus):
174+
_notifyIcon.Icon = _viewModel.GameModeStatus ? Properties.Resources.gamemode : Properties.Resources.app;
175+
break;
172176
}
173177
};
178+
174179
_settings.PropertyChanged += (o, e) =>
175180
{
176181
switch (e.PropertyName)
@@ -285,7 +290,7 @@ private void InitializeNotifyIcon()
285290
};
286291

287292
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
288-
gamemode.Click += (o, e) => ToggleGameMode();
293+
gamemode.Click += (o, e) => _viewModel.ToggleGameMode();
289294
positionreset.Click += (o, e) => PositionReset();
290295
settings.Click += (o, e) => App.API.OpenSettingDialog();
291296
exit.Click += (o, e) => Close();
@@ -324,31 +329,21 @@ private void CheckFirstLaunch()
324329
OpenWelcomeWindow();
325330
}
326331
}
332+
327333
private void OpenWelcomeWindow()
328334
{
329335
var WelcomeWindow = new WelcomeWindow(_settings);
330336
WelcomeWindow.Show();
331337
}
332-
private void ToggleGameMode()
333-
{
334-
if (_viewModel.GameModeStatus)
335-
{
336-
_notifyIcon.Icon = Properties.Resources.app;
337-
_viewModel.GameModeStatus = false;
338-
}
339-
else
340-
{
341-
_notifyIcon.Icon = Properties.Resources.gamemode;
342-
_viewModel.GameModeStatus = true;
343-
}
344-
}
338+
345339
private async void PositionReset()
346340
{
347341
_viewModel.Show();
348342
await Task.Delay(300); // If don't give a time, Positioning will be weird.
349343
Left = HorizonCenter();
350344
Top = VerticalCenter();
351345
}
346+
352347
private void InitProgressbarAnimation()
353348
{
354349
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 100, new Duration(new TimeSpan(0, 0, 0, 0, 1600)));
@@ -361,6 +356,7 @@ private void InitProgressbarAnimation()
361356
_viewModel.ProgressBarVisibility = Visibility.Hidden;
362357
isProgressBarStoryboardPaused = true;
363358
}
359+
364360
public void WindowAnimator()
365361
{
366362
if (_animating)
@@ -475,7 +471,6 @@ private async void OnContextMenusForSettingsClick(object sender, RoutedEventArgs
475471
App.API.OpenSettingDialog();
476472
}
477473

478-
479474
private async void OnDeactivated(object sender, EventArgs e)
480475
{
481476
_settings.WindowLeft = Left;
@@ -596,12 +591,6 @@ private void OnKeyDown(object sender, KeyEventArgs e)
596591
e.Handled = true;
597592
}
598593
break;
599-
case Key.F12:
600-
if (specialKeyState.CtrlPressed)
601-
{
602-
ToggleGameMode();
603-
}
604-
break;
605594
case Key.Back:
606595
if (specialKeyState.CtrlPressed)
607596
{
@@ -644,6 +633,7 @@ public void PreviewReset()
644633
Preview.Visibility = Visibility.Collapsed;
645634
}
646635
}
636+
647637
public void PreviewToggle()
648638
{
649639

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Threading;
55
using System.Threading.Tasks;
66
using System.Windows;
7-
using System.Windows.Input;
87
using Flow.Launcher.Core.Plugin;
98
using Flow.Launcher.Core.Resource;
109
using Flow.Launcher.Helper;
@@ -24,16 +23,13 @@
2423
using System.Collections.Specialized;
2524
using CommunityToolkit.Mvvm.Input;
2625
using System.Globalization;
27-
using System.Windows.Threading;
2826

2927
namespace 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

Plugins/Flow.Launcher.Plugin.Explorer/Languages/da.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<system:String x:Key="flowlauncher_plugin_everything_sort_by_descending">↓</system:String>
115115
<system:String x:Key="flowlauncher_plugin_everything_nonfastsort_warning">Warning: This is not a Fast Sort option, searches may be slow</system:String>
116116

117-
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to Launch or Install Everything</system:String>
117+
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to launch or install Everything</system:String>
118118
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
119119
<system:String x:Key="flowlauncher_plugin_everything_installing_subtitle">Installing Everything service. Please wait...</system:String>
120120
<system:String x:Key="flowlauncher_plugin_everything_installationsuccess_subtitle">Successfully installed Everything service</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/Languages/de.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
<system:String x:Key="flowlauncher_plugin_everything_sort_by_descending">↓</system:String>
115115
<system:String x:Key="flowlauncher_plugin_everything_nonfastsort_warning">Warning: This is not a Fast Sort option, searches may be slow</system:String>
116116

117-
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to Launch or Install Everything</system:String>
117+
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to launch or install Everything</system:String>
118118
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
119119
<system:String x:Key="flowlauncher_plugin_everything_installing_subtitle">Installing Everything service. Please wait...</system:String>
120120
<system:String x:Key="flowlauncher_plugin_everything_installationsuccess_subtitle">Successfully installed Everything service</system:String>

Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
<system:String x:Key="flowlauncher_plugin_everything_sort_by_descending">&#x2193;</system:String>
128128
<system:String x:Key="flowlauncher_plugin_everything_nonfastsort_warning">Warning: This is not a Fast Sort option, searches may be slow</system:String>
129129

130-
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to Launch or Install Everything</system:String>
130+
<system:String x:Key="flowlauncher_plugin_everything_click_to_launch_or_install">Click to launch or install Everything</system:String>
131131
<system:String x:Key="flowlauncher_plugin_everything_installing_title">Everything Installation</system:String>
132132
<system:String x:Key="flowlauncher_plugin_everything_installing_subtitle">Installing Everything service. Please wait...</system:String>
133133
<system:String x:Key="flowlauncher_plugin_everything_installationsuccess_subtitle">Successfully installed Everything service</system:String>

0 commit comments

Comments
 (0)