[MouseUtils]Auto activate setting for highlighter and crosshairs (#27826)

* auto activate for mouse highlighter and crosshairs

* revert changed encoding
This commit is contained in:
Davide Giacometti
2023-08-08 18:01:23 +02:00
committed by GitHub
parent a49f806ac7
commit 8e712c6f49
11 changed files with 112 additions and 9 deletions

View File

@@ -34,6 +34,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("highlight_fade_duration_ms")]
public IntProperty HighlightFadeDurationMs { get; set; }
[JsonPropertyName("auto_activate")]
public BoolProperty AutoActivate { get; set; }
public MouseHighlighterProperties()
{
ActivationShortcut = DefaultActivationShortcut;
@@ -44,6 +47,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
HighlightRadius = new IntProperty(20);
HighlightFadeDelayMs = new IntProperty(500);
HighlightFadeDurationMs = new IntProperty(250);
AutoActivate = new BoolProperty(false);
}
}
}

View File

@@ -40,6 +40,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
[JsonPropertyName("crosshairs_fixed_length")]
public IntProperty CrosshairsFixedLength { get; set; }
[JsonPropertyName("auto_activate")]
public BoolProperty AutoActivate { get; set; }
public MousePointerCrosshairsProperties()
{
ActivationShortcut = DefaultActivationShortcut;
@@ -52,6 +55,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
CrosshairsAutoHide = new BoolProperty(false);
CrosshairsIsFixedLengthEnabled = new BoolProperty(false);
CrosshairsFixedLength = new IntProperty(1);
AutoActivate = new BoolProperty(false);
}
}
}

View File

@@ -149,14 +149,22 @@
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsHighlighterEnabledGpoConfigured}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsHighlighterEnabledGpoConfigured}"
Severity="Informational" />
<labs:SettingsCard
<labs:SettingsExpander
x:Uid="MouseUtils_MouseHighlighter_ActivationShortcut"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xEDA7;}"
IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}">
IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}"
IsExpanded="True">
<controls:ShortcutControl
MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.MouseHighlighterActivationShortcut, Mode=TwoWay}" />
</labs:SettingsCard>
<labs:SettingsExpander.Items>
<labs:SettingsCard ContentAlignment="Left">
<CheckBox
x:Uid="MouseUtils_AutoActivate"
IsChecked="{x:Bind ViewModel.MouseHighlighterAutoActivate, Mode=TwoWay}" />
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
<labs:SettingsExpander
x:Uid="Appearance_Behavior"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xEB3C;}"
@@ -317,14 +325,22 @@
IsOpen="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairsEnabledGpoConfigured}"
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsMousePointerCrosshairsEnabledGpoConfigured}"
Severity="Informational" />
<labs:SettingsCard
<labs:SettingsExpander
x:Uid="MouseUtils_MousePointerCrosshairs_ActivationShortcut"
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=&#xEDA7;}"
IsEnabled="{x:Bind ViewModel.IsMousePointerCrosshairsEnabled, Mode=OneWay}">
IsEnabled="{x:Bind ViewModel.IsMousePointerCrosshairsEnabled, Mode=OneWay}"
IsExpanded="True">
<controls:ShortcutControl
MinWidth="{StaticResource SettingActionControlMinWidth}"
HotkeySettings="{x:Bind Path=ViewModel.MousePointerCrosshairsActivationShortcut, Mode=TwoWay}" />
</labs:SettingsCard>
<labs:SettingsExpander.Items>
<labs:SettingsCard ContentAlignment="Left">
<CheckBox
x:Uid="MouseUtils_AutoActivate"
IsChecked="{x:Bind ViewModel.MousePointerCrosshairsAutoActivate, Mode=TwoWay}" />
</labs:SettingsCard>
</labs:SettingsExpander.Items>
</labs:SettingsExpander>
<labs:SettingsExpander
x:Uid="Appearance_Behavior"

View File

@@ -2466,10 +2466,10 @@ From there, simply click on one of the supported files in the File Explorer and
<value>Cancel</value>
</data>
<data name="Activation_Shortcut_Description" xml:space="preserve">
<value>Press a combination of keys to change this shortcut</value>
<value>Press a combination of keys to change this shortcut</value>
</data>
<data name="Activation_Shortcut_With_Disable_Description" xml:space="preserve">
<value>Press a combination of keys to change this shortcut.
<value>Press a combination of keys to change this shortcut.
Right-click to remove the key combination, thereby deactivating the shortcut.</value>
</data>
<data name="Activation_Shortcut_Reset" xml:space="preserve">
@@ -3593,6 +3593,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="MouseUtils_MousePointerCrosshairs_CrosshairsAutoHide.Content" xml:space="preserve">
<value>Automatically hide crosshairs when the mouse pointer is hidden</value>
</data>
<data name="MouseUtils_AutoActivate.Content" xml:space="preserve">
<value>Automatically activate on utility startup</value>
</data>
<data name="Run_FindMorePlugins.Text" xml:space="preserve">
<value>Find more plugins</value>
</data>

View File

@@ -82,6 +82,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_highlighterRadius = MouseHighlighterSettingsConfig.Properties.HighlightRadius.Value;
_highlightFadeDelayMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDelayMs.Value;
_highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value;
_highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value;
if (mouseJumpSettingsRepository == null)
{
@@ -111,6 +112,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
_mousePointerCrosshairsAutoHide = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsAutoHide.Value;
_mousePointerCrosshairsIsFixedLengthEnabled = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsIsFixedLengthEnabled.Value;
_mousePointerCrosshairsFixedLength = MousePointerCrosshairsSettingsConfig.Properties.CrosshairsFixedLength.Value;
_mousePointerCrosshairsAutoActivate = MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value;
// set the callback functions value to handle outgoing IPC message.
SendConfigMSG = ipcMSGCallBackFunc;
@@ -549,6 +551,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool MouseHighlighterAutoActivate
{
get
{
return _highlighterAutoActivate;
}
set
{
if (value != _highlighterAutoActivate)
{
_highlighterAutoActivate = value;
MouseHighlighterSettingsConfig.Properties.AutoActivate.Value = value;
NotifyMouseHighlighterPropertyChanged();
}
}
}
public void NotifyMouseHighlighterPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);
@@ -852,6 +872,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool MousePointerCrosshairsAutoActivate
{
get
{
return _mousePointerCrosshairsAutoActivate;
}
set
{
if (value != _mousePointerCrosshairsAutoActivate)
{
_mousePointerCrosshairsAutoActivate = value;
MousePointerCrosshairsSettingsConfig.Properties.AutoActivate.Value = value;
NotifyMousePointerCrosshairsPropertyChanged();
}
}
}
public void NotifyMousePointerCrosshairsPropertyChanged([CallerMemberName] string propertyName = null)
{
OnPropertyChanged(propertyName);
@@ -896,6 +934,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private int _highlighterRadius;
private int _highlightFadeDelayMs;
private int _highlightFadeDurationMs;
private bool _highlighterAutoActivate;
private GpoRuleConfigured _jumpEnabledGpoRuleConfiguration;
private bool _jumpEnabledStateIsGPOConfigured;
@@ -913,5 +952,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _mousePointerCrosshairsAutoHide;
private bool _mousePointerCrosshairsIsFixedLengthEnabled;
private int _mousePointerCrosshairsFixedLength;
private bool _mousePointerCrosshairsAutoActivate;
}
}