Skip to content

Commit f708ad9

Browse files
committed
Add Windows Terminal to Shell Plugin
1 parent 6cf7674 commit f708ad9

File tree

4 files changed

+36
-1
lines changed

4 files changed

+36
-1
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,33 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
279279

280280
break;
281281
}
282+
case Shell.TerminalPWSH:
283+
{
284+
info.filename = "wt.exe"
285+
info.ArgumentList.Add("pwsh");
286+
if (_settings.LeaveShellOpen)
287+
{
288+
info.ArgumentList.Add("-NoExit");
289+
}
290+
info.ArgumentList.Add("-Command");
291+
info.ArgumentList.Add(command);
292+
break;
293+
}
294+
case Shell.TerminalCMD:
295+
{
296+
info.filename = "wt.exe"
297+
info.ArgumentList.Add("cmd");
298+
if (_settings.LeaveShellOpen)
299+
{
300+
info.ArgumentList.Add("/k");
301+
}
302+
else
303+
{
304+
info.ArgumentList.Add("/c");
305+
}
306+
info.ArgumentList.Add(command);
307+
break;
308+
}
282309
default:
283310
throw new NotImplementedException();
284311
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ public enum Shell
3939
Powershell = 1,
4040
RunCommand = 2,
4141
Pwsh = 3,
42+
TerminalPWSH = 4,
43+
TerminalCMD = 5,
4244
}
4345
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@
4343
Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" />
4444
<ComboBox
4545
x:Name="ShellComboBox"
46-
Grid.Row="4"
46+
Grid.Row="6"
4747
Margin="10,5,5,5"
4848
HorizontalAlignment="Left">
4949
<ComboBoxItem>CMD</ComboBoxItem>
5050
<ComboBoxItem>PowerShell</ComboBoxItem>
5151
<ComboBoxItem>Pwsh</ComboBoxItem>
52+
<ComboBoxItem>Terminal (Pwsh)</ComboBoxItem>
53+
<ComboBoxItem>Terminal (CMD)</ComboBoxItem>
5254
<ComboBoxItem>RunCommand</ComboBoxItem>
5355
</ComboBox>
5456
<StackPanel Grid.Row="5" Orientation="Horizontal">

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
9191
Shell.Cmd => 0,
9292
Shell.Powershell => 1,
9393
Shell.Pwsh => 2,
94+
Shell.TerminalPWSH = 3,
95+
Shell.TerminalCMD = 4,
9496
_ => ShellComboBox.Items.Count - 1
9597
};
9698

@@ -101,6 +103,8 @@ private void CMDSetting_OnLoaded(object sender, RoutedEventArgs re)
101103
0 => Shell.Cmd,
102104
1 => Shell.Powershell,
103105
2 => Shell.Pwsh,
106+
3 => Shell.TerminalPWSH,
107+
4 => Shell.TerminalCMD,
104108
_ => Shell.RunCommand
105109
};
106110
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;

0 commit comments

Comments
 (0)