Skip to content

Commit 2daed50

Browse files
authored
merge PR #2183: support Pwsh in Shell Plugin (PowerShell 7.x)
2 parents e1c63af + c6a6c6b commit 2daed50

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,19 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
237237
break;
238238
}
239239

240+
case Shell.Pwsh:
241+
{
242+
info.FileName = "pwsh.exe";
243+
if (_settings.LeaveShellOpen)
244+
{
245+
info.ArgumentList.Add("-NoExit");
246+
}
247+
info.ArgumentList.Add("-Command");
248+
info.ArgumentList.Add(command);
249+
250+
break;
251+
}
252+
240253
case Shell.RunCommand:
241254
{
242255
var parts = command.Split(new[]

Plugins/Flow.Launcher.Plugin.Shell/Settings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public enum Shell
3636
Cmd = 0,
3737
Powershell = 1,
3838
RunCommand = 2,
39-
39+
Pwsh = 3,
4040
}
4141
}

Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
HorizontalAlignment="Left">
4242
<ComboBoxItem>CMD</ComboBoxItem>
4343
<ComboBoxItem>PowerShell</ComboBoxItem>
44+
<ComboBoxItem>Pwsh</ComboBoxItem>
4445
<ComboBoxItem>RunCommand</ComboBoxItem>
4546
</ComboBox>
4647
<StackPanel Grid.Row="4" Orientation="Horizontal">

Plugins/Flow.Launcher.Plugin.Shell/ShellSetting.xaml.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,23 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
6868
_settings.ReplaceWinR = false;
6969
};
7070

71-
ShellComboBox.SelectedIndex = (int) _settings.Shell;
71+
ShellComboBox.SelectedIndex = _settings.Shell switch
72+
{
73+
Shell.Cmd => 0,
74+
Shell.Powershell => 1,
75+
Shell.Pwsh => 2,
76+
_ => ShellComboBox.Items.Count - 1
77+
};
78+
7279
ShellComboBox.SelectionChanged += (o, e) =>
7380
{
74-
_settings.Shell = (Shell) ShellComboBox.SelectedIndex;
81+
_settings.Shell = ShellComboBox.SelectedIndex switch
82+
{
83+
0 => Shell.Cmd,
84+
1 => Shell.Powershell,
85+
2 => Shell.Pwsh,
86+
_ => Shell.RunCommand
87+
};
7588
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;
7689
};
7790

0 commit comments

Comments
 (0)