mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
CmdPal: add a setting for the page transition animation (#42093)
Basically title. Closes #41869
This commit is contained in:
@@ -52,6 +52,8 @@ public partial class SettingsModel : ObservableObject
|
|||||||
|
|
||||||
public MonitorBehavior SummonOn { get; set; } = MonitorBehavior.ToMouse;
|
public MonitorBehavior SummonOn { get; set; } = MonitorBehavior.ToMouse;
|
||||||
|
|
||||||
|
public bool DisableAnimations { get; set; } = true;
|
||||||
|
|
||||||
// END SETTINGS
|
// END SETTINGS
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,16 @@ public partial class SettingsViewModel : INotifyPropertyChanged
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool DisableAnimations
|
||||||
|
{
|
||||||
|
get => _settings.DisableAnimations;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_settings.DisableAnimations = value;
|
||||||
|
Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ObservableCollection<ProviderSettingsViewModel> CommandProviders { get; } = [];
|
public ObservableCollection<ProviderSettingsViewModel> CommandProviders { get; } = [];
|
||||||
|
|
||||||
public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvider, TaskScheduler scheduler)
|
public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvider, TaskScheduler scheduler)
|
||||||
|
|||||||
@@ -101,6 +101,18 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page,
|
|||||||
_pageNavigatedAnnouncement = CompositeFormat.Parse(pageAnnouncementFormat);
|
_pageNavigatedAnnouncement = CompositeFormat.Parse(pageAnnouncementFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default page animation, depending on the settings
|
||||||
|
/// </summary>
|
||||||
|
private NavigationTransitionInfo DefaultPageAnimation
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
var settings = App.Current.Services.GetService<SettingsModel>()!;
|
||||||
|
return settings.DisableAnimations ? _noAnimation : _slideRightTransition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Receive(NavigateBackMessage message)
|
public void Receive(NavigateBackMessage message)
|
||||||
{
|
{
|
||||||
var settings = App.Current.Services.GetService<SettingsModel>()!;
|
var settings = App.Current.Services.GetService<SettingsModel>()!;
|
||||||
@@ -142,7 +154,7 @@ public sealed partial class ShellPage : Microsoft.UI.Xaml.Controls.Page,
|
|||||||
_ => throw new NotSupportedException(),
|
_ => throw new NotSupportedException(),
|
||||||
},
|
},
|
||||||
message.Page,
|
message.Page,
|
||||||
message.WithAnimation ? _slideRightTransition : _noAnimation);
|
message.WithAnimation ? DefaultPageAnimation : _noAnimation);
|
||||||
|
|
||||||
PowerToysTelemetry.Log.WriteEvent(new OpenPage(RootFrame.BackStackDepth));
|
PowerToysTelemetry.Log.WriteEvent(new OpenPage(RootFrame.BackStackDepth));
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,10 @@
|
|||||||
<ToggleSwitch IsOn="{x:Bind viewModel.ShowSystemTrayIcon, Mode=TwoWay}" />
|
<ToggleSwitch IsOn="{x:Bind viewModel.ShowSystemTrayIcon, Mode=TwoWay}" />
|
||||||
</controls:SettingsCard>
|
</controls:SettingsCard>
|
||||||
|
|
||||||
|
<controls:SettingsCard x:Uid="Settings_GeneralPage_DisableAnimations_SettingsCard" HeaderIcon="{ui:FontIcon Glyph=}">
|
||||||
|
<ToggleSwitch IsOn="{x:Bind viewModel.DisableAnimations, Mode=TwoWay}" />
|
||||||
|
</controls:SettingsCard>
|
||||||
|
|
||||||
<!-- 'For Developers' section -->
|
<!-- 'For Developers' section -->
|
||||||
|
|
||||||
<TextBlock x:Uid="ForDevelopersSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
<TextBlock x:Uid="ForDevelopersSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />
|
||||||
|
|||||||
@@ -407,6 +407,12 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
|||||||
<data name="Settings_GeneralPage_ShowSystemTrayIcon_SettingsCard.Description" xml:space="preserve">
|
<data name="Settings_GeneralPage_ShowSystemTrayIcon_SettingsCard.Description" xml:space="preserve">
|
||||||
<value>Choose if Command Palette is visible in the system tray</value>
|
<value>Choose if Command Palette is visible in the system tray</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Settings_GeneralPage_DisableAnimations_SettingsCard.Header" xml:space="preserve">
|
||||||
|
<value>Disable animations</value>
|
||||||
|
</data>
|
||||||
|
<data name="Settings_GeneralPage_DisableAnimations_SettingsCard.Description" xml:space="preserve">
|
||||||
|
<value>Disable animations when switching between pages</value>
|
||||||
|
</data>
|
||||||
<data name="BackButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
<data name="BackButton.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
|
||||||
<value>Back</value>
|
<value>Back</value>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
Reference in New Issue
Block a user