Skip to content

Commit 016f92a

Browse files
committed
Adjust Context Menus / Adjust Colors (with hotkey menu) / Add Hotkey Register String
1 parent 3aef2a7 commit 016f92a

File tree

7 files changed

+694
-250
lines changed

7 files changed

+694
-250
lines changed

Flow.Launcher/HotkeyControl.xaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@
3838
FontSize="13"
3939
FontWeight="SemiBold"
4040
Foreground="{DynamicResource Color05B}"
41-
Visibility="Visible">
42-
Press key
43-
</TextBlock>
41+
Text="{DynamicResource flowlauncherPressHotkey}"
42+
Visibility="Visible" />
4443
</Border>
4544
</Popup>
4645

@@ -49,8 +48,8 @@
4948
Margin="0,0,18,0"
5049
VerticalContentAlignment="Center"
5150
input:InputMethod.IsInputMethodEnabled="False"
51+
LostFocus="tbHotkey_LostFocus"
5252
PreviewKeyDown="TbHotkey_OnPreviewKeyDown"
53-
TabIndex="100"
54-
LostFocus="tbHotkey_LostFocus"/>
53+
TabIndex="100" />
5554
</Grid>
5655
</UserControl>

Flow.Launcher/HotkeyControl.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Flow.Launcher.Infrastructure.Hotkey;
1010
using Flow.Launcher.Plugin;
1111
using System.Threading;
12+
using System.Windows.Interop;
1213

1314
namespace Flow.Launcher
1415
{
@@ -113,7 +114,7 @@ public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
113114
private void tbHotkey_LostFocus(object sender, RoutedEventArgs e)
114115
{
115116
tbMsg.Text = tbMsgTextOriginal;
116-
tbMsg.Foreground = tbMsgForegroundColorOriginal;
117+
tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B");
117118
}
118119
}
119120
}

Flow.Launcher/Languages/en.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
<system:String x:Key="windowWidthSizeToolTip">You can also quickly adjust this by using Ctrl+[ and Ctrl+].</system:String>
165165
<system:String x:Key="useGlyphUI">Use Segoe Fluent Icons</system:String>
166166
<system:String x:Key="useGlyphUIEffect">Use Segoe Fluent Icons for query results where supported</system:String>
167+
<system:String x:Key="flowlauncherPressHotkey">Press Key</system:String>
167168

168169
<!-- Setting Proxy -->
169170
<system:String x:Key="proxy">HTTP Proxy</system:String>

Flow.Launcher/MainWindow.xaml

Lines changed: 126 additions & 109 deletions
Large diffs are not rendered by default.

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.ComponentModel;
33
using System.Threading.Tasks;
44
using System.Windows;
@@ -27,6 +27,9 @@
2727
using System.IO;
2828
using System.Windows.Threading;
2929
using System.Windows.Data;
30+
using ModernWpf.Controls;
31+
using System.Drawing;
32+
using System.Windows.Forms.Design.Behavior;
3033

3134
namespace Flow.Launcher
3235
{
@@ -224,11 +227,12 @@ private void InitializePosition()
224227
private void UpdateNotifyIconText()
225228
{
226229
var menu = contextMenu;
227-
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
228-
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
229-
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
230-
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
231-
((MenuItem)menu.Items[5]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
230+
((MenuItem)menu.Items[0]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")";
231+
((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("GameMode");
232+
((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset");
233+
((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings");
234+
((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit");
235+
232236
}
233237

234238
private void InitializeNotifyIcon()
@@ -240,39 +244,40 @@ private void InitializeNotifyIcon()
240244
Visible = !_settings.HideNotifyIcon
241245
};
242246
contextMenu = new ContextMenu();
243-
244-
var header = new MenuItem
245-
{
246-
Header = "Flow Launcher",
247-
IsEnabled = false
248-
};
247+
var openIcon = new FontIcon { Glyph = "\ue71e" };
249248
var open = new MenuItem
250249
{
251-
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" +_settings.Hotkey + ")"
250+
Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")",
251+
Icon = openIcon
252252
};
253+
var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" };
253254
var gamemode = new MenuItem
254255
{
255-
Header = InternationalizationManager.Instance.GetTranslation("GameMode")
256+
Header = InternationalizationManager.Instance.GetTranslation("GameMode"),
257+
Icon = gamemodeIcon
256258
};
257259
var positionreset = new MenuItem
258260
{
259261
Header = InternationalizationManager.Instance.GetTranslation("PositionReset")
260262
};
263+
var settingsIcon = new FontIcon { Glyph = "\ue713" };
261264
var settings = new MenuItem
262265
{
263-
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings")
266+
Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"),
267+
Icon = settingsIcon
264268
};
269+
var exitIcon = new FontIcon { Glyph = "\ue7e8" };
265270
var exit = new MenuItem
266271
{
267-
Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit")
272+
Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"),
273+
Icon = exitIcon
268274
};
269275

270276
open.Click += (o, e) => _viewModel.ToggleFlowLauncher();
271277
gamemode.Click += (o, e) => ToggleGameMode();
272278
positionreset.Click += (o, e) => PositionReset();
273279
settings.Click += (o, e) => App.API.OpenSettingDialog();
274280
exit.Click += (o, e) => Close();
275-
contextMenu.Items.Add(header);
276281
contextMenu.Items.Add(open);
277282
gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip");
278283
positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip");

0 commit comments

Comments
 (0)