mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add option to open in default file manager
This commit is contained in:
parent
2d13d5684b
commit
a22028460d
4 changed files with 48 additions and 8 deletions
|
|
@ -18,6 +18,8 @@
|
|||
<system:String x:Key="plugin_explorer_alternative">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</system:String>
|
||||
<system:String x:Key="plugin_explorer_alternative_title">Explorer Alternative</system:String>
|
||||
<system:String x:Key="plugin_explorer_directoryinfosearch_error">Error occurred during search: {0}</system:String>
|
||||
<system:String x:Key="plugin_explorer_opendir_error">Could not open folder</system:String>
|
||||
<system:String x:Key="plugin_explorer_openfile_error">Could not open file</system:String>
|
||||
|
||||
<!-- Controls -->
|
||||
<system:String x:Key="plugin_explorer_delete">Delete</system:String>
|
||||
|
|
@ -34,6 +36,7 @@
|
|||
<system:String x:Key="plugin_explorer_shell_path">Shell Path</system:String>
|
||||
<system:String x:Key="plugin_explorer_indexsearchexcludedpaths_header">Index Search Excluded Paths</system:String>
|
||||
<system:String x:Key="plugin_explorer_use_location_as_working_dir">Use search result's location as the working directory of the executable</system:String>
|
||||
<system:String x:Key="plugin_explorer_default_open_in_file_manager">Hit Enter to open folder in Default File Manager</system:String>
|
||||
<system:String x:Key="plugin_explorer_usewindowsindexfordirectorysearch">Use Index Search For Path Search</system:String>
|
||||
<system:String x:Key="plugin_explorer_manageindexoptions">Indexing Options</system:String>
|
||||
<system:String x:Key="plugin_explorer_actionkeywordview_search">Search:</system:String>
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,11 @@
|
|||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource plugin_explorer_use_location_as_working_dir}"
|
||||
IsChecked="{Binding Settings.UseLocationAsWorkingDir}" />
|
||||
<CheckBox
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource plugin_explorer_default_open_in_file_manager}"
|
||||
IsChecked="{Binding Settings.DefaultOpenInFileManager}" />
|
||||
<StackPanel Margin="0,10,0,10" Orientation="Horizontal">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
@ -348,11 +353,11 @@
|
|||
Header="{DynamicResource plugin_explorer_everything_setting_header}"
|
||||
Style="{DynamicResource ExplorerTabItem}">
|
||||
<StackPanel Margin="10" Orientation="Vertical">
|
||||
<CheckBox
|
||||
<CheckBox
|
||||
Margin="20,10,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource flowlauncher_plugin_everything_search_fullpath}"
|
||||
IsChecked="{Binding Settings.EverythingSearchFullPath}" />
|
||||
IsChecked="{Binding Settings.EverythingSearchFullPath}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Grid Margin="20,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
|
|
|||
Loading…
Reference in a new issue