Add Windows Terminal to Shell Plugin

This commit is contained in:
Azakidev 2025-02-04 23:18:21 +01:00
parent 6cf7674cac
commit f708ad9ffd
4 changed files with 36 additions and 1 deletions

View file

@ -279,6 +279,33 @@ namespace Flow.Launcher.Plugin.Shell
break; break;
} }
case Shell.TerminalPWSH:
{
info.filename = "wt.exe"
info.ArgumentList.Add("pwsh");
if (_settings.LeaveShellOpen)
{
info.ArgumentList.Add("-NoExit");
}
info.ArgumentList.Add("-Command");
info.ArgumentList.Add(command);
break;
}
case Shell.TerminalCMD:
{
info.filename = "wt.exe"
info.ArgumentList.Add("cmd");
if (_settings.LeaveShellOpen)
{
info.ArgumentList.Add("/k");
}
else
{
info.ArgumentList.Add("/c");
}
info.ArgumentList.Add(command);
break;
}
default: default:
throw new NotImplementedException(); throw new NotImplementedException();
} }

View file

@ -39,5 +39,7 @@ namespace Flow.Launcher.Plugin.Shell
Powershell = 1, Powershell = 1,
RunCommand = 2, RunCommand = 2,
Pwsh = 3, Pwsh = 3,
TerminalPWSH = 4,
TerminalCMD = 5,
} }
} }

View file

@ -43,12 +43,14 @@
Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" /> Content="{DynamicResource flowlauncher_plugin_cmd_always_run_as_administrator}" />
<ComboBox <ComboBox
x:Name="ShellComboBox" x:Name="ShellComboBox"
Grid.Row="4" Grid.Row="6"
Margin="10,5,5,5" Margin="10,5,5,5"
HorizontalAlignment="Left"> HorizontalAlignment="Left">
<ComboBoxItem>CMD</ComboBoxItem> <ComboBoxItem>CMD</ComboBoxItem>
<ComboBoxItem>PowerShell</ComboBoxItem> <ComboBoxItem>PowerShell</ComboBoxItem>
<ComboBoxItem>Pwsh</ComboBoxItem> <ComboBoxItem>Pwsh</ComboBoxItem>
<ComboBoxItem>Terminal (Pwsh)</ComboBoxItem>
<ComboBoxItem>Terminal (CMD)</ComboBoxItem>
<ComboBoxItem>RunCommand</ComboBoxItem> <ComboBoxItem>RunCommand</ComboBoxItem>
</ComboBox> </ComboBox>
<StackPanel Grid.Row="5" Orientation="Horizontal"> <StackPanel Grid.Row="5" Orientation="Horizontal">

View file

@ -91,6 +91,8 @@ namespace Flow.Launcher.Plugin.Shell
Shell.Cmd => 0, Shell.Cmd => 0,
Shell.Powershell => 1, Shell.Powershell => 1,
Shell.Pwsh => 2, Shell.Pwsh => 2,
Shell.TerminalPWSH = 3,
Shell.TerminalCMD = 4,
_ => ShellComboBox.Items.Count - 1 _ => ShellComboBox.Items.Count - 1
}; };
@ -101,6 +103,8 @@ namespace Flow.Launcher.Plugin.Shell
0 => Shell.Cmd, 0 => Shell.Cmd,
1 => Shell.Powershell, 1 => Shell.Powershell,
2 => Shell.Pwsh, 2 => Shell.Pwsh,
3 => Shell.TerminalPWSH,
4 => Shell.TerminalCMD,
_ => Shell.RunCommand _ => Shell.RunCommand
}; };
LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand; LeaveShellOpen.IsEnabled = _settings.Shell != Shell.RunCommand;