From c2512cd5964b590eec0cbdf61059b64c0ad6c638 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Mon, 27 Oct 2025 16:40:24 +0530 Subject: [PATCH 1/5] Fix: Fixed an issue where using Column View in the Recycle Bin caused unexpected behavior with file system hierarchy display. The Columns layout is now disabled when viewing the Recycle Bin to prevent navigation issues. --- src/Files.App/Actions/Display/LayoutAction.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Files.App/Actions/Display/LayoutAction.cs b/src/Files.App/Actions/Display/LayoutAction.cs index 9d7f5a52b815..7104271d7885 100644 --- a/src/Files.App/Actions/Display/LayoutAction.cs +++ b/src/Files.App/Actions/Display/LayoutAction.cs @@ -82,6 +82,8 @@ public override HotKey HotKey [GeneratedRichCommand] internal sealed partial class LayoutColumnsAction : ToggleLayoutAction { + private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); + protected override LayoutTypes LayoutType => LayoutTypes.Columns; @@ -96,6 +98,24 @@ public override RichGlyph Glyph public override HotKey HotKey => new(Keys.Number5, KeyModifiers.CtrlShift); + + public override bool IsExecutable + => ContentPageContext.PageType is not ContentPageTypes.RecycleBin; + + public LayoutColumnsAction() + { + ContentPageContext.PropertyChanged += ContentPageContext_PropertyChanged; + } + + private void ContentPageContext_PropertyChanged(object? sender, PropertyChangedEventArgs e) + { + switch (e.PropertyName) + { + case nameof(IContentPageContext.PageType): + OnPropertyChanged(nameof(IsExecutable)); + break; + } + } } [GeneratedRichCommand] From cbc4965125a5f77bd26b2ee185a8b70565768c1f Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Tue, 28 Oct 2025 13:28:58 +0530 Subject: [PATCH 2/5] Fix: Fixed Columns View appearing in Recycle Bin when folder preference sync is enabled. --- .../Layout/LayoutPreferencesManager.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs index d3e74adb7433..d968460fde37 100644 --- a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs +++ b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs @@ -503,6 +503,28 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte ?? GetDefaultLayoutPreferences(path); } + if (path.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal)) + { + var trimmedPath = path.TrimPath() ?? string.Empty; + + var recycleBinPreference = SafetyExtensions.IgnoreExceptions(() => + { + var folderFRN = Win32Helper.GetFolderFRN(trimmedPath); + + return GetLayoutPreferencesFromDatabase(trimmedPath, folderFRN) + ?? GetLayoutPreferencesFromAds(trimmedPath, folderFRN); + }, App.Logger); + + if (recycleBinPreference is not null && recycleBinPreference.LayoutMode != FolderLayoutModes.ColumnView) + return recycleBinPreference; + + var defaultPref = new LayoutPreferencesItem(); + if (defaultPref.LayoutMode == FolderLayoutModes.ColumnView) + defaultPref.LayoutMode = FolderLayoutModes.DetailsView; + + return defaultPref; + } + return new LayoutPreferencesItem(); } From c9691aac8c7ccc440a0c92df73a809d6d4784db9 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Mon, 27 Oct 2025 16:40:24 +0530 Subject: [PATCH 3/5] Fix: Fixed an issue where using Column View in the Recycle Bin caused unexpected behavior with file system hierarchy display. The Columns layout is now disabled when viewing the Recycle Bin to prevent navigation issues. --- src/Files.App/Actions/Display/LayoutAction.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Files.App/Actions/Display/LayoutAction.cs b/src/Files.App/Actions/Display/LayoutAction.cs index 9d7f5a52b815..7104271d7885 100644 --- a/src/Files.App/Actions/Display/LayoutAction.cs +++ b/src/Files.App/Actions/Display/LayoutAction.cs @@ -82,6 +82,8 @@ public override HotKey HotKey [GeneratedRichCommand] internal sealed partial class LayoutColumnsAction : ToggleLayoutAction { + private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService(); + protected override LayoutTypes LayoutType => LayoutTypes.Columns; @@ -96,6 +98,24 @@ public override RichGlyph Glyph public override HotKey HotKey => new(Keys.Number5, KeyModifiers.CtrlShift); + + public override bool IsExecutable + => ContentPageContext.PageType is not ContentPageTypes.RecycleBin; + + public LayoutColumnsAction() + { + ContentPageContext.PropertyChanged += ContentPageContext_PropertyChanged; + } + + private void ContentPageContext_PropertyChanged(object? sender, PropertyChangedEventArgs e) + { + switch (e.PropertyName) + { + case nameof(IContentPageContext.PageType): + OnPropertyChanged(nameof(IsExecutable)); + break; + } + } } [GeneratedRichCommand] From bb070b0d95e8087124f07c14dc184b997c68c205 Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Tue, 28 Oct 2025 13:28:58 +0530 Subject: [PATCH 4/5] Fix: Fixed Columns View appearing in Recycle Bin when folder preference sync is enabled. --- .../Layout/LayoutPreferencesManager.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs index d3e74adb7433..d968460fde37 100644 --- a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs +++ b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs @@ -503,6 +503,28 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte ?? GetDefaultLayoutPreferences(path); } + if (path.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal)) + { + var trimmedPath = path.TrimPath() ?? string.Empty; + + var recycleBinPreference = SafetyExtensions.IgnoreExceptions(() => + { + var folderFRN = Win32Helper.GetFolderFRN(trimmedPath); + + return GetLayoutPreferencesFromDatabase(trimmedPath, folderFRN) + ?? GetLayoutPreferencesFromAds(trimmedPath, folderFRN); + }, App.Logger); + + if (recycleBinPreference is not null && recycleBinPreference.LayoutMode != FolderLayoutModes.ColumnView) + return recycleBinPreference; + + var defaultPref = new LayoutPreferencesItem(); + if (defaultPref.LayoutMode == FolderLayoutModes.ColumnView) + defaultPref.LayoutMode = FolderLayoutModes.DetailsView; + + return defaultPref; + } + return new LayoutPreferencesItem(); } From ed2b74dd3968f5390a06268b6291f3f5582998ba Mon Sep 17 00:00:00 2001 From: Saravanan Ganapathi Date: Wed, 29 Oct 2025 14:22:17 +0530 Subject: [PATCH 5/5] Fix: Fixed Columns View appearing in Recycle Bin when DefaultLayoutMode is set to Columns with sync disabled. --- .../Layout/LayoutPreferencesManager.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs index d968460fde37..d5f3a5122f50 100644 --- a/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs +++ b/src/Files.App/Helpers/Layout/LayoutPreferencesManager.cs @@ -486,23 +486,6 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte private static LayoutPreferencesItem? GetLayoutPreferencesForPath(string path) { - if (!UserSettingsService.LayoutSettingsService.SyncFolderPreferencesAcrossDirectories) - { - path = path.TrimPath() ?? string.Empty; - - return SafetyExtensions.IgnoreExceptions(() => - { - if (path.StartsWith("tag:", StringComparison.Ordinal)) - return GetLayoutPreferencesFromDatabase("Home", null); - - var folderFRN = Win32Helper.GetFolderFRN(path); - - return GetLayoutPreferencesFromDatabase(path, folderFRN) - ?? GetLayoutPreferencesFromAds(path, folderFRN); - }, App.Logger) - ?? GetDefaultLayoutPreferences(path); - } - if (path.StartsWith(Constants.UserEnvironmentPaths.RecycleBinPath, StringComparison.Ordinal)) { var trimmedPath = path.TrimPath() ?? string.Empty; @@ -525,6 +508,23 @@ public static void SetLayoutPreferencesForPath(string path, LayoutPreferencesIte return defaultPref; } + if (!UserSettingsService.LayoutSettingsService.SyncFolderPreferencesAcrossDirectories) + { + path = path.TrimPath() ?? string.Empty; + + return SafetyExtensions.IgnoreExceptions(() => + { + if (path.StartsWith("tag:", StringComparison.Ordinal)) + return GetLayoutPreferencesFromDatabase("Home", null); + + var folderFRN = Win32Helper.GetFolderFRN(path); + + return GetLayoutPreferencesFromDatabase(path, folderFRN) + ?? GetLayoutPreferencesFromAds(path, folderFRN); + }, App.Logger) + ?? GetDefaultLayoutPreferences(path); + } + return new LayoutPreferencesItem(); }