Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
<!-- Generic properties -->
<BaseTargetFramework>net10.0</BaseTargetFramework>
<DesktopTargetFramework>$(BaseTargetFramework)-desktop</DesktopTargetFramework>
<!-- Desktop (Uno Skia) OS target: Linux (X11). Overridable for other desktop heads. -->
<FilesDesktopOS Condition="'$(FilesDesktopOS)' == ''">Linux</FilesDesktopOS>

<!-- Set the Linux-only Uno targets before NuGet imports Directory.Packages.props, including outer builds. -->
<TargetFramework Condition="'$(UsingUnoSdk)' == 'true' And '$(MSBuildProjectName)' == 'Files.App.UnoVirtualization' And '$(TargetFramework)' == '' And '$(TargetFrameworks)' == ''">$(DesktopTargetFramework)</TargetFramework>
<TargetFrameworks Condition="'$(UsingUnoSdk)' == 'true' And '$(TargetFramework)' == '' And '$(TargetFrameworks)' == ''">$(DesktopTargetFramework)</TargetFrameworks>
<UseUnoWayland Condition="'$(UseUnoWayland)' == ''">true</UseUnoWayland>
<UseUnoWayland Condition="'$(FilesDesktopOS)' == 'Linux' And '$(UseUnoWayland)' == ''">true</UseUnoWayland>
<!-- One effective switch for the Linux desktop target; the build machine's OS is irrelevant. -->
<FilesUseUnoWayland>false</FilesUseUnoWayland>
<FilesUseUnoWayland Condition="'$(UsingUnoSdk)' == 'true' And '$(UseUnoWayland)' == 'true' And ('$(TargetFramework)' == '$(DesktopTargetFramework)' Or ('$(TargetFramework)' == '' And '$(TargetFrameworks)' == '$(DesktopTargetFramework)')) And ('$(RuntimeIdentifier)' == '' Or $(RuntimeIdentifier.StartsWith('linux-')))">true</FilesUseUnoWayland>
<FilesUseUnoWayland Condition="'$(UsingUnoSdk)' == 'true' And '$(UseUnoWayland)' == 'true' And '$(FilesDesktopOS)' == 'Linux' And ('$(TargetFramework)' == '$(DesktopTargetFramework)' Or ('$(TargetFramework)' == '' And '$(TargetFrameworks)' == '$(DesktopTargetFramework)')) And ('$(RuntimeIdentifier)' == '' Or $(RuntimeIdentifier.StartsWith('linux-')))">true</FilesUseUnoWayland>
<LangVersion>preview</LangVersion>
<!-- Uno's nullability annotations differ from WinUI's; keep nullable diagnostics as warnings on the Linux desktop build for now. -->
<WarningsAsErrors Condition="!$(TargetFramework.EndsWith('-desktop'))">nullable</WarningsAsErrors>
Expand Down
5 changes: 5 additions & 0 deletions Files.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
<Platform Solution="*|x64" Project="x64" />
<Platform Solution="*|x86" Project="x86" />
</Project>
<Project Path="src/Files.Platform.Posix/Files.Platform.Posix.csproj">
<Platform Solution="*|arm64" Project="arm64" />
<Platform Solution="*|x64" Project="x64" />
<Platform Solution="*|x86" Project="x86" />
</Project>
<Project Path="src/Files.App/Files.App.csproj">
<Platform Solution="*|arm64" Project="arm64" />
<Platform Solution="*|x64" Project="x64" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
// SPDX-License-Identifier: MPL-2.0

using Files.Platform.Abstractions;
using Files.Platform.Abstractions.Gvfs;
using Files.Platform.Abstractions.Network;
using Files.Platform.Abstractions.Recent;
using Files.Platform.Abstractions.Volumes;
using OwlCore.Storage.System.IO;
using System.Runtime.CompilerServices;

