PowerAccent-21531: support excluded apps (#22004)

This commit is contained in:
Taras
2022-11-15 14:47:52 +02:00
committed by GitHub
parent b482188782
commit a357d62ff5
8 changed files with 145 additions and 14 deletions

View File

@@ -2420,6 +2420,15 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Hold the key down for this much time to make the accent menu appear (ms)</value>
<comment>ms = milliseconds</comment>
</data>
<data name="QuickAccent_ExcludedApps.Description" xml:space="preserve">
<value>Prevents module activation if a foreground application is excluded. Add one application name per line.</value>
</data>
<data name="QuickAccent_ExcludedApps.Header" xml:space="preserve">
<value>Excluded apps</value>
</data>
<data name="QuickAccent_ExcludedApps_TextBoxControl.PlaceholderText" xml:space="preserve">
<value>Example: Teams.exe</value>
</data>
<data name="LearnMore_TextExtractor.Text" xml:space="preserve">
<value>Learn more about Text Extractor</value>
</data>

View File

@@ -90,6 +90,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_inputTimeMs = _powerAccentSettings.Properties.InputTime.Value;
_excludedApps = _powerAccentSettings.Properties.ExcludedApps.Value;
_selectedLangIndex = Array.IndexOf(_languageOptions, _powerAccentSettings.Properties.SelectedLang.Value);
_toolbarPositionIndex = Array.IndexOf(_toolbarOptions, _powerAccentSettings.Properties.ToolbarPosition.Value);
@@ -165,6 +167,27 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
private string _excludedApps;
public string ExcludedApps
{
get
{
return _excludedApps;
}
set
{
if (value != _excludedApps)
{
_excludedApps = value;
_powerAccentSettings.Properties.ExcludedApps.Value = value;
OnPropertyChanged(nameof(ExcludedApps));
RaisePropertyChanged();
}
}
}
private int _toolbarPositionIndex;
public int ToolbarPositionIndex

View File

@@ -103,6 +103,24 @@
LargeChange="100"/>
</controls:Setting.ActionContent>
</controls:Setting>
<controls:SettingExpander IsExpanded="False">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="QuickAccent_ExcludedApps" Icon="&#xECE4;" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}" Style="{StaticResource ExpanderHeaderSettingStyle}"/>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<TextBox x:Uid="QuickAccent_ExcludedApps_TextBoxControl"
Margin="{StaticResource ExpanderSettingMargin}"
Text="{x:Bind Mode=TwoWay, Path=ViewModel.ExcludedApps, UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.VerticalScrollBarVisibility ="Visible"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.IsVerticalRailEnabled="True"
TextWrapping="Wrap"
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}"
AcceptsReturn="True"
MinWidth="240"
MinHeight="160" />
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>