mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2042 from VictoriousRaptor/ProgramOpenFolderHotkey
Add open parent folder hotkey for program plugin
This commit is contained in:
commit
d8965c5823
3 changed files with 27 additions and 15 deletions
|
|
@ -348,7 +348,7 @@
|
|||
<system:String x:Key="HotkeyUpDownDesc">Back / Context Menu</system:String>
|
||||
<system:String x:Key="HotkeyLeftRightDesc">Item Navigation</system:String>
|
||||
<system:String x:Key="HotkeyShiftEnterDesc">Open Context Menu</system:String>
|
||||
<system:String x:Key="HotkeyCtrlEnterDesc">Open A File/Folder's Containing Folder</system:String>
|
||||
<system:String x:Key="HotkeyCtrlEnterDesc">Open Containing Folder</system:String>
|
||||
<system:String x:Key="HotkeyCtrlShiftEnterDesc">Run as Admin / Open Folder in Default File Manager</system:String>
|
||||
<system:String x:Key="HotkeyCtrlHDesc">Query History</system:String>
|
||||
<system:String x:Key="HotkeyESCDesc">Back to Result in Context Menu</system:String>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ using Flow.Launcher.Plugin.SharedModels;
|
|||
using System.Threading.Channels;
|
||||
using System.Xml;
|
||||
using Windows.ApplicationModel.Core;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Program.Programs
|
||||
{
|
||||
|
|
@ -422,12 +423,16 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
ContextData = this,
|
||||
Action = e =>
|
||||
{
|
||||
var elevated = (
|
||||
e.SpecialKeyState.CtrlPressed &&
|
||||
e.SpecialKeyState.ShiftPressed &&
|
||||
!e.SpecialKeyState.AltPressed &&
|
||||
!e.SpecialKeyState.WinPressed
|
||||
);
|
||||
// Ctrl + Enter to open containing folder
|
||||
bool openFolder = e.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control;
|
||||
if (openFolder)
|
||||
{
|
||||
Main.Context.API.OpenDirectory(Location);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ctrl + Shift + Enter to run elevated
|
||||
bool elevated = e.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift);
|
||||
|
||||
bool shouldRunElevated = elevated && CanRunElevated;
|
||||
_ = Task.Run(() => Launch(shouldRunElevated)).ConfigureAwait(false);
|
||||
|
|
@ -459,7 +464,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/folder.png"
|
||||
IcoPath = "Images/folder.png",
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe838"),
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -473,7 +479,8 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
Task.Run(() => Launch(true)).ConfigureAwait(false);
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/cmd.png"
|
||||
IcoPath = "Images/cmd.png",
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\xe7ef")
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using System.Threading.Channels;
|
||||
using Flow.Launcher.Plugin.Program.Views.Models;
|
||||
using IniParser;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Flow.Launcher.Plugin.Program.Programs
|
||||
{
|
||||
|
|
@ -169,12 +170,16 @@ namespace Flow.Launcher.Plugin.Program.Programs
|
|||
ContextData = this,
|
||||
Action = c =>
|
||||
{
|
||||
var runAsAdmin = (
|
||||
c.SpecialKeyState.CtrlPressed &&
|
||||
c.SpecialKeyState.ShiftPressed &&
|
||||
!c.SpecialKeyState.AltPressed &&
|
||||
!c.SpecialKeyState.WinPressed
|
||||
);
|
||||
// Ctrl + Enter to open containing folder
|
||||
bool openFolder = c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control;
|
||||
if (openFolder)
|
||||
{
|
||||
Main.Context.API.OpenDirectory(ParentDirectory, FullPath);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Ctrl + Shift + Enter to run as admin
|
||||
bool runAsAdmin = c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift);
|
||||
|
||||
var info = new ProcessStartInfo
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue