mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
[FindMyMouse]Add additional settings (#14590)
* [FindMyMouse]Add additional settings * Add setting for Spotlight Initial Zoom * PR feedback: lowercase settings names * PR feedback: settings descriptions * PR feedback: change opacity to percentage * PR feedback: increase maximum zoom factor * PR feedback: group spotlight settings * PR feedback: Expanders start collapsed initially * Remove extra settings file save in dllmain * PR feedback: change initial zoom description * PR feedback: Add warning for photo sensitive users * PR feedback: remove warning and add description instead * PR feedback: size->factor in initial zoom description * Feedback PR: remove opacity description * PR feedback: remove photo sensitivity warning
This commit is contained in:
@@ -11,9 +11,33 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("do_not_activate_on_game_mode")]
|
||||
public BoolProperty DoNotActivateOnGameMode { get; set; }
|
||||
|
||||
[JsonPropertyName("background_color")]
|
||||
public StringProperty BackgroundColor { get; set; }
|
||||
|
||||
[JsonPropertyName("spotlight_color")]
|
||||
public StringProperty SpotlightColor { get; set; }
|
||||
|
||||
[JsonPropertyName("overlay_opacity")]
|
||||
public IntProperty OverlayOpacity { get; set; }
|
||||
|
||||
[JsonPropertyName("spotlight_radius")]
|
||||
public IntProperty SpotlightRadius { get; set; }
|
||||
|
||||
[JsonPropertyName("animation_duration_ms")]
|
||||
public IntProperty AnimationDurationMs { get; set; }
|
||||
|
||||
[JsonPropertyName("spotlight_initial_zoom")]
|
||||
public IntProperty SpotlightInitialZoom { get; set; }
|
||||
|
||||
public FindMyMouseProperties()
|
||||
{
|
||||
DoNotActivateOnGameMode = new BoolProperty(true);
|
||||
BackgroundColor = new StringProperty("#000000");
|
||||
SpotlightColor = new StringProperty("#FFFFFF");
|
||||
OverlayOpacity = new IntProperty(50);
|
||||
SpotlightRadius = new IntProperty(100);
|
||||
AnimationDurationMs = new IntProperty(500);
|
||||
SpotlightInitialZoom = new IntProperty(9);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,17 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
FindMyMouseSettingsConfig = findMyMouseSettingsRepository.SettingsConfig;
|
||||
_findMyMouseDoNotActivateOnGameMode = FindMyMouseSettingsConfig.Properties.DoNotActivateOnGameMode.Value;
|
||||
|
||||
string backgroundColor = FindMyMouseSettingsConfig.Properties.BackgroundColor.Value;
|
||||
_findMyMouseBackgroundColor = !string.IsNullOrEmpty(backgroundColor) ? backgroundColor : "#000000";
|
||||
|
||||
string spotlightColor = FindMyMouseSettingsConfig.Properties.SpotlightColor.Value;
|
||||
_findMyMouseSpotlightColor = !string.IsNullOrEmpty(spotlightColor) ? spotlightColor : "#FFFFFF";
|
||||
|
||||
_findMyMouseOverlayOpacity = FindMyMouseSettingsConfig.Properties.OverlayOpacity.Value;
|
||||
_findMyMouseSpotlightRadius = FindMyMouseSettingsConfig.Properties.SpotlightRadius.Value;
|
||||
_findMyMouseAnimationDurationMs = FindMyMouseSettingsConfig.Properties.AnimationDurationMs.Value;
|
||||
_findMyMouseSpotlightInitialZoom = FindMyMouseSettingsConfig.Properties.SpotlightInitialZoom.Value;
|
||||
|
||||
if (mouseHighlighterSettingsRepository == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mouseHighlighterSettingsRepository));
|
||||
@@ -104,6 +115,116 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public string FindMyMouseBackgroundColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseBackgroundColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000";
|
||||
if (!value.Equals(_findMyMouseBackgroundColor, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_findMyMouseBackgroundColor = value;
|
||||
FindMyMouseSettingsConfig.Properties.BackgroundColor.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string FindMyMouseSpotlightColor
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseSpotlightColor;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#FFFFFF";
|
||||
if (!value.Equals(_findMyMouseSpotlightColor, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
_findMyMouseSpotlightColor = value;
|
||||
FindMyMouseSettingsConfig.Properties.SpotlightColor.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseOverlayOpacity
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseOverlayOpacity;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _findMyMouseOverlayOpacity)
|
||||
{
|
||||
_findMyMouseOverlayOpacity = value;
|
||||
FindMyMouseSettingsConfig.Properties.OverlayOpacity.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseSpotlightRadius
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseSpotlightRadius;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _findMyMouseSpotlightRadius)
|
||||
{
|
||||
_findMyMouseSpotlightRadius = value;
|
||||
FindMyMouseSettingsConfig.Properties.SpotlightRadius.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseAnimationDurationMs
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseAnimationDurationMs;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _findMyMouseAnimationDurationMs)
|
||||
{
|
||||
_findMyMouseAnimationDurationMs = value;
|
||||
FindMyMouseSettingsConfig.Properties.AnimationDurationMs.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int FindMyMouseSpotlightInitialZoom
|
||||
{
|
||||
get
|
||||
{
|
||||
return _findMyMouseSpotlightInitialZoom;
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
if (value != _findMyMouseSpotlightInitialZoom)
|
||||
{
|
||||
_findMyMouseSpotlightInitialZoom = value;
|
||||
FindMyMouseSettingsConfig.Properties.SpotlightInitialZoom.Value = value;
|
||||
NotifyFindMyMousePropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NotifyFindMyMousePropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
OnPropertyChanged(propertyName);
|
||||
@@ -281,6 +402,12 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
|
||||
|
||||
private bool _isFindMyMouseEnabled;
|
||||
private bool _findMyMouseDoNotActivateOnGameMode;
|
||||
private string _findMyMouseBackgroundColor;
|
||||
private string _findMyMouseSpotlightColor;
|
||||
private int _findMyMouseOverlayOpacity;
|
||||
private int _findMyMouseSpotlightRadius;
|
||||
private int _findMyMouseAnimationDurationMs;
|
||||
private int _findMyMouseSpotlightInitialZoom;
|
||||
|
||||
private bool _isMouseHighlighterEnabled;
|
||||
private string _highlighterLeftButtonClickColor;
|
||||
|
||||
@@ -1733,6 +1733,30 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
||||
<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="MouseUtils_FindMyMouse_BackgroundColor.Header" xml:space="preserve">
|
||||
<value>Background color</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_SpotlightColor.Header" xml:space="preserve">
|
||||
<value>Spotlight color</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_OverlayOpacity.Header" xml:space="preserve">
|
||||
<value>Overlay opacity</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_SpotlightRadius.Header" xml:space="preserve">
|
||||
<value>Spotlight radius</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_SpotlightInitialZoom.Header" xml:space="preserve">
|
||||
<value>Spotlight initial zoom</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_SpotlightInitialZoom.Description" xml:space="preserve">
|
||||
<value>Spotlight zoom factor at animation start</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_AnimationDurationMs.Header" xml:space="preserve">
|
||||
<value>Animation duration</value>
|
||||
</data>
|
||||
<data name="MouseUtils_FindMyMouse_AnimationDurationMs.Description" xml:space="preserve">
|
||||
<value>How long it takes for the spotlight to appear/disappear (in ms)</value>
|
||||
</data>
|
||||
<data name="MouseUtils_MouseHighlighter.Header" xml:space="preserve">
|
||||
<value>Mouse Highlighter</value>
|
||||
<comment>Refers to the utility name</comment>
|
||||
@@ -1745,7 +1769,6 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
||||
<value>Mouse Highlighter mode will highlight mouse clicks.</value>
|
||||
<comment>"Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse.</comment>
|
||||
</data>
|
||||
|
||||
<data name="MouseUtils_MouseHighlighter_ActivationShortcut.Header" xml:space="preserve">
|
||||
<value>Activation shortcut</value>
|
||||
</data>
|
||||
@@ -1753,7 +1776,6 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
|
||||
<value>Customize the shortcut to turn on or off this mode</value>
|
||||
<comment>"Mouse Highlighter" is the name of the utility. Mouse is the hardware mouse.</comment>
|
||||
</data>
|
||||
|
||||
<data name="MouseUtils_MouseHighlighter_LeftButtonClickColor.Header" xml:space="preserve">
|
||||
<value>Left button highlight color</value>
|
||||
</data>
|
||||
|
||||
@@ -15,25 +15,79 @@
|
||||
<StackPanel Orientation="Vertical">
|
||||
<controls:SettingsGroup x:Uid="MouseUtils_FindMyMouse">
|
||||
<TextBlock x:Uid="MouseUtils_FindMyMouse_Description" Margin="0,0,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<controls:SettingExpander IsExpanded="True">
|
||||
<controls:Setting x:Uid="MouseUtils_Enable_FindMyMouse">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFindMyMouse.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:SettingExpander IsEnabled="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=OneWay}" IsExpanded="False" >
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting x:Uid="MouseUtils_Enable_FindMyMouse">
|
||||
<controls:Setting.Icon>
|
||||
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsFindMyMouse.png" ShowAsMonochrome="False" />
|
||||
</controls:Setting.Icon>
|
||||
<controls:Setting.ActionContent>
|
||||
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="ShortcutGuide_Appearance_Behavior" Icon="" />
|
||||
</controls:SettingExpander.Header>
|
||||
<controls:SettingExpander.Content>
|
||||
<CheckBox x:Uid="MouseUtils_Prevent_Activation_On_Game_Mode"
|
||||
IsChecked="{x:Bind ViewModel.FindMyMouseDoNotActivateOnGameMode, Mode=TwoWay}"
|
||||
Margin="{StaticResource ExpanderSettingMargin}"
|
||||
IsEnabled="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=OneWay}" />
|
||||
<StackPanel>
|
||||
<CheckBox x:Uid="MouseUtils_Prevent_Activation_On_Game_Mode"
|
||||
IsChecked="{x:Bind ViewModel.FindMyMouseDoNotActivateOnGameMode, Mode=TwoWay}"
|
||||
Margin="{StaticResource ExpanderSettingMargin}"
|
||||
IsEnabled="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=OneWay}" />
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_OverlayOpacity" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<Slider Minimum="1"
|
||||
Maximum="100"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseOverlayOpacity}"
|
||||
HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_BackgroundColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseBackgroundColor, Mode=TwoWay}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_SpotlightColor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<controls:ColorPickerButton SelectedColor="{x:Bind Path=ViewModel.FindMyMouseSpotlightColor, Mode=TwoWay}" />
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_SpotlightRadius" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<muxc:NumberBox Minimum="5"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseSpotlightRadius}"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
SmallChange="1"
|
||||
LargeChange="10"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_SpotlightInitialZoom" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<Slider Minimum="1"
|
||||
Maximum="40"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseSpotlightInitialZoom}"
|
||||
HorizontalAlignment="Right"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
<controls:Setting x:Uid="MouseUtils_FindMyMouse_AnimationDurationMs" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsFindMyMouseEnabled}" Style="{StaticResource ExpanderContentSettingStyle}">
|
||||
<controls:Setting.ActionContent>
|
||||
<muxc:NumberBox Minimum="0"
|
||||
Value="{x:Bind Mode=TwoWay, Path=ViewModel.FindMyMouseAnimationDurationMs}"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SpinButtonPlacementMode="Compact"
|
||||
HorizontalAlignment="Left"
|
||||
SmallChange="10"
|
||||
LargeChange="100"/>
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
</StackPanel>
|
||||
</controls:SettingExpander.Content>
|
||||
</controls:SettingExpander>
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup x:Uid="MouseUtils_MouseHighlighter">
|
||||
<TextBlock x:Uid="MouseUtils_MouseHighlighter_Description" Margin="0,0,0,8" Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
|
||||
<controls:Setting x:Uid="MouseUtils_Enable_MouseHighlighter">
|
||||
@@ -53,7 +107,7 @@
|
||||
</controls:Setting.ActionContent>
|
||||
</controls:Setting>
|
||||
|
||||
<controls:SettingExpander IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}" IsExpanded="True" >
|
||||
<controls:SettingExpander IsEnabled="{x:Bind ViewModel.IsMouseHighlighterEnabled, Mode=OneWay}" IsExpanded="False" >
|
||||
<controls:SettingExpander.Header>
|
||||
<controls:Setting x:Uid="ShortcutGuide_Appearance_Behavior" Icon="" />
|
||||
</controls:SettingExpander.Header>
|
||||
|
||||
Reference in New Issue
Block a user