3 Commits

Author SHA1 Message Date
Ray Berezowski
1601da8155 Add run as administrator option 2026-08-26 22:10:55 -04:00
Ray Berezowski
6d9bbbab02 Add launcher item tooltips 2026-08-26 22:04:26 -04:00
Ray Berezowski
5421e3dde3 Restore menu keyboard navigation 2026-08-26 21:56:55 -04:00
9 changed files with 234 additions and 24 deletions

View File

@@ -134,6 +134,7 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Text="Hotkey" VerticalAlignment="Center" Margin="0,0,8,8"/>
@@ -212,8 +213,15 @@
<ComboBox x:Name="ItemDisplayModeBox" Grid.Row="5" Grid.Column="1" Grid.ColumnSpan="2"
Margin="0,0,0,8" SelectionChanged="ItemDisplayModeBox_SelectionChanged"/>
<TextBlock Text="Preview" Grid.Row="6" VerticalAlignment="Top" Margin="0,4,8,0"/>
<Border Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2"
<TextBlock Text="Launch Options" Grid.Row="6" VerticalAlignment="Center" Margin="0,0,8,8"/>
<CheckBox x:Name="RunAsAdminBox" Grid.Row="6" Grid.Column="1" Grid.ColumnSpan="2"
Content="Run as administrator"
Margin="0,0,0,8"
Checked="RunAsAdminBox_Changed"
Unchecked="RunAsAdminBox_Changed"/>
<TextBlock Text="Preview" Grid.Row="7" VerticalAlignment="Top" Margin="0,4,8,0"/>
<Border Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2"
BorderThickness="1"
BorderBrush="{DynamicResource AppBorderBrush}"
Background="{DynamicResource AppSurfaceBrush}"

View File

