Skip to content

Commit 0b12f0c

Browse files
BornToBeRootclaude
andcommitted
Feature: Global hotkey to open the run command
Settings > HotKeys: "Bring window to foreground and open the run command" (disabled by default, default Ctrl+Alt+P). Shows the window (also from the tray) and opens the run command dialog. Docs: hotkeys page (also English key names instead of "ALT + STRG"), run command page and changelog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent f6ce545 commit 0b12f0c

10 files changed

Lines changed: 133 additions & 3 deletions

File tree

‎Source/NETworkManager.Localization/Resources/Strings.Designer.cs‎

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

‎Source/NETworkManager.Localization/Resources/Strings.resx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4890,4 +4890,7 @@ Cloudflare may log your IP address and network information. See Cloudflare's pri
48904890
<data name="EnterSubnetmaskOrCIDRBetweenXAndY" xml:space="preserve">
48914891
<value>Enter a subnet mask or CIDR between /{0} and /{1}!</value>
48924892
</data>
4893+
<data name="BringWindowToForegroundAndOpenRunCommand" xml:space="preserve">
4894+
<value>Bring window to foreground and open the run command</value>
4895+
</data>
48934896
</root>

‎Source/NETworkManager.Settings/GlobalStaticConfiguration.cs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ public static class GlobalStaticConfiguration
8686
// Settings: HotKey
8787
public static int HotKey_ShowWindowKey => 79;
8888
public static int HotKey_ShowWindowModifier => 3;
89+
public static int HotKey_RunCommandKey => 80;
90+
public static int HotKey_RunCommandModifier => 3;
8991

9092
// Settings: Update
9193
public static bool Update_CheckForUpdatesAtStartup => true;

‎Source/NETworkManager.Settings/SettingsInfo.cs‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,45 @@ public int HotKey_ShowWindowModifier
541541
}
542542
} = GlobalStaticConfiguration.HotKey_ShowWindowModifier;
543543

544+
public bool HotKey_RunCommandEnabled
545+
{
546+
get;
547+
set
548+
{
549+
if (value == field)
550+
return;
551+
552+
field = value;
553+
OnPropertyChanged();
554+
}
555+
}
556+
557+
public int HotKey_RunCommandKey
558+
{
559+
get;
560+
set
561+
{
562+
if (value == field)
563+
return;
564+
565+
field = value;
566+
OnPropertyChanged();
567+
}
568+
} = GlobalStaticConfiguration.HotKey_RunCommandKey;
569+
570+
public int HotKey_RunCommandModifier
571+
{
572+
get;
573+
set
574+
{
575+
if (value == field)
576+
return;
577+
578+
field = value;
579+
OnPropertyChanged();
580+
}
581+
} = GlobalStaticConfiguration.HotKey_RunCommandModifier;
582+
544583
// Update
545584

546585
public bool Update_CheckForUpdatesAtStartup

‎Source/NETworkManager/MainWindow.xaml.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,16 @@ private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref
13821382
return IntPtr.Zero;
13831383
}
13841384

1385+
// Hotkey --> Show window and open the run command
1386+
if (msg == WmHotkey && wParam.ToInt32() == 2)
1387+
{
1388+
ShowWindow();
1389+
OpenRunAction();
1390+
handled = true;
1391+
1392+
return IntPtr.Zero;
1393+
}
1394+
13851395
// Window size events
13861396
switch (msg)
13871397
{
@@ -1444,6 +1454,7 @@ private void UpdateOnWindowResize()
14441454
/* ID | Command
14451455
* ---|-------------------
14461456
* 1 | ShowWindow()
1457+
* 2 | ShowWindow() + OpenRunAction()
14471458
*/
14481459

14491460
private readonly List<int> _registeredHotKeys = [];
@@ -1456,6 +1467,13 @@ private void RegisterHotKeys()
14561467
SettingsManager.Current.HotKey_ShowWindowKey);
14571468
_registeredHotKeys.Add(1);
14581469
}
1470+
1471+
if (SettingsManager.Current.HotKey_RunCommandEnabled)
1472+
{
1473+
RegisterHotKey(new WindowInteropHelper(this).Handle, 2, SettingsManager.Current.HotKey_RunCommandModifier,
1474+
SettingsManager.Current.HotKey_RunCommandKey);
1475+
_registeredHotKeys.Add(2);
1476+
}
14591477
}
14601478

14611479
private void UnregisterHotKeys()

‎Source/NETworkManager/ViewModels/SettingsHotKeysViewModel.cs‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,47 @@ public HotKey HotKeyShowWindow
5151
}
5252
}
5353

54+
public bool HotKeyRunCommandEnabled
55+
{
56+
get;
57+
set
58+
{
59+
if (value == field)
60+
return;
61+
62+
if (!_isLoading)
63+
{
64+
SettingsManager.Current.HotKey_RunCommandEnabled = value;
65+
66+
SettingsManager.HotKeysChanged = true;
67+
}
68+
69+
field = value;
70+
OnPropertyChanged();
71+
}
72+
}
73+
74+
public HotKey HotKeyRunCommand
75+
{
76+
get;
77+
set
78+
{
79+
if (Equals(value, field))
80+
return;
81+
82+
if (!_isLoading && value != null)
83+
{
84+
SettingsManager.Current.HotKey_RunCommandKey = (int)HotKeys.WpfKeyToFormsKeys(value.Key);
85+
SettingsManager.Current.HotKey_RunCommandModifier = HotKeys.GetModifierKeysSum(value.ModifierKeys);
86+
87+
SettingsManager.HotKeysChanged = true;
88+
}
89+
90+
field = value;
91+
OnPropertyChanged();
92+
}
93+
}
94+
5495
#endregion
5596

