[QuickAccent]Add option to not activate when in game mode (#30983)

* [Quick Accent] Do not activate on game mode

* Fix XAML styling

* Fix idl syntax error

* [Quick Accent] Fix game mode options not working
This commit is contained in:
HydroH
2024-01-23 01:54:35 +08:00
committed by GitHub
parent 94ee951917
commit 769eb17d7f
8 changed files with 70 additions and 3 deletions

View File

@@ -12,6 +12,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("activation_key")]
public PowerAccentActivationKey ActivationKey { get; set; }
[JsonPropertyName("do_not_activate_on_game_mode")]
public bool DoNotActivateOnGameMode { get; set; }
[JsonPropertyName("toolbar_position")]
public StringProperty ToolbarPosition { get; set; }
@@ -36,6 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
public PowerAccentProperties()
{
ActivationKey = PowerAccentActivationKey.Both;
DoNotActivateOnGameMode = true;
ToolbarPosition = "Top center";
InputTime = new IntProperty(PowerAccentSettings.DefaultInputTimeMs);
SelectedLang = "ALL";

View File

@@ -31,13 +31,21 @@
Severity="Informational" />
<controls:SettingsGroup x:Uid="QuickAccent_Activation_GroupSettings" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">
<tkcontrols:SettingsCard x:Uid="QuickAccent_Activation_Shortcut" HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<tkcontrols:SettingsExpander
x:Uid="QuickAccent_Activation_Shortcut"
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}"
IsExpanded="True">
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.ActivationKey, Mode=TwoWay}">
<ComboBoxItem x:Uid="QuickAccent_Activation_Key_Arrows" />
<ComboBoxItem x:Uid="QuickAccent_Activation_Key_Space" />
<ComboBoxItem x:Uid="QuickAccent_Activation_Key_Either" />
</ComboBox>
</tkcontrols:SettingsCard>
<tkcontrols:SettingsExpander.Items>
<tkcontrols:SettingsCard ContentAlignment="Left">
<CheckBox x:Uid="QuickAccent_Prevent_Activation_On_Game_Mode" IsChecked="{x:Bind ViewModel.DoNotActivateOnGameMode, Mode=TwoWay}" />
</tkcontrols:SettingsCard>
</tkcontrols:SettingsExpander.Items>
</tkcontrols:SettingsExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="QuickAccent_Language" IsEnabled="{x:Bind ViewModel.IsEnabled, Mode=OneWay}">

View File

@@ -4017,6 +4017,10 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="CmdNotFound_Arm64ArchBar.Title" xml:space="preserve">
<value>Command Not Found is not supported on the ARM64 architecture currently. We are actively working on a solution.</value>
</data>
<data name="QuickAccent_Prevent_Activation_On_Game_Mode.Content" xml:space="preserve">
<value>Do not activate when Game Mode is on</value>
<comment>"Game mode" is the Windows feature to prevent notification when playing a game.</comment>
</data>
<data name="GeneralPage_ToggleSwitch_ShowNewUpdatesToast.Description" xml:space="preserve">
<value>Notifications in the settings and the tray flyout are always shown</value>
</data>

View File

@@ -165,6 +165,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool DoNotActivateOnGameMode
{
get
{
return _powerAccentSettings.Properties.DoNotActivateOnGameMode;
}
set
{
if (value != _powerAccentSettings.Properties.DoNotActivateOnGameMode)
{
_powerAccentSettings.Properties.DoNotActivateOnGameMode = value;
OnPropertyChanged(nameof(DoNotActivateOnGameMode));
RaisePropertyChanged();
}
}
}
private int _inputTimeMs = PowerAccentSettings.DefaultInputTimeMs;
public int InputTimeMs