@@ -616,6 +616,7 @@ public partial class MainWindow : Window
IconPathBox.Text = item.IconPath ?? "";
loadedAutoIconPath = GetAutomaticIconPath(item);
ItemDisplayModeBox.SelectedItem = item.DisplayMode;
RunAsAdminBox.IsChecked = item.RunAsAdmin;
UpdateTargetAvailability();
isLoadingSelection = false;
UpdatePreview();
@@ -633,6 +634,7 @@ public partial class MainWindow : Window
IconPathBox.Text = "";
loadedAutoIconPath = null;
ItemDisplayModeBox.SelectedItem = controller?.Config.DisplayMode;
RunAsAdminBox.IsChecked = false;
UpdateTargetAvailability();
isLoadingSelection = false;
UpdatePreview();
@@ -657,6 +659,7 @@ public partial class MainWindow : Window
{
selectedItem.DisplayMode = itemMode;
}
selectedItem.RunAsAdmin = LauncherController.CanRunAsAdmin(selectedItem.Type) && RunAsAdminBox.IsChecked == true;
if (selectedItem.Type != LauncherItemType.Menu)
{
@@ -966,6 +969,7 @@ public partial class MainWindow : Window
IconPath = item.IconPath,
IsFavorite = item.IsFavorite,
IsDisabled = item.IsDisabled,
RunAsAdmin = item.RunAsAdmin,
DisplayMode = item.DisplayMode,
Children = item.Children.Select(child => DuplicateItem(child, renameRoot: false)).ToList()
};
@@ -1781,6 +1785,20 @@ public partial class MainWindow : Window
ThemeService.Apply(scheme);
}
private void RunAsAdminBox_Changed(object sender, RoutedEventArgs e)
{
if (isLoadingSelection)
{
return;
}
UpdatePreview();
if (selectedItem is not null)
{
StatusText.Text = "Click Save to keep the selected item launch options.";
}
}
private void EnsureAutomaticIconPath()
{
if (TypeBox.SelectedItem is LauncherItemType.Menu)
@@ -1860,6 +1878,8 @@ public partial class MainWindow : Window
IconPath = string.IsNullOrWhiteSpace(IconPathBox.Text) ? null : IconPathBox.Text.Trim(),
IsFavorite = selectedItem.IsFavorite,
IsDisabled = selectedItem.IsDisabled,
RunAsAdmin = LauncherController.CanRunAsAdmin(TypeBox.SelectedItem is LauncherItemType itemType ? itemType : LauncherItemType.App) &&
RunAsAdminBox.IsChecked == true,
DisplayMode = ItemDisplayModeBox.SelectedItem is LauncherDisplayMode mode
? mode
: selectedItem.DisplayMode
@@ -1926,13 +1946,20 @@ public partial class MainWindow : Window
private void UpdateTargetAvailability()
{
bool isMenu = TypeBox.SelectedItem is LauncherItemType.Menu;
bool canRunAsAdmin = TypeBox.SelectedItem is LauncherItemType itemType && LauncherController.CanRunAsAdmin(itemType);
TargetBox.IsEnabled = !isMenu;
ArgumentsBox.IsEnabled = !isMenu;
RunAsAdminBox.IsEnabled = canRunAsAdmin;
if (isMenu && !isLoadingSelection)
{
TargetBox.Text = "";
ArgumentsBox.Text = "";
}
if (!canRunAsAdmin && !isLoadingSelection)
{
RunAsAdminBox.IsChecked = false;
}
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)

View File

@@ -29,6 +29,8 @@ public sealed class LauncherItem
public bool IsDisabled { get; set; }
public bool RunAsAdmin { get; set; }
public LauncherDisplayMode DisplayMode { get; set; } = LauncherDisplayMode.CompactList;
public List<LauncherItem> Children { get; set; } = [];

View File

@@ -14,12 +14,14 @@ Download the compiled Windows release from:
- Global hotkey, default `Ctrl+Alt+Space`
- Search/filter in the launcher popup with parent menu context
- Keyboard navigation in the launcher popup
- Tooltips for launcher items, menu paths, targets, and arguments
- Recent items section for quickly relaunching entries
- Nested menus, drag/drop ordering, and drag/drop item creation in Settings
- Right-click launcher entries to edit them in Settings
- Right-click launcher entries to pin or unpin them from the top
- Right-click launcher entries or Settings items to temporarily disable them
- Right-click app/file entries to open their containing folder
- Optional run-as-administrator mode for app and file entries
- Validate missing app, file, and folder targets from Settings
- Export and import selected items or menu sections
- Sort a selected menu or item level alphabetically

View File

@@ -183,6 +183,7 @@ public sealed class LauncherController : IDisposable
IconPath = item.IconPath,
IsFavorite = false,
IsDisabled = false,
RunAsAdmin = item.RunAsAdmin,
DisplayMode = item.DisplayMode,
Children = []
};
@@ -286,6 +287,11 @@ public sealed class LauncherController : IDisposable
WorkingDirectory = Directory.Exists(target) ? target : ConfigService.AppFolder
};
if (item.RunAsAdmin && CanRunAsAdmin(item.Type))
{
startInfo.Verb = "runas";
}
Process.Start(startInfo);
return true;
}
@@ -295,4 +301,9 @@ public sealed class LauncherController : IDisposable
return false;
}
}
public static bool CanRunAsAdmin(LauncherItemType itemType)
{
return itemType is LauncherItemType.App or LauncherItemType.File;
}
}

View File

@@ -12,8 +12,8 @@
<Authors>Ray Berezowski</Authors>
<ApplicationIcon>Assets\AppIcon.ico</ApplicationIcon>
<Version>1.0.1</Version>
<AssemblyVersion>1.0.1.15</AssemblyVersion>
<FileVersion>1.0.1.15</FileVersion>
<AssemblyVersion>1.0.1.18</AssemblyVersion>
<FileVersion>1.0.1.18</FileVersion>
<InformationalVersion>1.0.1</InformationalVersion>
</PropertyGroup>

View File

@@ -14,6 +14,7 @@ public partial class LauncherPopup : Window
private const double HeaderAndChromeHeight = 118;
private bool isRepositionQueued;
private readonly List<System.Windows.Controls.Button> visibleLaunchButtons = [];
private readonly List<System.Windows.Controls.Control> visibleNavigationControls = [];
private readonly LauncherConfig config;
private readonly Action<LauncherItem> launchItem;
@@ -96,6 +97,7 @@ public partial class LauncherPopup : Window
{
ItemsPanel.Children.Clear();
visibleLaunchButtons.Clear();
visibleNavigationControls.Clear();
if (config.RecentItems.Any(item => !item.IsDisabled))
{
@@ -107,6 +109,8 @@ public partial class LauncherPopup : Window
{
ItemsPanel.Children.Add(CreateItemControl(item, 0, expandMenusByDefault));
}
RebuildNavigationLists();
}
private Expander CreateRecentItemsControl()
@@ -115,8 +119,12 @@ public partial class LauncherPopup : Window
{
Header = new TextBlock { Text = "Recent" },
IsExpanded = true,
Margin = new Thickness(0, 4, 0, 8)
Margin = new Thickness(0, 4, 0, 8),
Focusable = true
};
expander.KeyDown += NavigationControl_KeyDown;
expander.Expanded += (_, _) => RebuildNavigationAndReposition();
expander.Collapsed += (_, _) => RebuildNavigationAndReposition();
StackPanel recentItems = new();
foreach (LauncherItem item in config.RecentItems.Where(item => !item.IsDisabled))
@@ -136,8 +144,14 @@ public partial class LauncherPopup : Window
{
Header = CreateMenuHeader(item),
IsExpanded = expandMenusByDefault,
Margin = new Thickness(depth * 12, 4, 0, 4)
Margin = new Thickness(depth * 12, 4, 0, 4),
Focusable = true,
Tag = item,
ToolTip = CreateItemToolTip(item)
};
expander.KeyDown += NavigationControl_KeyDown;
expander.Expanded += (_, _) => RebuildNavigationAndReposition();
expander.Collapsed += (_, _) => RebuildNavigationAndReposition();
StackPanel children = new();
foreach (LauncherItem child in GetDisplayItems(item.Children))
@@ -155,7 +169,8 @@ public partial class LauncherPopup : Window
Margin = new Thickness(depth * 12, 2, 0, 2),
MinHeight = DisplayModeMetrics.GetRowHeight(GetEffectiveDisplayMode(item)),
HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left,
Tag = item
Tag = item,
ToolTip = CreateItemToolTip(item)
};
button.Click += (_, _) => launchItem(item);
@@ -165,7 +180,6 @@ public partial class LauncherPopup : Window
}
button.KeyDown += LaunchButton_KeyDown;
visibleLaunchButtons.Add(button);
return button;
}
@@ -192,7 +206,8 @@ public partial class LauncherPopup : Window
return new TextBlock
{
Text = item.Title,
ContextMenu = contextMenu
ContextMenu = contextMenu,
ToolTip = CreateItemToolTip(item)
};
}
@@ -201,6 +216,7 @@ public partial class LauncherPopup : Window
System.Windows.Controls.ContextMenu contextMenu = new();
contextMenu.Items.Add(CreatePinMenuItem(item));
contextMenu.Items.Add(CreateDisableMenuItem(item));
contextMenu.Items.Add(CreateRunAsAdminMenuItem(item));
contextMenu.Items.Add(CreateOpenContainingFolderMenuItem(item));
contextMenu.Items.Add(CreateEditMenuItem(item));
return contextMenu;
@@ -242,6 +258,25 @@ public partial class LauncherPopup : Window
return disableMenuItem;
}
private System.Windows.Controls.MenuItem CreateRunAsAdminMenuItem(LauncherItem item)
{
System.Windows.Controls.MenuItem runAsAdminMenuItem = new()
{
Header = item.RunAsAdmin ? "Run as Admin: On" : "Run as Admin: Off",
IsEnabled = LauncherController.CanRunAsAdmin(item.Type)
};
runAsAdminMenuItem.Click += (_, e) =>
{
item.RunAsAdmin = !item.RunAsAdmin;
ConfigService.Save(config);
BuildItems();
QueueReposition();
e.Handled = true;
};
return runAsAdminMenuItem;
}
private System.Windows.Controls.MenuItem CreateOpenContainingFolderMenuItem(LauncherItem item)
{
System.Windows.Controls.MenuItem openFolderMenuItem = new()
@@ -329,6 +364,8 @@ public partial class LauncherPopup : Window
{
ItemsPanel.Children.Add(CreateSearchResultControl(match));
}
RebuildNavigationLists();
}
private FrameworkElement CreateSearchResultControl(SearchMatch match)
@@ -340,16 +377,56 @@ public partial class LauncherPopup : Window
MinHeight = Math.Max(DisplayModeMetrics.GetRowHeight(GetEffectiveDisplayMode(match.Item)), 48),
HorizontalContentAlignment = System.Windows.HorizontalAlignment.Left,
Tag = match.Item,
ContextMenu = CreateItemContextMenu(match.Item)
ContextMenu = CreateItemContextMenu(match.Item),
ToolTip = CreateItemToolTip(match.Item, match.ParentPath)
};
button.Click += (_, _) => launchItem(match.Item);
button.KeyDown += LaunchButton_KeyDown;
visibleLaunchButtons.Add(button);
return button;
}
private void RebuildNavigationAndReposition()
{
RebuildNavigationLists();
QueueReposition();
}
private void RebuildNavigationLists()
{
visibleLaunchButtons.Clear();
visibleNavigationControls.Clear();
AddVisibleNavigationControls(ItemsPanel.Children);
}
private void AddVisibleNavigationControls(UIElementCollection elements)
{
foreach (UIElement element in elements)
{
switch (element)
{
case Expander expander:
visibleNavigationControls.Add(expander);
if (expander.IsExpanded && expander.Content is System.Windows.Controls.Panel panel)
{
AddVisibleNavigationControls(panel.Children);
}
break;
case System.Windows.Controls.Button button:
visibleNavigationControls.Add(button);
if (button.Tag is LauncherItem)
{
visibleLaunchButtons.Add(button);
}
break;
}
}
}
private object CreateSearchResultContent(SearchMatch match)
{
StackPanel panel = new();
@@ -370,6 +447,51 @@ public partial class LauncherPopup : Window
return panel;
}
private static System.Windows.Controls.ToolTip CreateItemToolTip(LauncherItem item, string? parentPath = null)
{
StackPanel panel = new() { MaxWidth = 520 };
AddToolTipLine(panel, item.Title, bold: true);
AddToolTipLine(panel, $"Type: {item.Type}");
if (!string.IsNullOrWhiteSpace(parentPath))
{
AddToolTipLine(panel, $"Menu: {parentPath}");
}
if (!string.IsNullOrWhiteSpace(item.Target))
{
AddToolTipLine(panel, $"Target: {item.Target}");
}
if (!string.IsNullOrWhiteSpace(item.Arguments))
{
AddToolTipLine(panel, $"Arguments: {item.Arguments}");
}
if (item.IsFavorite)
{
AddToolTipLine(panel, "Pinned to top");
}
if (item.RunAsAdmin)
{
AddToolTipLine(panel, "Runs as administrator");
}
return new System.Windows.Controls.ToolTip { Content = panel };
}
private static void AddToolTipLine(StackPanel panel, string text, bool bold = false)
{
panel.Children.Add(new TextBlock
{
Text = text,
FontWeight = bold ? FontWeights.SemiBold : FontWeights.Normal,
TextWrapping = TextWrapping.Wrap,
Margin = panel.Children.Count == 0 ? new Thickness(0) : new Thickness(0, 3, 0, 0)
});
}
private static void CollectMatches(IEnumerable<LauncherItem> items, string query, List<string> parentNames, List<SearchMatch> matches)
{
foreach (LauncherItem item in GetDisplayItems(items))
@@ -415,14 +537,14 @@ public partial class LauncherPopup : Window
if (e.Key == Key.Down)
{
FocusLaunchButton(0);
FocusNavigationControl(0);
e.Handled = true;
return;
}
if (e.Key == Key.Up)
{
FocusLaunchButton(visibleLaunchButtons.Count - 1);
FocusNavigationControl(visibleNavigationControls.Count - 1);
e.Handled = true;
return;
}
@@ -462,7 +584,37 @@ public partial class LauncherPopup : Window
return;
}
int index = visibleLaunchButtons.IndexOf(button);
HandleNavigationControlKey(button, e);
}
private void NavigationControl_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (sender is not System.Windows.Controls.Control control)
{
return;
}
if (e.Key == Key.Enter && control is Expander expander)
{
expander.IsExpanded = !expander.IsExpanded;
QueueReposition();
e.Handled = true;
return;
}
if (e.Key == Key.Escape)
{
Close();
e.Handled = true;
return;
}
HandleNavigationControlKey(control, e);
}
private void HandleNavigationControlKey(System.Windows.Controls.Control control, System.Windows.Input.KeyEventArgs e)
{
int index = visibleNavigationControls.IndexOf(control);
if (index < 0)
{
return;
@@ -470,7 +622,7 @@ public partial class LauncherPopup : Window
if (e.Key == Key.Down)
{
FocusLaunchButton(index + 1);
FocusNavigationControl(index + 1);
e.Handled = true;
return;
}
@@ -484,7 +636,7 @@ public partial class LauncherPopup : Window
}
else
{
FocusLaunchButton(index - 1);
FocusNavigationControl(index - 1);
}
e.Handled = true;
@@ -493,30 +645,30 @@ public partial class LauncherPopup : Window
if (e.Key == Key.Home)
{
FocusLaunchButton(0);
FocusNavigationControl(0);
e.Handled = true;
return;
}
if (e.Key == Key.End)
{
FocusLaunchButton(visibleLaunchButtons.Count - 1);
FocusNavigationControl(visibleNavigationControls.Count - 1);
e.Handled = true;
}
}
private void FocusLaunchButton(int index)
private void FocusNavigationControl(int index)
{
if (visibleLaunchButtons.Count == 0)
if (visibleNavigationControls.Count == 0)
{
return;
}
int clampedIndex = Math.Clamp(index, 0, visibleLaunchButtons.Count - 1);
System.Windows.Controls.Button button = visibleLaunchButtons[clampedIndex];
int clampedIndex = Math.Clamp(index, 0, visibleNavigationControls.Count - 1);
System.Windows.Controls.Control control = visibleNavigationControls[clampedIndex];
Keyboard.ClearFocus();
button.Focus();
button.BringIntoView();
control.Focus();
control.BringIntoView();
}
protected override void OnKeyDown(System.Windows.Input.KeyEventArgs e)

