Skip to content

Feature: Added support for always displaying the status center #17151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 22, 2025
Merged
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
6 changes: 6 additions & 0 deletions src/Files.App/Data/Contracts/IAppearanceSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,11 @@ public interface IAppearanceSettingsService : IBaseSettingsService, INotifyPrope
/// Gets or sets a value whether the shelf pane toggle button should be displayed.
/// </summary>
bool ShowShelfPaneToggleButton{ get; set; }


/// <summary>
/// Gets or sets a value indicating when to display the Status Center button.
/// </summary>
StatusCenterVisibility StatusCenterVisibility { get; set; }
}
}
18 changes: 18 additions & 0 deletions src/Files.App/Data/Enums/StatusCenterVisibility.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright (c) Files Community
// Licensed under the MIT License.

namespace Files.App.Data.Enums
{
public enum StatusCenterVisibility
{
/// <summary>
/// Always displayed.
/// </summary>
Always,

/// <summary>
/// During active file operations.
/// </summary>
DuringOngoingFileOperations,
}
}
7 changes: 7 additions & 0 deletions src/Files.App/Services/Settings/AppearanceSettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,13 @@ public bool ShowShelfPaneToggleButton
set => Set(value);
}

/// <inheritdoc/>
public StatusCenterVisibility StatusCenterVisibility
{
get => Get(StatusCenterVisibility.Always);
set => Set(value);
}

protected override void RaiseOnSettingChangedEvent(object sender, SettingChangedEventArgs e)
{
base.RaiseOnSettingChangedEvent(sender, e);
Expand Down
6 changes: 6 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -4226,4 +4226,10 @@
<data name="OmnibarSearchModeTextPlaceholder" xml:space="preserve">
<value>Search for files and folders...</value>
</data>
<data name="DuringOngoingFileOperations" xml:space="preserve">
<value>During file operations</value>
</data>
<data name="ShowStatusCenterButton" xml:space="preserve">
<value>Show status center button</value>
</data>
</root>
18 changes: 9 additions & 9 deletions src/Files.App/UserControls/NavigationToolbar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -471,17 +471,16 @@
AutomationProperties.Name="{helpers:ResourceString Name=StatusCenter}"
Style="{StaticResource AddressToolbarButtonStyle}"
ToolTipService.ToolTip="{helpers:ResourceString Name=StatusCenter}"
Visibility="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}">
Visibility="{x:Bind ViewModel.ShowStatusCenterButton, Mode=OneWay}">

<Grid Margin="-16">

<!-- Enable icon again if we add option to always display on the toolbar
<ThemedIcon
x:Name="StatusCenterIcon"
Width="16"
Height="16"
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItemInProgress, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Style="{StaticResource App.ThemedIcons.StatusCenter}" />-->
<controls:ThemedIcon
x:Name="StatusCenterIcon"
Width="16"
Height="16"
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItem, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Style="{StaticResource App.ThemedIcons.StatusCenter}" />

<ProgressRing
x:Name="MedianOperationProgressRing"
Expand All @@ -496,6 +495,7 @@
x:Name="StatusInfoBadge"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}"
Value="{x:Bind OngoingTasksViewModel.InfoBadgeValue, Mode=OneWay}" />

</Grid>
Expand Down Expand Up @@ -594,7 +594,7 @@
</VisualState>
<VisualState x:Name="StatusButtonVisible">
<VisualState.StateTriggers>
<triggers:IsEqualStateTrigger Value="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}" To="True" />
<triggers:IsEqualStateTrigger Value="{x:Bind ViewModel.ShowStatusCenterButton, Mode=OneWay}" To="True" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="RightSideActionsStackPanel.Margin" Value="0,0,4,0" />
Expand Down
20 changes: 20 additions & 0 deletions src/Files.App/ViewModels/Settings/AppearanceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public sealed partial class AppearanceViewModel : ObservableObject

public Dictionary<HorizontalAlignment, string> ImageHorizontalAlignmentTypes { get; private set; } = [];

public Dictionary<StatusCenterVisibility, string> StatusCenterVisibilityOptions { get; private set; } = [];

public ObservableCollection<AppThemeResourceItem> AppThemeResources { get; }