namespace Files.App.Storage.Storables
{
public sealed class LinuxHomeFolder : IHomeFolder
public sealed class DesktopHomeFolder : IHomeFolder
{
private readonly IUserDirectories directories;
private readonly IVolumeService volumes;
Expand All @@ -20,7 +20,7 @@ public sealed class LinuxHomeFolder : IHomeFolder
public string Id => "Home";
public string Name => "Home";

public LinuxHomeFolder(IUserDirectories directories, IVolumeService volumes, IRecentFilesStore recentFiles, INetworkLocationService network)
public DesktopHomeFolder(IUserDirectories directories, IVolumeService volumes, IRecentFilesStore recentFiles, INetworkLocationService network)
{
this.directories = directories;
this.volumes = volumes;
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Open/OpenSettingsFileAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task ExecuteAsync(object? parameter = null)
try
{
var settingsJsonFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appdata:///local/{Constants.LocalSettings.SettingsFolderName}/{Constants.LocalSettings.UserSettingsFileName}"));
await NavigationHelpers.OpenFileLinuxAsync(settingsJsonFile.Path);
await NavigationHelpers.OpenFileDesktopAsync(settingsJsonFile.Path);
}
catch (Exception ex)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Files.App/Actions/Open/OpenTerminalAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal partial class OpenTerminalAction : ObservableObject, IAction


public virtual string Label
=> Strings.OpenTerminalLinux.GetLocalizedResource();
=> Strings.OpenTerminalDesktop.GetLocalizedResource();

public virtual string Description
=> Strings.OpenTerminalDescription.GetLocalizedResource();
Expand Down Expand Up @@ -46,10 +46,10 @@ public Task ExecuteAsync(object? parameter = null)
if (paths.Length is 0)
return Task.CompletedTask;

return OpenLinuxTerminalsAsync(paths);
return OpenDesktopTerminalsAsync(paths);
}

private static async Task OpenLinuxTerminalsAsync(string[] paths)
private static async Task OpenDesktopTerminalsAsync(string[] paths)
{
var launcher = Ioc.Default.GetRequiredService<Files.Platform.Abstractions.Launching.ILauncherService>();
foreach (var path in paths)
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Open/OpenTerminalAsAdminAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Files.App.Actions
internal sealed partial class OpenTerminalAsAdminAction : OpenTerminalAction
{
public override string Label
=> Strings.OpenTerminalAsAdminLinux.GetLocalizedResource();
=> Strings.OpenTerminalAsAdminDesktop.GetLocalizedResource();

public override string Description
=> Strings.OpenTerminalAsAdminDescription.GetLocalizedResource();
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Actions/Open/OpenTerminalFromHomeAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal sealed partial class OpenTerminalFromHomeAction : OpenTerminalAction
private IHomePageContext HomePageContext { get; } = Ioc.Default.GetRequiredService<IHomePageContext>();

public override string Label
=> Strings.OpenTerminalLinux.GetLocalizedResource();
=> Strings.OpenTerminalDesktop.GetLocalizedResource();

public override string Description
=> Strings.OpenTerminalDescription.GetLocalizedResource();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal sealed partial class OpenTerminalFromSidebarAction : OpenTerminalAction
private ISidebarContext SidebarContext { get; } = Ioc.Default.GetRequiredService<ISidebarContext>();

public override string Label
=> Strings.OpenTerminalLinux.GetLocalizedResource();
=> Strings.OpenTerminalDesktop.GetLocalizedResource();

public override string Description
=> Strings.OpenTerminalDescription.GetLocalizedResource();
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
</ResourceDictionary>

<!-- Linux desktop overrides (fonts, Mica fallback); must stay last -->
<ResourceDictionary Source="ms-appx:///Styles/LinuxDesktopResources.xaml" />
<ResourceDictionary Source="ms-appx:///Styles/DesktopResources.xaml" />
</ResourceDictionary.MergedDictionaries>

</ResourceDictionary>
Expand Down
3 changes: 1 addition & 2 deletions src/Files.App/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,12 @@ public static class DragAndDrop

public static class UserEnvironmentPaths
{
private static readonly Files.Platform.Linux.LinuxUserDirectories _userDirectories = new();
private static readonly IUserDirectories _userDirectories = DesktopPlatform.CreateUserDirectories();

public static readonly string DesktopPath = _userDirectories.Desktop;

public static readonly string DownloadsPath = _userDirectories.Downloads;

// XDG data home (~/.local/share)
public static readonly string LocalAppDataPath = Environment.GetEnvironmentVariable("XDG_DATA_HOME") is { Length: > 0 } dataHome && System.IO.Path.IsPathRooted(dataHome)
? dataHome
: System.IO.Path.Combine(_userDirectories.Home, ".local", "share");
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Data/Contexts/HomePage/HomePageContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public sealed partial class HomePageContext : ObservableObject, IHomePageContext

private static IHomeFolder CreateHomeFolder()
{
return new LinuxHomeFolder(
return new DesktopHomeFolder(
Ioc.Default.GetRequiredService<IUserDirectories>(),
Ioc.Default.GetRequiredService<Files.Platform.Abstractions.Volumes.IVolumeService>(),
Ioc.Default.GetRequiredService<Files.Platform.Abstractions.Recent.IRecentFilesStore>(),
Ioc.Default.GetRequiredService<Files.Platform.Abstractions.Gvfs.INetworkLocationService>());
Ioc.Default.GetRequiredService<Files.Platform.Abstractions.Network.INetworkLocationService>());
}

private WidgetCardItem? rightClickedItem = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
using Files.Platform.Abstractions;
using Files.Platform.Abstractions.Launching;
using Files.Platform.Abstractions.Mime;
using Files.Platform.Linux.Launching;
using Files.Platform.Linux.Mime;
using Files.Platform.Posix.Launching;
using Files.Platform.Posix.Mime;
using Files.App.ViewModels.Layouts;
using Microsoft.Extensions.Logging;

Expand All @@ -31,7 +31,7 @@ public static Task<List<ContextMenuFlyoutItemViewModel>> GetItemContextCommandsW
}, cancellationToken);
}

private static Task<List<ContextMenuFlyoutItemViewModel>> GetLinuxItemContextCommandsAsync(
private static Task<List<ContextMenuFlyoutItemViewModel>> GetDesktopItemContextCommandsAsync(
string? workingDir, List<ListedItem> selectedItems, bool shiftPressed, bool showOpenMenu, CancellationToken cancellationToken)
{
var shellItems = ShellContextFlyoutFactory.GetShellContextmenuAsync(shiftPressed: shiftPressed, showOpenMenu: showOpenMenu,
Expand All @@ -41,7 +41,7 @@ private static Task<List<ContextMenuFlyoutItemViewModel>> GetLinuxItemContextCom
return Task.Run(async () =>
{
var items = await shellItems.ConfigureAwait(false);
if (!includeServiceMenus || !targets.All(LinuxServiceMenuService.IsLocalFileSystemTarget))
if (!includeServiceMenus || !targets.All(PosixServiceMenuService.IsLocalFileSystemTarget))
return items;

try
Expand All @@ -57,7 +57,7 @@ private static Task<List<ContextMenuFlyoutItemViewModel>> GetLinuxItemContextCom
Text = DisplaySanitizer.Field(action.Application.Name),
Glyph = "\xE756",
ShowInSearchPage = true,
Command = new AsyncRelayCommand(() => NavigationHelpers.RunServiceMenuLinuxAsync(captured, targets)),
Command = new AsyncRelayCommand(() => NavigationHelpers.RunServiceMenuDesktopAsync(captured, targets)),
};
if (string.IsNullOrWhiteSpace(action.Submenu))
items.Add(item);
Expand Down Expand Up @@ -88,7 +88,7 @@ private static Task<List<ContextMenuFlyoutItemViewModel>> GetLinuxItemContextCom
/// <summary>
/// Builds the "New" submenu from <see cref="ITemplatesService"/>: Folder, Text Document and the files in ~/Templates.
/// </summary>
internal static List<ContextMenuFlyoutItemViewModel> GetLinuxNewItemItems(bool canCreateFileInPage, ContextMenuCommandSnapshot? createFolder = null, CancellationToken cancellationToken = default)
internal static List<ContextMenuFlyoutItemViewModel> GetDesktopNewItemItems(bool canCreateFileInPage, ContextMenuCommandSnapshot? createFolder = null, CancellationToken cancellationToken = default)
{
var list = new List<ContextMenuFlyoutItemViewModel>()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ internal static ContextMenuFlyoutItemViewModel GetRootActionsItem(List<ListedIte
{
items.Add(new ContextMenuFlyoutItemViewModel
{
Text = Strings.OpenTerminalAsRootLinux.GetLocalizedResource(),
Text = Strings.OpenTerminalAsRootDesktop.GetLocalizedResource(),
Command = new AsyncRelayCommand(() => RootActionsHelper.OpenTerminalAsync(terminalTarget)),
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static List<ContextMenuFlyoutItemViewModel> GetItemContextCommandsWithout

public static Task<List<ContextMenuFlyoutItemViewModel>> GetItemContextShellCommandsAsync(string? workingDir, List<ListedItem> selectedItems, bool shiftPressed, bool showOpenMenu, CancellationToken cancellationToken)
{
return GetLinuxItemContextCommandsAsync(workingDir, selectedItems, shiftPressed, showOpenMenu, cancellationToken);
return GetDesktopItemContextCommandsAsync(workingDir, selectedItems, shiftPressed, showOpenMenu, cancellationToken);
}

public static List<ContextMenuFlyoutItemViewModel> Filter(List<ContextMenuFlyoutItemViewModel> items, List<ListedItem> selectedItems, bool shiftPressed, CurrentInstanceViewModel currentInstanceViewModel, bool removeOverflowMenu = true)
Expand Down Expand Up @@ -370,7 +370,7 @@ private static List<ContextMenuFlyoutItemViewModel> BuildBaseItemMenuItems(Conte
ThemedIconStyle = state.Commands[Commands.AddItem].Glyph.ThemedIconStyle
},
Text = state.Commands[Commands.AddItem].Label,
Items = GetLinuxNewItemItems(state.CanCreateFileInPage, state.Commands[Commands.CreateFolder], cancellationToken),
Items = GetDesktopNewItemItems(state.CanCreateFileInPage, state.Commands[Commands.CreateFolder], cancellationToken),
ShowItem = !state.ItemsSelected,
ShowInFtpPage = true
},
Expand Down Expand Up @@ -878,7 +878,7 @@ private static ContextMenuBuildState CaptureMenuState(BaseLayoutViewModel comman

public static List<ContextMenuFlyoutItemViewModel> GetNewItemItems(BaseLayoutViewModel commandsViewModel, bool canCreateFileInPage)
{
return GetLinuxNewItemItems(canCreateFileInPage);
return GetDesktopNewItemItems(canCreateFileInPage);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static ObservableCollection<PropertiesNavigationItem> Initialize(object i
{
var isShortcut = listedItem.IsShortcut;
if (OperatingSystem.IsLinux() && !isShortcut)
isShortcut = LinuxShortcutHelper.IsShortcutLike(listedItem.ItemPath);
isShortcut = DesktopShortcutHelper.IsShortcutLike(listedItem.ItemPath);
var isLibrary = listedItem.IsLibrary;
var fileExt = listedItem.FileExtension;
var isFolder = listedItem.PrimaryItemAttribute == Windows.Storage.StorageItemTypes.Folder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static partial class ShellContextFlyoutFactory
/// Linux has no shell extension menu. The only entry produced is the "Open with" submenu for a single file,
/// shaped like the Windows "openas" entry so the existing layout code swaps it in.
/// </summary>
private static Task<List<ContextMenuFlyoutItemViewModel>> GetLinuxContextMenuAsync(List<ListedItem>? selectedItems, CancellationToken cancellationToken)
private static Task<List<ContextMenuFlyoutItemViewModel>> GetDesktopContextMenuAsync(List<ListedItem>? selectedItems, CancellationToken cancellationToken)
{
var path = selectedItems is { Count: 1 } &&
selectedItems[0].PrimaryItemAttribute == Windows.Storage.StorageItemTypes.File
Expand Down Expand Up @@ -61,7 +61,7 @@ private static async Task LoadOpenWithItemsAsync(ContextMenuFlyoutItemViewModel
items.Add(new ContextMenuFlyoutItemViewModel
{
Text = captured.Id == defaultApp?.Id ? $"{captured.Name} ({Strings.Default.GetLocalizedResource()})" : captured.Name,
BitmapIcon = await LinuxAppIcons.GetBitmapAsync(captured),
BitmapIcon = await DesktopAppIcons.GetBitmapAsync(captured),
Command = new AsyncRelayCommand(() => launcher.OpenWithAsync(captured, [path])),
});
}
Expand All @@ -72,7 +72,7 @@ private static async Task LoadOpenWithItemsAsync(ContextMenuFlyoutItemViewModel
items.Add(new ContextMenuFlyoutItemViewModel
{
Text = Strings.ChooseAnotherApp.GetLocalizedResource() + "…",
Command = new AsyncRelayCommand(() => LinuxOpenWithDialog.ShowAsync(path)),
Command = new AsyncRelayCommand(() => DesktopOpenWithDialog.ShowAsync(path)),
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Files.App/Data/Factories/ShellContextFlyoutHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static partial class ShellContextFlyoutFactory
public static async Task<List<ContextMenuFlyoutItemViewModel>> GetShellContextmenuAsync(bool showOpenMenu, bool shiftPressed, string? workingDirectory, List<ListedItem>? selectedItems, CancellationToken cancellationToken)
{
// No shell extensions on Linux: skip the Win32 shell menu entirely (no COM, no delay)
return await GetLinuxContextMenuAsync(selectedItems, cancellationToken);
return await GetDesktopContextMenuAsync(selectedItems, cancellationToken);
}


Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/Data/Items/DriveItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public static async Task<DriveItem> CreateFromPropertiesAsync(StorageFolder root
// The label already is the display name (volume label, "<size> Volume" or "File System")
item.Text = !string.IsNullOrWhiteSpace(label) ? label : root.DisplayName;
if (string.IsNullOrWhiteSpace(item.Text) && root.Path is "/")
item.Text = Strings.LinuxFileSystemRoot.GetLocalizedResource();
item.Text = Strings.DesktopFileSystemRoot.GetLocalizedResource();
item.Type = type;
item.MenuOptions = new ContextMenuOptions
{
Expand Down Expand Up @@ -312,7 +312,7 @@ public async Task UpdatePropertiesAsync()

var info = await Task.Run(() =>
{
if (Files.Platform.Linux.Volumes.HeadlessDriveFixture.Find(Path) is { } synthetic)
if (Files.Platform.Posix.Volumes.HeadlessDriveFixture.Find(Path) is { } synthetic)
return (Total: (long)synthetic.TotalBytes, Free: (long)synthetic.FreeBytes, Format: synthetic.FileSystem);

var driveInfo = new SystemIO.DriveInfo(Path ?? throw new InvalidOperationException("The drive path has not been initialized."));
Expand Down
10 changes: 5 additions & 5 deletions src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -570,18 +570,18 @@ public bool IsSelectedItemShortcut
}
}

private bool isLinuxOpenTargetAvailable;
public bool IsLinuxOpenTargetAvailable
private bool isDesktopOpenTargetAvailable;
public bool IsDesktopOpenTargetAvailable
{
get => isLinuxOpenTargetAvailable;
get => isDesktopOpenTargetAvailable;
set
{
if (SetProperty(ref isLinuxOpenTargetAvailable, value))
if (SetProperty(ref isDesktopOpenTargetAvailable, value))
OnPropertyChanged(nameof(IsOpenTargetVisible));
}
}

public bool IsOpenTargetVisible => IsSelectedItemShortcut || IsLinuxOpenTargetAvailable;
public bool IsOpenTargetVisible => IsSelectedItemShortcut || IsDesktopOpenTargetAvailable;

private string? desktopEntryName;
public string? DesktopEntryName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Files.App.Dialogs
/// <summary>
/// Lets the user choose an installed application to open a file with, optionally making it the default.
/// </summary>
internal static class LinuxOpenWithDialog
internal static class DesktopOpenWithDialog
{
public static async Task<bool> ShowAsync(string path)
{
Expand All @@ -36,7 +36,7 @@ public static async Task<bool> ShowAsync(string path)
_ = LoadIconAsync(image, app);
}

var always = new CheckBox { Content = Strings.LinuxAlwaysUseApp.GetLocalizedResource() };
var always = new CheckBox { Content = Strings.DesktopAlwaysUseApp.GetLocalizedResource() };
var content = new StackPanel { Spacing = 12, MinWidth = 320 };
content.Children.Add(new TextBlock { Text = Path.GetFileName(path), TextTrimming = TextTrimming.CharacterEllipsis });
content.Children.Add(list);
Expand Down Expand Up @@ -67,7 +67,7 @@ private static async Task LoadIconAsync(Image image, DesktopApplication app)
{
try
{
image.Source = await LinuxAppIcons.GetBitmapAsync(app, 20);
image.Source = await DesktopAppIcons.GetBitmapAsync(app, 20);
}
catch (Exception ex) when (ex is not OperationCanceledException)
{
Expand Down
Loading
Loading