mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
Add a setting to control if details are shown for apps (#300)
Adds a setting to control if the `Details` pane is shown for apps on the main page or not. I'm defaulting this to off, because that pane doesn't add any value currently.
This commit is contained in:
@@ -34,7 +34,6 @@ public partial class MainListPage : DynamicListPage,
|
||||
{
|
||||
Name = "Command Palette";
|
||||
Icon = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png"));
|
||||
ShowDetails = true;
|
||||
_serviceProvider = serviceProvider;
|
||||
|
||||
var tlcManager = _serviceProvider.GetService<TopLevelCommandManager>()!;
|
||||
@@ -46,6 +45,10 @@ public partial class MainListPage : DynamicListPage,
|
||||
|
||||
WeakReferenceMessenger.Default.Register<ClearSearchMessage>(this);
|
||||
|
||||
var settings = _serviceProvider.GetService<SettingsModel>()!;
|
||||
settings.SettingsChanged += SettingsChangedHandler;
|
||||
HotReloadSettings(settings);
|
||||
|
||||
IsLoading = true;
|
||||
}
|
||||
|
||||
@@ -180,4 +183,14 @@ public partial class MainListPage : DynamicListPage,
|
||||
{
|
||||
SearchText = string.Empty;
|
||||
}
|
||||
|
||||
private void SettingsChangedHandler(SettingsModel sender, object? args)
|
||||
{
|
||||
HotReloadSettings(sender);
|
||||
}
|
||||
|
||||
private void HotReloadSettings(SettingsModel settings)
|
||||
{
|
||||
ShowDetails = settings.ShowAppDetails;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ public partial class SettingsModel : ObservableObject
|
||||
// SETTINGS HERE
|
||||
public HotkeySettings? Hotkey { get; set; } = new HotkeySettings(true, true, false, false, 0xBE);
|
||||
|
||||
public bool ShowAppDetails { get; set; }
|
||||
|
||||
public Dictionary<string, ProviderSettings> ProviderSettings { get; set; } = [];
|
||||
|
||||
// END SETTINGS
|
||||
|
||||
@@ -23,6 +23,16 @@ public partial class SettingsViewModel : PageViewModel
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowAppDetails
|
||||
{
|
||||
get => _settings.ShowAppDetails;
|
||||
set
|
||||
{
|
||||
_settings.ShowAppDetails = value;
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<ProviderSettingsViewModel> CommandProviders { get; } = [];
|
||||
|
||||
public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvider, TaskScheduler scheduler)
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(CIBuild)'=='true'">
|
||||
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -64,6 +64,13 @@
|
||||
HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<ptControls:ShortcutControl HotkeySettings="{x:Bind ViewModel.Hotkey, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<controls:SettingsCard
|
||||
Description="Controls if app details are automatically expanded or not"
|
||||
Header="Show app details"
|
||||
HeaderIcon="{ui:FontIcon Glyph=}">
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAppDetails, Mode=TwoWay}" />
|
||||
</controls:SettingsCard>
|
||||
|
||||
<TextBlock x:Uid="ExtensionSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user