mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PTRun][Shell]Select which shell is used (#28121)
* [PTRun] LeaveShellOpen condition added to run command * [PTRun] Keep shell open added to shell plugin settings. * [PTRun] Unnecessary variable deleted. Formatting. * [PTRun] Variable name changed. * [PTRun] Shell selection * [PTRun] Bugfix * [PTRun] Review comments. * [PTRun] Revert commit * [PTRun] An enumaration is added to PluginAdditionalOption for selection types.
This commit is contained in:
@@ -47,6 +47,21 @@ namespace Microsoft.Plugin.Shell
|
||||
DisplayLabel = Resources.wox_leave_shell_open,
|
||||
Value = _settings.LeaveShellOpen,
|
||||
},
|
||||
|
||||
new PluginAdditionalOption()
|
||||
{
|
||||
Key = "ShellCommandExecution",
|
||||
DisplayLabel = Resources.wox_shell_command_execution,
|
||||
SelectionTypeValue = (int)PluginAdditionalOption.SelectionType.Combobox,
|
||||
ComboBoxOptions = new List<string>
|
||||
{
|
||||
Resources.run_command_in_command_prompt,
|
||||
Resources.run_command_in_powershell,
|
||||
Resources.find_executable_file_and_run_it,
|
||||
Resources.run_command_in_windows_terminal,
|
||||
},
|
||||
Option = (int)_settings.Shell,
|
||||
},
|
||||
};
|
||||
|
||||
private PluginInitContext _context;
|
||||
@@ -418,12 +433,17 @@ namespace Microsoft.Plugin.Shell
|
||||
public void UpdateSettings(PowerLauncherPluginSettings settings)
|
||||
{
|
||||
var leaveShellOpen = false;
|
||||
var shellOption = 2;
|
||||
|
||||
if (settings != null && settings.AdditionalOptions != null)
|
||||
{
|
||||
var optionLeaveShellOpen = settings.AdditionalOptions.FirstOrDefault(x => x.Key == "LeaveShellOpen");
|
||||
leaveShellOpen = optionLeaveShellOpen?.Value ?? leaveShellOpen;
|
||||
_settings.LeaveShellOpen = leaveShellOpen;
|
||||
|
||||
var optionShell = settings.AdditionalOptions.FirstOrDefault(x => x.Key == "ShellCommandExecution");
|
||||
shellOption = optionShell?.Option ?? shellOption;
|
||||
_settings.Shell = (ExecutionShell)shellOption;
|
||||
}
|
||||
|
||||
Save();
|
||||
|
||||
Reference in New Issue
Block a user