mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge branch 'dev' into avalonia
This commit is contained in:
commit
ce6321cf8b
7 changed files with 60 additions and 8 deletions
|
|
@ -54,6 +54,11 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
|
||||
contextMenus.Add(CreateOpenContainingFolderResult(record));
|
||||
|
||||
if (record.Type == ResultType.File)
|
||||
{
|
||||
contextMenus.Add(CreateOpenWithMenu(record));
|
||||
}
|
||||
|
||||
if (record.WindowsIndexed)
|
||||
{
|
||||
contextMenus.Add(CreateOpenWindowsIndexingOptions());
|
||||
|
|
@ -434,6 +439,22 @@ namespace Flow.Launcher.Plugin.Explorer
|
|||
};
|
||||
}
|
||||
|
||||
private Result CreateOpenWithMenu(SearchResult record)
|
||||
{
|
||||
return new Result
|
||||
{
|
||||
Title = Context.API.GetTranslation("plugin_explorer_openwith"),
|
||||
SubTitle = Context.API.GetTranslation("plugin_explorer_openwith_subtitle"),
|
||||
Action = _ =>
|
||||
{
|
||||
Process.Start("rundll32.exe", $"{Path.Combine(Environment.SystemDirectory, "shell32.dll")},OpenAs_RunDLL {record.FullPath}");
|
||||
return true;
|
||||
},
|
||||
IcoPath = Constants.ShowContextMenuImagePath,
|
||||
Glyph = new GlyphInfo(FontFamily: "/Resources/#Segoe Fluent Icons", Glyph: "\ue7ac"),
|
||||
};
|
||||
}
|
||||
|
||||
private void LogException(string message, Exception e)
|
||||
{
|
||||
Log.Exception($"|Flow.Launcher.Plugin.Folder.ContextMenu|{message}", e);
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@
|
|||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_title">Remove from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_remove_from_quickaccess_subtitle">Remove current item from Quick Access</system:String>
|
||||
<system:String x:Key="plugin_explorer_show_contextmenu_title">Show Windows Context Menu</system:String>
|
||||
|
||||
<system:String x:Key="plugin_explorer_openwith">Open With</system:String>
|
||||
<system:String x:Key="plugin_explorer_openwith_subtitle">Select a program to open with</system:String>
|
||||
|
||||
<!-- Special Results-->
|
||||
<system:String x:Key="plugin_explorer_diskfreespace">{0} free of {1}</system:String>
|
||||
<system:String x:Key="plugin_explorer_openresultfolder">Open in Default File Manager</system:String>
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_relace_winr">Replace Win+R</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_close_cmd_after_press">Close Command Prompt after pressing any key</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_press_any_key_to_close">Press any key to close this window...</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_leave_cmd_open">Do not close Command Prompt after command execution</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_always_run_as_administrator">Always run as administrator</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_cmd_run_as_different_user">Run as different user</system:String>
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
case Shell.Cmd:
|
||||
{
|
||||
info.FileName = "cmd.exe";
|
||||
info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}";
|
||||
info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command} {(_settings.CloseShellAfterPress ? $"&& echo {context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")} && pause > nul /c" : "")}";
|
||||
|
||||
//// Use info.Arguments instead of info.ArgumentList to enable users better control over the arguments they are writing.
|
||||
//// Previous code using ArgumentList, commands needed to be separated correctly:
|
||||
|
|
@ -232,7 +232,7 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
else
|
||||
{
|
||||
info.ArgumentList.Add("-Command");
|
||||
info.ArgumentList.Add(command);
|
||||
info.ArgumentList.Add($"{command}; {(_settings.CloseShellAfterPress ? $"Write-Host '{context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'; [System.Console]::ReadKey(); exit" : "")}");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
info.ArgumentList.Add("-NoExit");
|
||||
}
|
||||
info.ArgumentList.Add("-Command");
|
||||
info.ArgumentList.Add(command);
|
||||
info.ArgumentList.Add($"{command}; {(_settings.CloseShellAfterPress ? $"Write-Host '{context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close")}'; [System.Console]::ReadKey(); exit" : "")}");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
public Shell Shell { get; set; } = Shell.Cmd;
|
||||
|
||||
public bool ReplaceWinR { get; set; } = false;
|
||||
|
||||
public bool CloseShellAfterPress { get; set; } = false;
|
||||
|
||||
public bool LeaveShellOpen { get; set; }
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<CheckBox
|
||||
x:Name="ReplaceWinR"
|
||||
|
|
@ -23,20 +24,26 @@
|
|||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource flowlauncher_plugin_cmd_relace_winr}" />
|
||||
<CheckBox
|
||||
x:Name="LeaveShellOpen"
|
||||
x:Name="CloseShellAfterPress"
|
||||
Grid.Row="1"
|
||||
Margin="10,5,5,5"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource flowlauncher_plugin_cmd_close_cmd_after_press}" />
|
||||
<CheckBox
|
||||
x:Name="LeaveShellOpen"
|
||||
Grid.Row="2"
|
||||
Margin="10,5,5,5"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource flowlauncher_plugin_cmd_leave_cmd_open}" />
|
||||
<CheckBox
|
||||
x:Name="AlwaysRunAsAdministrator"
|
||||
Grid.Row="2"
|
||||
Grid.Row="3"
|
||||
Margin="10,5,5,5"
|
||||
HorizontalAlignment="Left"
|
||||
Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" />
|
||||
<ComboBox
|
||||
x:Name="ShellComboBox"
|
||||
Grid.Row="3"
|
||||
Grid.Row="4"
|
||||
Margin="10,5,5,5"
|
||||
HorizontalAlignment="Left">
|
||||
<ComboBoxItem>CMD</ComboBoxItem>
|
||||
|
|
@ -44,7 +51,7 @@
|
|||
<ComboBoxItem>Pwsh</ComboBoxItem>
|
||||
<ComboBoxItem>RunCommand</ComboBoxItem>
|
||||
</ComboBox>
|
||||
<StackPanel Grid.Row="4" Orientation="Horizontal">
|
||||
<StackPanel Grid.Row="5" Orientation="Horizontal">
|
||||
<CheckBox
|
||||
x:Name="ShowOnlyMostUsedCMDs"
|
||||
Margin="10,5,5,5"
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
|
||||
{
|
||||
ReplaceWinR.IsChecked = _settings.ReplaceWinR;
|
||||
|
||||
CloseShellAfterPress.IsChecked = _settings.CloseShellAfterPress;
|
||||
|
||||
LeaveShellOpen.IsChecked = _settings.LeaveShellOpen;
|
||||
|
||||
|
|
@ -38,14 +40,30 @@ namespace Flow.Launcher.Plugin.Shell
|
|||
_settings.ShowOnlyMostUsedCMDsNumber = (int)ShowOnlyMostUsedCMDsNumber.SelectedItem;
|
||||
}
|
||||
|
||||
CloseShellAfterPress.Checked += (o, e) =>
|
||||
{
|
||||
_settings.CloseShellAfterPress = true;
|
||||
LeaveShellOpen.IsChecked = false;
|
||||
LeaveShellOpen.IsEnabled = false;
|
||||
};
|
||||
|
||||
CloseShellAfterPress.Unchecked += (o, e) =>
|
||||
{
|
||||
_settings.CloseShellAfterPress = false;
|
||||
LeaveShellOpen.IsEnabled = true;
|
||||
};
|
||||
|
||||
LeaveShellOpen.Checked += (o, e) =>
|
||||
{
|
||||
_settings.LeaveShellOpen = true;
|
||||
CloseShellAfterPress.IsChecked = false;
|
||||
CloseShellAfterPress.IsEnabled = false;
|
||||
};
|
||||
|
||||
LeaveShellOpen.Unchecked += (o, e) =>
|
||||
{
|
||||
_settings.LeaveShellOpen = false;
|
||||
CloseShellAfterPress.IsEnabled = true;
|
||||
};
|
||||
|
||||
AlwaysRunAsAdministrator.Checked += (o, e) =>
|
||||
|
|
|
|||
Loading…
Reference in a new issue