Skip to content

Commit 4e5f739

Browse files
authored
Auto-Detect and List Windows Terminal (#543)
1 parent bd8ad1d commit 4e5f739

File tree

2 files changed

+75
-53
lines changed

2 files changed

+75
-53
lines changed

Files.Package/Package.appxmanifest

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop4="http://schemas.microsoft.com/appx/manifest/desktop/windows10/4" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap uap5 mp rescap desktop4 desktop">
3-
<Identity Name="49306atecsolution.FilesUWP" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.7.5.0" />
4-
<Properties>
5-
<DisplayName>Files UWP - Preview</DisplayName>
6-
<PublisherDisplayName>Yair A</PublisherDisplayName>
7-
<Logo>Assets\StoreLogo.png</Logo>
8-
</Properties>
9-
<Dependencies>
10-
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
11-
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
12-
</Dependencies>
13-
<Resources>
14-
<Resource Language="x-generate" />
15-
</Resources>
16-
<Applications>
17-
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$" desktop4:SupportsMultipleInstances="true">
18-
<uap:VisualElements DisplayName="Files UWP - Preview" Description="Meet Files, a free and open-source File Manager for Windows 10. Created from the ground up to look and feel amazing, Files is built to replace the dated Windows File Explorer." Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" BackgroundColor="transparent">
19-
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square71x71Logo="Assets\SmallTile.png" Square310x310Logo="Assets\LargeTile.png" ShortName="Files">
20-
<uap:ShowNameOnTiles>
21-
<uap:ShowOn Tile="square150x150Logo"/>
22-
<uap:ShowOn Tile="wide310x150Logo"/>
23-
<uap:ShowOn Tile="square310x310Logo"/>
24-
</uap:ShowNameOnTiles>
25-
</uap:DefaultTile>
26-
<uap:SplashScreen Image="Assets\SplashScreen.png" uap5:Optional="true" />
27-
</uap:VisualElements>
28-
<Extensions>
29-
<desktop:Extension Category="windows.fullTrustProcess" Executable="Files.Launcher\ProcessLauncher.exe">
30-
<desktop:FullTrustProcess>
31-
<desktop:ParameterGroup GroupId="DesktopAppExeGroup" Parameters="/DesktopApp"/>
32-
<desktop:ParameterGroup GroupId="TerminalGroup" Parameters="/Terminal"/>
33-
<desktop:ParameterGroup GroupId="UserFolderPathsGroup" Parameters="/DetectUserPaths"/>
34-
</desktop:FullTrustProcess>
35-
</desktop:Extension>
36-
<uap:Extension Category="windows.protocol">
37-
<uap:Protocol ReturnResults="none" Name="files-uwp"/>
38-
</uap:Extension>
39-
<uap5:Extension
40-
Category="windows.appExecutionAlias"
41-
Executable="files.exe"
42-
EntryPoint="files.App">
43-
<uap5:AppExecutionAlias>
44-
<uap5:ExecutionAlias Alias="files.exe"/>
45-
</uap5:AppExecutionAlias>
46-
</uap5:Extension>
47-
</Extensions>
48-
</Application>
49-
</Applications>
50-
<Capabilities>
51-
<uap:Capability Name="removableStorage" />
52-
<rescap:Capability Name="runFullTrust" />
53-
<rescap:Capability Name="broadFileSystemAccess" />
54-
<Capability Name="internetClient"/>
55-
</Capabilities>
3+
<Identity Name="49306atecsolution.FilesUWP" Publisher="CN=53EC4384-7F5B-4CF6-8C23-513FFE9D1AB7" Version="0.7.5.0" />
4+
<Properties>
5+
<DisplayName>Files UWP - Preview</DisplayName>
6+
<PublisherDisplayName>Yair A</PublisherDisplayName>
7+
<Logo>Assets\StoreLogo.png</Logo>
8+
</Properties>
9+
<Dependencies>
10+
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
11+
<TargetDeviceFamily Name="Windows.Desktop" MinVersion="10.0.14393.0" MaxVersionTested="10.0.14393.0" />
12+
</Dependencies>
13+
<Resources>
14+
<Resource Language="x-generate" />
15+
</Resources>
16+
<Applications>
17+
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="$targetentrypoint$" desktop4:SupportsMultipleInstances="true">
18+
<uap:VisualElements DisplayName="Files UWP - Preview" Description="Meet Files, a free and open-source File Manager for Windows 10. Created from the ground up to look and feel amazing, Files is built to replace the dated Windows File Explorer." Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" BackgroundColor="transparent">
19+
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png" Square71x71Logo="Assets\SmallTile.png" Square310x310Logo="Assets\LargeTile.png" ShortName="Files">
20+
<uap:ShowNameOnTiles>
21+
<uap:ShowOn Tile="square150x150Logo"/>
22+
<uap:ShowOn Tile="wide310x150Logo"/>
23+
<uap:ShowOn Tile="square310x310Logo"/>
24+
</uap:ShowNameOnTiles>
25+
</uap:DefaultTile>
26+
<uap:SplashScreen Image="Assets\SplashScreen.png" uap5:Optional="true" />
27+
</uap:VisualElements>
28+
<Extensions>
29+
<desktop:Extension Category="windows.fullTrustProcess" Executable="Files.Launcher\ProcessLauncher.exe">
30+
<desktop:FullTrustProcess>
31+
<desktop:ParameterGroup GroupId="DesktopAppExeGroup" Parameters="/DesktopApp"/>
32+
<desktop:ParameterGroup GroupId="TerminalGroup" Parameters="/Terminal"/>
33+
<desktop:ParameterGroup GroupId="UserFolderPathsGroup" Parameters="/DetectUserPaths"/>
34+
</desktop:FullTrustProcess>
35+
</desktop:Extension>
36+
<uap:Extension Category="windows.protocol">
37+
<uap:Protocol ReturnResults="none" Name="files-uwp"/>
38+
</uap:Extension>
39+
<uap5:Extension
40+
Category="windows.appExecutionAlias"
41+
Executable="files.exe"
42+
EntryPoint="files.App">
43+
<uap5:AppExecutionAlias>
44+
<uap5:ExecutionAlias Alias="files.exe"/>
45+
</uap5:AppExecutionAlias>
46+
</uap5:Extension>
47+
</Extensions>
48+
</Application>
49+
</Applications>
50+
<Capabilities>
51+
<rescap:Capability Name="packageQuery"/>
52+
<rescap:Capability Name="runFullTrust" />
53+
<rescap:Capability Name="broadFileSystemAccess" />
54+
<uap:Capability Name="removableStorage" />
55+
<Capability Name="internetClient"/>
56+
</Capabilities>
5657
</Package>

Files/View Models/SettingsViewModel.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using System.Reflection;
1414
using System.Runtime.CompilerServices;
1515
using Windows.ApplicationModel;
16+
using Windows.Management.Deployment;
1617
using Windows.Storage;
1718
using Windows.UI;
1819
using Windows.UI.ViewManagement;
@@ -310,6 +311,26 @@ private async void LoadTerminalApps()
310311
var terminals = JsonConvert.DeserializeObject<TerminalFileModel>(content).Terminals;
311312

312313
Terminals = terminals;
314+
315+
// Ensure Windows Terminal is not already in List
316+
if (Terminals.FirstOrDefault(x => x.Path.Equals("wt.exe", StringComparison.OrdinalIgnoreCase)) == null)
317+
{
318+
PackageManager packageManager = new PackageManager();
319+
var terminalPackage = packageManager.FindPackagesForUser(string.Empty, "Microsoft.WindowsTerminal_8wekyb3d8bbwe");
320+
if (terminalPackage != null)
321+
{
322+
terminals.Add(new TerminalModel()
323+
{
324+
Id = terminals.Count + 1,
325+
Name = "Windows Terminal",
326+
Path = "wt.exe",
327+
arguments = "-d \"{0}\"",
328+
icon = ""
329+
});
330+
await FileIO.WriteTextAsync(file, JsonConvert.SerializeObject(terminals, Formatting.Indented));
331+
Terminals = terminals;
332+
}
333+
}
313334
}
314335

315336
private IList<TerminalModel> _Terminals = null;

0 commit comments

Comments
 (0)