From 9e5e2135f0ddbcf33ba08609175f182adcc0eb17 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 14:21:40 +0800
Subject: [PATCH 1/8] Tweak ctrl+enter guide
---
Flow.Launcher/Languages/en.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index ad1c002e6..8142dcd13 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -348,7 +348,7 @@
Back / Context Menu
Item Navigation
Open Context Menu
- Open Containing Folder
+ Open A File/Folder's Containing Folder
Run as Admin
Query History
Back to Result in Context Menu
From b096944ba19d80694e263ce580e3e340b9777263 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 14:22:10 +0800
Subject: [PATCH 2/8] Add to modifier keys
---
Flow.Launcher.Plugin/ActionContext.cs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/Flow.Launcher.Plugin/ActionContext.cs b/Flow.Launcher.Plugin/ActionContext.cs
index b9e499d2b..d898972da 100644
--- a/Flow.Launcher.Plugin/ActionContext.cs
+++ b/Flow.Launcher.Plugin/ActionContext.cs
@@ -1,4 +1,6 @@
-namespace Flow.Launcher.Plugin
+using System.Windows.Input;
+
+namespace Flow.Launcher.Plugin
{
public class ActionContext
{
@@ -11,5 +13,13 @@
public bool ShiftPressed { get; set; }
public bool AltPressed { get; set; }
public bool WinPressed { get; set; }
+
+ public ModifierKeys ToModifierKeys()
+ {
+ return (CtrlPressed ? ModifierKeys.Control : ModifierKeys.None) |
+ (ShiftPressed ? ModifierKeys.Shift : ModifierKeys.None) |
+ (AltPressed ? ModifierKeys.Alt : ModifierKeys.None) |
+ (WinPressed ? ModifierKeys.Windows : ModifierKeys.None);
+ }
}
-}
\ No newline at end of file
+}
From 2d13d5684b2588b3f5a06adeb1f5c7e4c2b80d3e Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 14:24:04 +0800
Subject: [PATCH 3/8] Fix style
---
.../Views/ExplorerSettings.xaml | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
index 153a8eb7e..33cef6e45 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
@@ -348,17 +348,11 @@
Header="{DynamicResource plugin_explorer_everything_setting_header}"
Style="{DynamicResource ExplorerTabItem}">
-
-
-
From a22028460dfaf0e391c7b9ea57b84dfc66352ce7 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 15:02:11 +0800
Subject: [PATCH 4/8] Add option to open in default file manager
---
.../Languages/en.xaml | 3 ++
.../Search/ResultManager.cs | 43 ++++++++++++++++---
.../Flow.Launcher.Plugin.Explorer/Settings.cs | 1 +
.../Views/ExplorerSettings.xaml | 9 +++-
4 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
index 58fe31dd6..d5352ef1e 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml
@@ -18,6 +18,8 @@
The warning message has been switched off. As an alternative for searching files and folders, would you like to install Everything plugin?{0}{0}Select 'Yes' to install Everything plugin, or 'No' to return
Explorer Alternative
Error occurred during search: {0}
+ Could not open folder
+ Could not open file
Delete
@@ -34,6 +36,7 @@
Shell Path
Index Search Excluded Paths
Use search result's location as the working directory of the executable
+ Hit Enter to open folder in Default File Manager
Use Index Search For Path Search
Indexing Options
Search:
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 7147c348e..5ac01c3ad 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -8,6 +8,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Flow.Launcher.Plugin.Explorer.Search.Everything;
+using System.Windows.Input;
namespace Flow.Launcher.Plugin.Explorer.Search
{
@@ -79,7 +80,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Action = c =>
{
// open folder
- if (c.SpecialKeyState.CtrlPressed || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
+ if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift) || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
{
try
{
@@ -88,13 +89,43 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Could not start " + path);
+ MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
+ return false;
+ }
+ }
+ // Open containing folder
+ if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
+ {
+ try
+ {
+ Context.API.OpenDirectory(Path.GetDirectoryName(path), path);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
return false;
}
}
+ if (Settings.DefaultOpenInFileManager)
+ {
+ try
+ {
+ OpenFolder(path);
+ return true;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_opendir_error"));
+ return false;
+ }
+ }
+ else
+ {
// or make this folder the current query
Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword));
+ }
return false;
},
@@ -222,11 +253,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search
{
try
{
- if (c.SpecialKeyState.CtrlPressed && c.SpecialKeyState.ShiftPressed)
+ if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))
{
OpenFileAsAdmin(filePath);
}
- else if (c.SpecialKeyState.CtrlPressed)
+ else if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control)
{
OpenFolder(filePath, filePath);
}
@@ -237,7 +268,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
catch (Exception ex)
{
- MessageBox.Show(ex.Message, "Could not start " + filePath);
+ MessageBox.Show(ex.Message, Context.API.GetTranslation("plugin_explorer_openfile_error"));
}
return true;
@@ -265,7 +296,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
private static void OpenFolder(string folderPath, string fileNameOrFilePath = null)
{
IncrementEverythingRunCounterIfNeeded(folderPath);
- Context.API.OpenDirectory(Path.GetDirectoryName(folderPath), fileNameOrFilePath);
+ Context.API.OpenDirectory(folderPath, fileNameOrFilePath);
}
private static void OpenFileAsAdmin(string filePath)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index 339eaaaaa..b34cc3af9 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -32,6 +32,7 @@ namespace Flow.Launcher.Plugin.Explorer
public bool ShowWindowsContextMenu { get; set; } = true;
+ public bool DefaultOpenInFileManager { get; set; } = false;
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
index 33cef6e45..9beb43a48 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
@@ -168,6 +168,11 @@
HorizontalAlignment="Left"
Content="{DynamicResource plugin_explorer_use_location_as_working_dir}"
IsChecked="{Binding Settings.UseLocationAsWorkingDir}" />
+
@@ -348,11 +353,11 @@
Header="{DynamicResource plugin_explorer_everything_setting_header}"
Style="{DynamicResource ExplorerTabItem}">
-
+ IsChecked="{Binding Settings.EverythingSearchFullPath}" />
From 0f5b02fa38241bce2f86bc7a961395de01ccc19e Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 15:22:29 +0800
Subject: [PATCH 5/8] Open file with associated program
Prevent opening zip in Explorer
Fix working directory issue
---
.../SharedCommands/FilesFolders.cs | 30 ++++++++++++++++
.../Search/ResultManager.cs | 34 ++++---------------
2 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
index 6b7f0c2d3..dd4dcc7a4 100644
--- a/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
+++ b/Flow.Launcher.Plugin/SharedCommands/FilesFolders.cs
@@ -170,6 +170,36 @@ namespace Flow.Launcher.Plugin.SharedCommands
}
}
+ ///
+ /// Open a file with associated application
+ ///
+ /// File path
+ /// Working directory
+ /// Open as Administrator
+ public static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false)
+ {
+ var psi = new ProcessStartInfo
+ {
+ FileName = filePath,
+ UseShellExecute = true,
+ WorkingDirectory = workingDir,
+ Verb = asAdmin ? "runas" : string.Empty
+ };
+ try
+ {
+ if (FileExists(filePath))
+ Process.Start(psi);
+ }
+ catch (Exception)
+ {
+#if DEBUG
+ throw;
+#else
+ MessageBox.Show(string.Format("Unable to open the path {0}, please check if it exists", filePath));
+#endif
+ }
+ }
+
///
/// This checks whether a given string is a directory path or network location string.
/// It does not check if location actually exists.
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 5ac01c3ad..76bf54acd 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -123,8 +123,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
else
{
- // or make this folder the current query
- Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword));
+ // or make this folder the current query
+ Context.API.ChangeQuery(GetPathWithActionKeyword(path, ResultType.Folder, query.ActionKeyword));
}
return false;
@@ -255,7 +255,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
{
if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))
{
- OpenFileAsAdmin(filePath);
+ OpenFile(filePath, Settings.UseLocationAsWorkingDir ? Path.GetDirectoryName(filePath) : string.Empty, true);
}
else if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control)
{
@@ -263,7 +263,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
else
{
- OpenFile(filePath);
+ OpenFile(filePath, Settings.UseLocationAsWorkingDir ? Path.GetDirectoryName(filePath) : string.Empty);
}
}
catch (Exception ex)
@@ -287,10 +287,10 @@ namespace Flow.Launcher.Plugin.Explorer.Search
return MediaExtensions.Contains(extension.ToLowerInvariant());
}
- private static void OpenFile(string filePath)
+ private static void OpenFile(string filePath, string workingDir = "", bool asAdmin = false)
{
IncrementEverythingRunCounterIfNeeded(filePath);
- FilesFolders.OpenPath(filePath);
+ FilesFolders.OpenFile(filePath, workingDir, asAdmin);
}
private static void OpenFolder(string folderPath, string fileNameOrFilePath = null)
@@ -299,28 +299,6 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Context.API.OpenDirectory(folderPath, fileNameOrFilePath);
}
- private static void OpenFileAsAdmin(string filePath)
- {
- _ = Task.Run(() =>
- {
- try
- {
- IncrementEverythingRunCounterIfNeeded(filePath);
- Process.Start(new ProcessStartInfo
- {
- FileName = filePath,
- UseShellExecute = true,
- WorkingDirectory = Settings.UseLocationAsWorkingDir ? Path.GetDirectoryName(filePath) : string.Empty,
- Verb = "runas",
- });
- }
- catch (Exception e)
- {
- MessageBox.Show(e.Message, "Could not start " + filePath);
- }
- });
- }
-
private static void IncrementEverythingRunCounterIfNeeded(string fileOrFolder)
{
if (Settings.EverythingEnabled)
From 9db13fdbb6d9f99f175341920d5b5f2d793d0655 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Fri, 24 Mar 2023 15:45:45 +0800
Subject: [PATCH 6/8] Fix path search logic
open folder in file manager when path search is disabled
---
.../Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index 76bf54acd..c07d83611 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -80,7 +80,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
Action = c =>
{
// open folder
- if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift) || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
+ if (c.SpecialKeyState.ToModifierKeys() == (ModifierKeys.Control | ModifierKeys.Shift))
{
try
{
@@ -94,7 +94,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
}
// Open containing folder
- if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
+ if (c.SpecialKeyState.ToModifierKeys() == ModifierKeys.Control)
{
try
{
@@ -108,7 +108,8 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
}
- if (Settings.DefaultOpenInFileManager)
+ // If path search is disabled just open it in file manager
+ if (Settings.DefaultOpenInFileManager || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
{
try
{
From 2a96f1cd48212a6a28cab75b72313f6547c2acd1 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 29 Mar 2023 15:19:55 +0800
Subject: [PATCH 7/8] Rename for clarity
---
Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs | 2 +-
Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
index c07d83611..83c173ac6 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs
@@ -109,7 +109,7 @@ namespace Flow.Launcher.Plugin.Explorer.Search
}
// If path search is disabled just open it in file manager
- if (Settings.DefaultOpenInFileManager || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
+ if (Settings.DefaultOpenFolderInFileManager || (!Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled))
{
try
{
diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
index b34cc3af9..4077e2fcc 100644
--- a/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
+++ b/Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs
@@ -32,7 +32,7 @@ namespace Flow.Launcher.Plugin.Explorer
public bool ShowWindowsContextMenu { get; set; } = true;
- public bool DefaultOpenInFileManager { get; set; } = false;
+ public bool DefaultOpenFolderInFileManager { get; set; } = false;
public string SearchActionKeyword { get; set; } = Query.GlobalPluginWildcardSign;
From 9f88a077841dc2e9a8ac46954eab221f27701447 Mon Sep 17 00:00:00 2001
From: Vic <10308169+VictoriousRaptor@users.noreply.github.com>
Date: Wed, 29 Mar 2023 15:26:51 +0800
Subject: [PATCH 8/8] update wizard
---
Flow.Launcher/Languages/en.xaml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index 8142dcd13..103d523a7 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -349,7 +349,7 @@
Item Navigation
Open Context Menu
Open A File/Folder's Containing Folder
- Run as Admin
+ Run as Admin / Open Folder in Default File Manager
Query History
Back to Result in Context Menu
Autocomplete