View File

@@ -12,6 +12,7 @@
"IconPath": null,
"IsFavorite": false,
"IsDisabled": false,
"RunAsAdmin": false,
"DisplayMode": "CompactList",
"Children": [
{
@@ -22,6 +23,7 @@
"IconPath": "%USERPROFILE%\\Documents",
"IsFavorite": false,
"IsDisabled": false,
"RunAsAdmin": false,
"DisplayMode": "CompactList",
"Children": []
},
@@ -33,6 +35,7 @@
"IconPath": "%USERPROFILE%\\Downloads",
"IsFavorite": false,
"IsDisabled": false,
"RunAsAdmin": false,
"DisplayMode": "CompactList",
"Children": []
}
@@ -46,6 +49,7 @@
"IconPath": null,
"IsFavorite": false,
"IsDisabled": false,
"RunAsAdmin": false,
"DisplayMode": "CompactList",
"Children": [
{
@@ -56,6 +60,7 @@
"IconPath": "notepad.exe",
"IsFavorite": false,
"IsDisabled": false,
"RunAsAdmin": false,
"DisplayMode": "CompactList",
"Children": []
}

View File

@@ -30,6 +30,8 @@ Search results include the parent menu path when an item is inside a menu.
Use arrow keys, Home, End, Enter, and Escape to navigate the launcher popup from the keyboard.
Hover over launcher items to see details such as type, menu path, target, and arguments.
## Configure
Open the tray menu and choose **Settings**.
@@ -45,6 +47,7 @@ From Settings you can:
- Right-click an item and choose **Pin to Top** to show it first in its menu
- Right-click an item and choose **Disable Item** or **Enable Item** to hide or restore it
- Right-click an app or file item and choose **Open Containing Folder**
- Enable **Run as administrator** for app and file items that need elevation
- Use **Config... > Validate Targets** to check for missing app, file, and folder targets
- Use **Config... > Export Selected Item** or **Import Item** to share one item or menu section
- Right-click an item and choose **Sort This Menu** or **Sort This Level**