[FindMyMouse] Add setting for excluded apps (#16308)

* refactor find_app_name_in_path

* Add a setting for excluded apps

* Restore game_mode.h
This commit is contained in:
Jaime Bernardo
2022-02-14 18:22:05 +00:00
committed by GitHub
parent 10a5629fe8
commit 05728a6dc2
11 changed files with 131 additions and 31 deletions

View File

@@ -32,6 +32,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("spotlight_initial_zoom")]
public IntProperty SpotlightInitialZoom { get; set; }
[JsonPropertyName("excluded_apps")]
public StringProperty ExcludedApps { get; set; }
public FindMyMouseProperties()
{
ActivationMethod = new IntProperty(0);
@@ -42,6 +45,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
SpotlightRadius = new IntProperty(100);
AnimationDurationMs = new IntProperty(500);
SpotlightInitialZoom = new IntProperty(9);
ExcludedApps = new StringProperty();
}
}
}

View File

@@ -60,6 +60,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
_findMyMouseSpotlightRadius = FindMyMouseSettingsConfig.Properties.SpotlightRadius.Value;
_findMyMouseAnimationDurationMs = FindMyMouseSettingsConfig.Properties.AnimationDurationMs.Value;
_findMyMouseSpotlightInitialZoom = FindMyMouseSettingsConfig.Properties.SpotlightInitialZoom.Value;
_findMyMouseExcludedApps = FindMyMouseSettingsConfig.Properties.ExcludedApps.Value;
if (mouseHighlighterSettingsRepository == null)
{
@@ -266,6 +267,24 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
}
}
public string FindMyMouseExcludedApps
{
get
{
return _findMyMouseExcludedApps;
}
set
{
if (value != _findMyMouseExcludedApps)
{
_findMyMouseExcludedApps = value;
FindMyMouseSettingsConfig.Properties.ExcludedApps.Value = value;
NotifyFindMyMousePropertyChanged();
}
}
}
public void NotifyFindMyMousePropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);
@@ -613,6 +632,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private int _findMyMouseSpotlightRadius;
private int _findMyMouseAnimationDurationMs;
private int _findMyMouseSpotlightInitialZoom;
private string _findMyMouseExcludedApps;
private bool _isMouseHighlighterEnabled;
private string _highlighterLeftButtonClickColor;

View File

@@ -1775,6 +1775,15 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<value>Shake mouse</value>
<comment>Mouse is the hardware peripheral.</comment>
</data>
<data name="MouseUtils_FindMyMouse_ExcludedApps.Description" xml:space="preserve">
<value>Prevents module activation when an excluded application is the foreground application</value>
</data>
<data name="MouseUtils_FindMyMouse_ExcludedApps.Header" xml:space="preserve">
<value>Excluded apps</value>
</data>
<data name="MouseUtils_FindMyMouse_ExcludedApps_TextBoxControl.PlaceholderText" xml:space="preserve">
<value>Example: outlook.exe</value>
</data>
<data name="MouseUtils_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>

View File

@@ -93,6 +93,23 @@
</StackPanel>
</controls:SettingExpander.Content>
</controls:SettingExpander>
<controls:SettingExpander IsExpanded="False">
<controls:SettingExpander.Header>
<controls:Setting x:Uid="MouseUtils_FindMyMouse_ExcludedApps" Icon="&#xECE4;" Style="{StaticResource ExpanderHeaderSettingStyle}"/>
</controls:SettingExpander.Header>
<controls:SettingExpander.Content>
<TextBox x:Uid="MouseUtils_FindMyMouse_ExcludedApps_TextBoxControl"
Margin="{StaticResource ExpanderSettingMargin}"
Text="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseExcludedApps, UpdateSourceTrigger=PropertyChanged}"
ScrollViewer.VerticalScrollBarVisibility ="Visible"
ScrollViewer.VerticalScrollMode="Enabled"
ScrollViewer.IsVerticalRailEnabled="True"
TextWrapping="Wrap"
AcceptsReturn="True"
MinWidth="240"
MinHeight="160" />
</controls:SettingExpander.Content>
</controls:SettingExpander>
</controls:SettingsGroup>
<controls:SettingsGroup x:Uid="MouseUtils_MouseHighlighter">