5697
#region Constructor, LoadSettings
@@ -69,6 +110,9 @@ private void LoadSettings()
69110
HotKeyShowWindowEnabled = SettingsManager.Current.HotKey_ShowWindowEnabled;
70111
HotKeyShowWindow = new HotKey(HotKeys.FormsKeysToWpfKey(SettingsManager.Current.HotKey_ShowWindowKey),
71112
HotKeys.GetModifierKeysFromInt(SettingsManager.Current.HotKey_ShowWindowModifier));
113+
HotKeyRunCommandEnabled = SettingsManager.Current.HotKey_RunCommandEnabled;
114+
HotKeyRunCommand = new HotKey(HotKeys.FormsKeysToWpfKey(SettingsManager.Current.HotKey_RunCommandKey),
115+
HotKeys.GetModifierKeysFromInt(SettingsManager.Current.HotKey_RunCommandModifier));
72116
}
73117

74118
#endregion

‎Source/NETworkManager/Views/SettingsHotKeysView.xaml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
<mahAppsControls:ToggleSwitch Header="{x:Static localization:Strings.UntrayBringWindowToForeground}"
1313
IsOn="{Binding HotKeyShowWindowEnabled}" Margin="0,0,0,10" />
1414
<mahAppsControls:HotKeyBox AreModifierKeysRequired="True" HotKey="{Binding HotKeyShowWindow}" Width="250"
15+
HorizontalAlignment="Left" Margin="0,0,0,20" />
16+
<mahAppsControls:ToggleSwitch Header="{x:Static localization:Strings.BringWindowToForegroundAndOpenRunCommand}"
17+
IsOn="{Binding HotKeyRunCommandEnabled}" Margin="0,0,0,10" />
18+
<mahAppsControls:HotKeyBox AreModifierKeysRequired="True" HotKey="{Binding HotKeyRunCommand}" Width="250"
1519
HorizontalAlignment="Left" />
1620
</StackPanel>
1721
</UserControl>

‎Website/docs/changelog/next-release.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Release date: **xx.xx.2026**
2929

3030
- The [**Run command**](../run-command.md) (`Ctrl+Shift+P`) now runs a feature directly, e.g. `ping 10.0.0.1`, `dns borntoberoot.net 1.1.1.1 aaaa`, `rdap 1.10 asn` or `rdp @server-01` (profile). It opens in a dialog instead of a flyout, with short aliases (e.g. `ping`, `dns`, `rdp`, `ssh`, `geo`, `wol`), suggestions for recent commands, profiles of the feature and types (`Up`/`Down` to select, `Tab` to complete, `Enter` to run, `Esc` to close), and validates the input like the feature does. Only visible features are offered. [#3644](https://github.com/BornToBeRoot/NETworkManager/pull/3644)
3131
- New run command targets for the **Subnet Calculator** (`subnet 10.0.0.0/24`, `subnet 10.0.0.0/16 /24` for subnetting, `subnet 10.0.0.0/24 10.0.1.0/24` for the wide subnet) and the **Lookup** (`lookup oui 00:11:22`, `lookup port 22; ssh`). [#XXXX](https://github.com/BornToBeRoot/NETworkManager/pull/XXXX)
32+
- New global hotkey to bring the window to the foreground and open the run command (default `Ctrl+Alt+P`, disabled by default), see [Settings > HotKeys](../settings/hotkeys.md). [#XXXX](https://github.com/BornToBeRoot/NETworkManager/pull/XXXX)
3233

3334
**RDAP**
3435

‎Website/docs/run-command.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ keywords: [NETworkManager, run command, command palette, keyboard shortcut, Ctrl
88

99
The **Run Command** opens a feature and runs it directly from the keyboard: press `Ctrl+Shift+P`, type a command like `ping 10.0.0.1` and press `Enter`.
1010

11-
The run command can also be opened with the **Run command...** button in the title bar.
11+
The run command can also be opened with the **Run command...** button in the title bar, or from anywhere with a global hotkey (default `Ctrl+Alt+P`, disabled by default), which brings the window to the foreground, see [Settings > HotKeys](./settings/hotkeys.md).
1212

1313
## Syntax
1414

‎Website/docs/settings/hotkeys.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
sidebar_position: 6
3-
description: "Configure keyboard shortcuts in NETworkManager to quickly bring the application to the foreground from the system tray."
3+
description: "Configure global keyboard shortcuts in NETworkManager to bring the application to the foreground from the system tray or to open the run command."
44
keywords: [NETworkManager, hotkeys, keyboard shortcuts, key bindings, system tray shortcut]
55
---
66

@@ -14,4 +14,14 @@ Untray the application and bring it to the foreground.
1414

1515
**Default:** `Disabled`
1616

17-
**Default Hotkey:** `ALT + STRG + O`
17+
**Default Hotkey:** `Ctrl+Alt+O`
18+
19+
### Bring window to foreground and open the run command
20+
21+
Untray the application, bring it to the foreground and open the [run command](../run-command.md), so a feature can be run from anywhere (e.g. `ping 10.0.0.1`).
22+
23+
**Type:** `Boolean`
24+
25+
**Default:** `Disabled`
26+
27+
**Default Hotkey:** `Ctrl+Alt+P`

0 commit comments

Comments
 (0)