public ICommand SelectImageCommand { get; }
Expand Down Expand Up @@ -76,6 +78,11 @@ public AppearanceViewModel(IUserSettingsService userSettingsService, IResourcesS

UpdateSelectedResource();

// StatusCenterVisibility
StatusCenterVisibilityOptions.Add(StatusCenterVisibility.Always, Strings.Always.GetLocalizedResource());
StatusCenterVisibilityOptions.Add(StatusCenterVisibility.DuringOngoingFileOperations, Strings.DuringOngoingFileOperations.GetLocalizedResource());
SelectedStatusCenterVisibilityOption = StatusCenterVisibilityOptions[UserSettingsService.AppearanceSettingsService.StatusCenterVisibility];

SelectImageCommand = new RelayCommand(SelectBackgroundImage);
RemoveImageCommand = new RelayCommand(RemoveBackgroundImage);
}
Expand Down Expand Up @@ -330,6 +337,19 @@ public bool ShowShelfPaneToggleButton
}
}

private string selectedStatusCenterVisibilityOption;
public string SelectedStatusCenterVisibilityOption
{
get => selectedStatusCenterVisibilityOption;
set
{
if (SetProperty(ref selectedStatusCenterVisibilityOption, value))
{
UserSettingsService.AppearanceSettingsService.StatusCenterVisibility = StatusCenterVisibilityOptions.First(e => e.Value == value).Key;
}
}
}

public bool IsAppEnvironmentDev
{
get => AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr
private readonly IUpdateService UpdateService = Ioc.Default.GetRequiredService<IUpdateService>();
private readonly ICommandManager Commands = Ioc.Default.GetRequiredService<ICommandManager>();
private readonly IContentPageContext ContentPageContext = Ioc.Default.GetRequiredService<IContentPageContext>();
private readonly StatusCenterViewModel OngoingTasksViewModel = Ioc.Default.GetRequiredService<StatusCenterViewModel>();

// Fields

Expand Down Expand Up @@ -79,6 +80,9 @@ public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddr

public bool ShowHomeButton => AppearanceSettingsService.ShowHomeButton;
public bool EnableOmnibar => GeneralSettingsService.EnableOmnibar;
public bool ShowStatusCenterButton =>
AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.Always ||
(AppearanceSettingsService.StatusCenterVisibility == StatusCenterVisibility.DuringOngoingFileOperations && OngoingTasksViewModel.HasAnyItem);

public bool ShowShelfPaneToggleButton => AppearanceSettingsService.ShowShelfPaneToggleButton && AppLifecycleHelper.AppEnvironment is AppEnvironment.Dev;

Expand Down Expand Up @@ -369,6 +373,9 @@ public NavigationToolbarViewModel()
case nameof(AppearanceSettingsService.ShowHomeButton):
OnPropertyChanged(nameof(ShowHomeButton));
break;
case nameof(AppearanceSettingsService.StatusCenterVisibility):
OnPropertyChanged(nameof(ShowStatusCenterButton));
break;
case nameof(AppearanceSettingsService.ShowShelfPaneToggleButton):
OnPropertyChanged(nameof(ShowShelfPaneToggleButton));
break;
Expand All @@ -383,6 +390,15 @@ public NavigationToolbarViewModel()
break;
}
};
OngoingTasksViewModel.PropertyChanged += (s, e) =>
{
switch (e.PropertyName)
{
case nameof(OngoingTasksViewModel.HasAnyItem):
OnPropertyChanged(nameof(ShowStatusCenterButton));
break;
}
};
}

// Methods
Expand Down
8 changes: 8 additions & 0 deletions src/Files.App/Views/Settings/AppearancePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=ShowToolbar}">
<ToggleSwitch AutomationProperties.Name="{helpers:ResourceString Name=ShowToolbar}" IsOn="{x:Bind ViewModel.ShowToolbar, Mode=TwoWay}" />
</wctcontrols:SettingsCard>

<!-- Show status center -->
<wctcontrols:SettingsCard Header="{helpers:ResourceString Name=ShowStatusCenterButton}">
<uc:ComboBoxEx
AutomationProperties.Name="{helpers:ResourceString Name=ShowStatusCenterButton}"
ItemsSource="{x:Bind ViewModel.StatusCenterVisibilityOptions.Values}"
SelectedItem="{x:Bind ViewModel.SelectedStatusCenterVisibilityOption, Mode=TwoWay}" />
</wctcontrols:SettingsCard>
</wctcontrols:SettingsExpander.Items>
</wctcontrols:SettingsExpander>
</StackPanel>
Expand Down
Loading