1 Commits

Author SHA1 Message Date
Ray Berezowski
992ac9a7b5 Add open containing folder action 2026-08-26 21:24:25 -04:00
6 changed files with 102 additions and 4 deletions

View File

@@ -96,6 +96,13 @@ public partial class MainWindow : Window
};
disableMenuItem.Click += ToggleDisabled_Click;
var openContainingFolderMenuItem = new System.Windows.Controls.MenuItem
{
Header = "Open Containing Folder",
IsEnabled = CanOpenContainingFolder(item)
};
openContainingFolderMenuItem.Click += OpenContainingFolder_Click;
var duplicateMenuItem = new System.Windows.Controls.MenuItem { Header = "Duplicate Item" };
duplicateMenuItem.Click += DuplicateItem_Click;
@@ -107,6 +114,7 @@ public partial class MainWindow : Window
};
treeItem.ContextMenu.Items.Add(pinMenuItem);
treeItem.ContextMenu.Items.Add(disableMenuItem);
treeItem.ContextMenu.Items.Add(openContainingFolderMenuItem);
treeItem.ContextMenu.Items.Add(duplicateMenuItem);
treeItem.PreviewMouseRightButtonDown += (_, e) =>
{
@@ -867,6 +875,25 @@ public partial class MainWindow : Window
: $"Enabled {itemToSelect.Title}. Click Save to keep it.";
}
private void OpenContainingFolder_Click(object sender, RoutedEventArgs e)
{
if (selectedItem is null)
{
return;
}
ApplyCurrentItem();
if (!LauncherController.OpenContainingFolder(selectedItem, out string? error) && !string.IsNullOrWhiteSpace(error))
{
MessageBox.Show(error, "Taskbar Launcher");
}
}
private static bool CanOpenContainingFolder(LauncherItem item)
{
return item.Type is LauncherItemType.App or LauncherItemType.File && !string.IsNullOrWhiteSpace(item.Target);
}
private void DuplicateItem_Click(object sender, RoutedEventArgs e)
{
if (controller is null || selectedItem is null)

View File

@@ -18,6 +18,7 @@ Download the compiled Windows release from:
- 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
- Right-click item duplication in Settings
- Right-click items in Settings to pin them to the top of their menu
- Per-item icon and display mode

View File

@@ -72,7 +72,7 @@ public sealed class LauncherController : IDisposable
return;
}
popup = new LauncherPopup(Config, LaunchItem, OpenAllItems, ShowSettings, ShowSettings);
popup = new LauncherPopup(Config, LaunchItem, OpenAllItems, ShowSettings, ShowSettings, OpenContainingFolderFromPopup);
popup.Closed += (_, _) => popup = null;
popup.ShowNearTaskbar();
}
@@ -221,6 +221,50 @@ public sealed class LauncherController : IDisposable
}
}
private void OpenContainingFolderFromPopup(LauncherItem item)
{
if (!OpenContainingFolder(item, out string? error) && !string.IsNullOrWhiteSpace(error))
{
System.Windows.MessageBox.Show(error, "Taskbar Launcher");
}
}
public static bool OpenContainingFolder(LauncherItem item, out string? error)
{
error = null;
if (item.Type == LauncherItemType.Menu || string.IsNullOrWhiteSpace(item.Target))
{
return false;
}
string target = Environment.ExpandEnvironmentVariables(item.Target);
string? folderPath = Directory.Exists(target)
? target
: Path.GetDirectoryName(target);
if (string.IsNullOrWhiteSpace(folderPath) || !Directory.Exists(folderPath))
{
error = $"{item.Title}: Containing folder was not found.";
return false;
}
try
{
Process.Start(new ProcessStartInfo
{
FileName = folderPath,
UseShellExecute = true
});
return true;
}
catch (Exception ex)
{
error = $"{item.Title}: {ex.Message}";
return false;
}
}
private static bool TryLaunchItem(LauncherItem item, out string? error)
{
error = null;

View File

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

View File

@@ -20,8 +20,9 @@ public partial class LauncherPopup : Window
private readonly Action<LauncherItem> openAllItems;
private readonly Action showSettings;
private readonly Action<LauncherItem> editItem;
private readonly Action<LauncherItem> openContainingFolder;
public LauncherPopup(LauncherConfig config, Action<LauncherItem> launchItem, Action<LauncherItem> openAllItems, Action showSettings, Action<LauncherItem> editItem)
public LauncherPopup(LauncherConfig config, Action<LauncherItem> launchItem, Action<LauncherItem> openAllItems, Action showSettings, Action<LauncherItem> editItem, Action<LauncherItem> openContainingFolder)
{
InitializeComponent();
this.config = config;
@@ -29,6 +30,7 @@ public partial class LauncherPopup : Window
this.openAllItems = openAllItems;
this.showSettings = showSettings;
this.editItem = editItem;
this.openContainingFolder = openContainingFolder;
BuildItems();
SizeChanged += (_, _) => QueueReposition();
}
@@ -210,6 +212,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(CreateOpenContainingFolderMenuItem(item));
contextMenu.Items.Add(CreateEditMenuItem(item));
return contextMenu;
}
@@ -250,6 +253,22 @@ public partial class LauncherPopup : Window
return disableMenuItem;
}
private System.Windows.Controls.MenuItem CreateOpenContainingFolderMenuItem(LauncherItem item)
{
System.Windows.Controls.MenuItem openFolderMenuItem = new()
{
Header = "Open Containing Folder",
IsEnabled = CanOpenContainingFolder(item)
};
openFolderMenuItem.Click += (_, e) =>
{
openContainingFolder(item);
e.Handled = true;
};
return openFolderMenuItem;
}
private System.Windows.Controls.MenuItem CreateEditMenuItem(LauncherItem item)
{
System.Windows.Controls.MenuItem editMenuItem = new()
@@ -271,6 +290,11 @@ public partial class LauncherPopup : Window
return item.Type != LauncherItemType.Menu && !item.IsDisabled && !string.IsNullOrWhiteSpace(item.Target);
}
private static bool CanOpenContainingFolder(LauncherItem item)
{
return item.Type is LauncherItemType.App or LauncherItemType.File && !string.IsNullOrWhiteSpace(item.Target);
}
private static IEnumerable<LauncherItem> GetDisplayItems(IEnumerable<LauncherItem> items)
{
return items

View File

@@ -22,6 +22,7 @@ Install the **.NET Desktop Runtime** for **Windows x64**.
5. Right-click a launcher entry and choose **Edit in Settings** to jump to that item.
6. Right-click a launcher entry and choose **Pin to Top** or **Unpin from Top**.
7. Right-click a launcher entry and choose **Disable Item** to hide it until it is enabled again from Settings.
8. Right-click an app or file entry and choose **Open Containing Folder**.
Recently launched entries appear in the launcher popup under **Recent**.
@@ -39,6 +40,7 @@ From Settings you can:
- Right-click an item and choose **Duplicate Item** to copy it
- 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**
- Set per-item icon sizes
- Back up and restore `config.json`
- Enable Start with Windows