Skip to content

Commit b51e5d2

Browse files
authored
Merge pull request #824 from onesounds/GamingMode
GameMode
2 parents 8f8636a + 8102a53 commit b51e5d2

File tree

7 files changed

+44
-12
lines changed

7 files changed

+44
-12
lines changed

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
using Flow.Launcher.Core.Resource;
77
using System.Windows;
88
using Flow.Launcher.ViewModel;
9-
using System.Threading.Tasks;
10-
using System.Threading;
119

1210
namespace Flow.Launcher.Helper
1311
{
@@ -27,7 +25,8 @@ internal static void Initialize(MainViewModel mainVM)
2725

2826
internal static void OnToggleHotkey(object sender, HotkeyEventArgs args)
2927
{
30-
mainViewModel.ToggleFlowLauncher();
28+
if (!mainViewModel.GameModeStatus)
29+
mainViewModel.ToggleFlowLauncher();
3130
}
3231

3332
private static void SetHotkey(string hotkeyStr, EventHandler<HotkeyEventArgs> action)
@@ -75,7 +74,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
7574
{
7675
SetHotkey(hotkey.Hotkey, (s, e) =>
7776
{
78-
if (mainViewModel.ShouldIgnoreHotkeys())
77+
if (mainViewModel.ShouldIgnoreHotkeys() || mainViewModel.GameModeStatus)
7978
return;
8079

8180
mainViewModel.MainWindowVisibility = Visibility.Visible;

Flow.Launcher/Images/gamemode.ico

9.44 KB
Binary file not shown.

Flow.Launcher/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<system:String x:Key="iconTrayAbout">About</system:String>
1616
<system:String x:Key="iconTrayExit">Exit</system:String>
1717
<system:String x:Key="closeWindow">Close</system:String>
18+
<system:String x:Key="GameMode">Game Mode</system:String>
1819

1920
<!-- Setting General -->
2021
<system:String x:Key="flowlauncher_settings">Flow Launcher Settings</system:String>

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,9 @@ private void UpdateNotifyIconText()
164164
{
165165
var menu = contextMenu;
166166
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen");
167-
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
168-
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
167+
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
168+
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
169+
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
169170
}
170171

171172
private void InitializeNotifyIcon()
@@ -187,6 +188,10 @@ private void InitializeNotifyIcon()
187188
{
188189
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen")
189190
};
191+
var gamemode = new MenuItem
192+
{
193+
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
194+
};
190195
var settings = new MenuItem
191196
{
192197
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
@@ -197,10 +202,12 @@ private void InitializeNotifyIcon()
197202
};
198203

199204
open.Click += (o, e) => Visibility = Visibility.Visible;
205+
gamemode.Click += (o, e) => ToggleGameMode();
200206
settings.Click += (o, e) => App.API.OpenSettingDialog();
201207
exit.Click += (o, e) => Close();
202208
contextMenu.Items.Add(header);
203209
contextMenu.Items.Add(open);
210+
contextMenu.Items.Add(gamemode);
204211
contextMenu.Items.Add(settings);
205212
contextMenu.Items.Add(exit);
206213

@@ -220,6 +227,19 @@ private void InitializeNotifyIcon()
220227
};
221228
}
222229

230+
private void ToggleGameMode()
231+
{
232+
if (_viewModel.GameModeStatus)
233+
{
234+
_notifyIcon.Icon = Properties.Resources.app;
235+
_viewModel.GameModeStatus = false;
236+
}
237+
else
238+
{
239+
_notifyIcon.Icon = Properties.Resources.gamemode;
240+
_viewModel.GameModeStatus = true;
241+
}
242+
}
223243
private void InitProgressbarAnimation()
224244
{
225245
var da = new DoubleAnimation(ProgressBar.X2, ActualWidth + 150,

Flow.Launcher/Properties/Resources.Designer.cs

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Flow.Launcher/Properties/Resources.resx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,16 @@
112112
<value>2.0</value>
113113
</resheader>
114114
<resheader name="reader">
115-
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
115+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116116
</resheader>
117117
<resheader name="writer">
118-
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120-
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
120+
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
121121
<data name="app" type="System.Resources.ResXFileRef, System.Windows.Forms">
122122
<value>..\Resources\app.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
123123
</data>
124+
<data name="gamemode" type="System.Resources.ResXFileRef, System.Windows.Forms">
125+
<value>..\Images\gamemode.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
126+
</data>
124127
</root>

Flow.Launcher/ViewModel/MainViewModel.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
using Microsoft.VisualStudio.Threading;
2121
using System.Threading.Channels;
2222
using ISavable = Flow.Launcher.Plugin.ISavable;
23-
using System.Windows.Threading;
24-
using NHotkey;
25-
using Windows.Web.Syndication;
2623

2724

2825
namespace Flow.Launcher.ViewModel
@@ -301,9 +298,13 @@ private void InitializeKeyCommands()
301298
#region ViewModel Properties
302299

303300
public ResultsViewModel Results { get; private set; }
301+
304302
public ResultsViewModel ContextMenu { get; private set; }
303+
305304
public ResultsViewModel History { get; private set; }
306305

306+
public bool GameModeStatus { get; set; }
307+
307308
private string _queryText;
308309

309310
public string QueryText

0 commit comments

Comments
 (0)