Mouse Utils - Find My Mouse (#13916)

* Initial FindMyMouse implementation

* Proper enable/disable code

* Settings page

* Change FindMyMouse window name

* Add Oobe page.

* Add icons

* Change settings preview

* Fix mouse utilities aka.ms link spelling

* Remove right control exit behavior

* Remove dllmain boilerplate comments and code

* Add filters to vcxproj

* Add logging

* Add telemetry

* Add installer instructions

* Add dll to pipelines

* Fix Task Manager name for runner changing

* Add a description in dllmain

* Proper resource file creation

* Add reference of link to the docs

* Fix spellchecker errors

* Call DestroyWindow on correct thread

* Add attribution

* Proper ordering of module in Settings and Oobe

* Update Target Platform Version to 18362

* Fix project filters

* Add attribution to Community.md

* Lowercase "utilities"

* [Mouse utils] Adding icon (#13933)

* Adding images to docs folder

* Updated imagery

Co-authored-by: Laute <Niels.Laute@philips.com>

* Add settings deeplink

Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Laute <Niels.Laute@philips.com>
This commit is contained in:
Jaime Bernardo
2021-10-22 13:30:18 +01:00
committed by GitHub
parent dadb12a6e5
commit 8d383cba9d
44 changed files with 1665 additions and 5 deletions

View File

@@ -175,6 +175,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
}
}
private bool findMyMouse = true;
[JsonPropertyName("FindMyMouse")]
public bool FindMyMouse
{
get => findMyMouse;
set
{
if (findMyMouse != value)
{
LogTelemetryEvent(value);
findMyMouse = value;
}
}
}
public string ToJsonString()
{
return JsonSerializer.Serialize(this);

View File

@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using Microsoft.PowerToys.Settings.UI.Library.Helpers;
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
public class MouseUtilsViewModel : Observable
{
private GeneralSettings GeneralSettingsConfig { get; set; }
public MouseUtilsViewModel(ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc)
{
// To obtain the general settings configurations of PowerToys Settings.
if (settingsRepository == null)
{
throw new ArgumentNullException(nameof(settingsRepository));
}
GeneralSettingsConfig = settingsRepository.SettingsConfig;
_isFindMyMouseEnabled = GeneralSettingsConfig.Enabled.FindMyMouse;
// set the callback functions value to hangle outgoing IPC message.
SendConfigMSG = ipcMSGCallBackFunc;
}
public bool IsFindMyMouseEnabled
{
get => _isFindMyMouseEnabled;
set
{
if (_isFindMyMouseEnabled != value)
{
_isFindMyMouseEnabled = value;
GeneralSettingsConfig.Enabled.FindMyMouse = value;
OnPropertyChanged(nameof(IsFindMyMouseEnabled));
OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig);
SendConfigMSG(outgoing.ToString());
// TODO: Implement when this module has properties.
// NotifyPropertyChanged();
}
}
}
private Func<string, int> SendConfigMSG { get; }
private bool _isFindMyMouseEnabled;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@@ -155,6 +155,9 @@
<Compile Include="OOBE\Views\OobeKBM.xaml.cs">
<DependentUpon>OobeKBM.xaml</DependentUpon>
</Compile>
<Compile Include="OOBE\Views\OobeMouseUtils.xaml.cs">
<DependentUpon>OobeMouseUtils.xaml</DependentUpon>
</Compile>
<Compile Include="OOBE\Views\OobeOverview.xaml.cs">
<DependentUpon>OobeOverview.xaml</DependentUpon>
</Compile>
@@ -192,6 +195,9 @@
<Compile Include="Views\KeyboardManagerPage.xaml.cs">
<DependentUpon>KeyboardManagerPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\MouseUtilsPage.xaml.cs">
<DependentUpon>MouseUtilsPage.xaml</DependentUpon>
</Compile>
<Compile Include="Views\PowerLauncherPage.xaml.cs">
<DependentUpon>PowerLauncherPage.xaml</DependentUpon>
</Compile>
@@ -227,6 +233,7 @@
<Content Include="Assets\FluentIcons\FluentIconsFileExplorerPreview.png" />
<Content Include="Assets\FluentIcons\FluentIconsImageResizer.png" />
<Content Include="Assets\FluentIcons\FluentIconsKeyboardManager.png" />
<Content Include="Assets\FluentIcons\FluentIconsMouseUtils.png" />
<Content Include="Assets\FluentIcons\FluentIconsPowerRename.png" />
<Content Include="Assets\FluentIcons\FluentIconsPowerToys.png" />
<Content Include="Assets\FluentIcons\FluentIconsPowerToysRun.png" />
@@ -239,12 +246,14 @@
<Content Include="Assets\Modules\FancyZones.png" />
<Content Include="Assets\Modules\ImageResizer.png" />
<Content Include="Assets\Modules\KBM.png" />
<Content Include="Assets\Modules\MouseUtils.png" />
<Content Include="Assets\Modules\OOBE\ColorPicker.gif" />
<Content Include="Assets\Modules\OOBE\Awake.png" />
<Content Include="Assets\Modules\OOBE\FancyZones.gif" />
<Content Include="Assets\Modules\OOBE\FileExplorer.png" />
<Content Include="Assets\Modules\OOBE\ImageResizer.gif" />
<Content Include="Assets\Modules\OOBE\KBM.gif" />
<Content Include="Assets\Modules\OOBE\MouseUtils.gif" />
<Content Include="Assets\Modules\OOBE\OOBEPTHero.png" />
<Content Include="Assets\Modules\OOBE\PowerRename.gif" />
<Content Include="Assets\Modules\OOBE\Run.gif" />
@@ -365,6 +374,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OOBE\Views\OobeMouseUtils.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="OOBE\Views\OobeOverview.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -429,6 +442,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\MouseUtilsPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Views\PowerLauncherPage.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>

View File

@@ -13,6 +13,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Enums
FileExplorer,
ImageResizer,
KBM,
MouseUtils,
PowerRename,
Run,
ShortcutGuide,

View File

@@ -0,0 +1,33 @@
<Page
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeMouseUtils"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:toolkitcontrols="using:Microsoft.Toolkit.Uwp.UI.Controls"
mc:Ignorable="d">
<controls:OOBEPageControl ModuleTitle="{x:Bind ViewModel.ModuleName}"
ModuleImageSource="{x:Bind ViewModel.PreviewImageSource}"
ModuleDescription="{x:Bind ViewModel.Description}">
<controls:OOBEPageControl.ModuleContent>
<StackPanel Orientation="Vertical">
<TextBlock x:Uid="Oobe_MouseUtils_FindMyMouse"
Style="{ThemeResource OobeSubtitleStyle}" />
<toolkitcontrols:MarkdownTextBlock Background="Transparent" x:Uid="Oobe_MouseUtils_FindMyMouse_Description" />
<StackPanel Orientation="Horizontal" Spacing="12" Margin="0,24,0,0">
<Button x:Uid="OOBE_Settings"
Click="SettingsLaunchButton_Click"/>
<HyperlinkButton NavigateUri="{x:Bind ViewModel.Link}" Style="{StaticResource TextButtonStyle}">
<TextBlock x:Uid="LearnMore_MouseUtils"
TextWrapping="Wrap" />
</HyperlinkButton>
</StackPanel>
</StackPanel>
</controls:OOBEPageControl.ModuleContent>
</controls:OOBEPageControl>
</Page>

View File

@@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.OOBE.Enums;
using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel;
using Microsoft.PowerToys.Settings.UI.Views;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;
namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
{
public sealed partial class OobeMouseUtils : Page
{
public OobePowerToysModule ViewModel { get; set; }
public OobeMouseUtils()
{
this.InitializeComponent();
ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModulesEnum.MouseUtils]);
DataContext = ViewModel;
}
private void SettingsLaunchButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
{
if (OobeShellPage.OpenMainWindowCallback != null)
{
OobeShellPage.OpenMainWindowCallback(typeof(MouseUtilsPage));
}
ViewModel.LogOpeningSettingsEvent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
ViewModel.LogOpeningModuleEvent();
}
protected override void OnNavigatedFrom(NavigationEventArgs e)
{
ViewModel.LogClosingModuleEvent();
}
}
}

View File

@@ -143,6 +143,18 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/KBM.gif",
Link = "https://aka.ms/PowerToysOverview_KeyboardManager",
});
Modules.Insert((int)PowerToysModulesEnum.MouseUtils, new OobePowerToysModule()
{
ModuleName = loader.GetString("Oobe_MouseUtils"),
Tag = "MouseUtils",
IsNew = true,
Icon = "\uE962",
FluentIcon = "ms-appx:///Assets/FluentIcons/FluentIconsMouseUtils.png",
Image = "ms-appx:///Assets/Modules/MouseUtils.png",
Description = loader.GetString("Oobe_MouseUtils_Description"),
PreviewImageSource = "ms-appx:///Assets/Modules/OOBE/MouseUtils.gif",
Link = "https://aka.ms/PowerToysOverview_MouseUtilities", // TODO: Add correct link after it's been created.
});
Modules.Insert((int)PowerToysModulesEnum.PowerRename, new OobePowerToysModule()
{
ModuleName = loader.GetString("Oobe_PowerRename"),
@@ -228,6 +240,7 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views
case "FileExplorer": NavigationFrame.Navigate(typeof(OobeFileExplorer)); break;
case "ShortcutGuide": NavigationFrame.Navigate(typeof(OobeShortcutGuide)); break;
case "VideoConference": NavigationFrame.Navigate(typeof(OobeVideoConference)); break;
case "MouseUtils": NavigationFrame.Navigate(typeof(OobeMouseUtils)); break;
}
}

View File

@@ -248,6 +248,10 @@
<value>Keyboard Manager</value>
<comment>Product name: Navigation view item name for Keyboard Manager</comment>
</data>
<data name="Shell_MouseUtilities.Content" xml:space="preserve">
<value>Mouse utilities</value>
<comment>Product name: Navigation view item name for Mouse utilities</comment>
</data>
<data name="Shell_NavigationMenu_Announce_Collapse" xml:space="preserve">
<value>Navigation closed</value>
<comment>Accessibility announcement when the navigation pane collapses</comment>
@@ -1275,6 +1279,10 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="Oobe_VideoConference_Description" xml:space="preserve">
<value>Video Conference Mute allows users to quickly mute the microphone and turn off the camera while on a conference call with a single keystroke, regardless of what application has focus on your computer.</value>
</data>
<data name="Oobe_MouseUtils_Description" xml:space="preserve">
<value>A collection of utilities to enhance your mouse.</value>
<comment>Mouse as in the hardware peripheral</comment>
</data>
<data name="Oobe_Overview_Description.Text" xml:space="preserve">
<value>Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity.
@@ -1567,6 +1575,10 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<value>Learn more about Keyboard Manager</value>
<comment>Keyboard Manager is a product name, do not loc</comment>
</data>
<data name="LearnMore_MouseUtils.Text" xml:space="preserve">
<value>Learn more about Mouse utilities</value>
<comment>Mouse utilities is a product name, do not loc</comment>
</data>
<data name="LearnMore_PowerPreview.Text" xml:space="preserve">
<value>Learn more about File Explorer add-ons</value>
<comment>File Explorer is a product name, do not loc</comment>
@@ -1591,6 +1603,18 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<value>File Explorer add-ons</value>
<comment>Do not localize this string</comment>
</data>
<data name="Oobe_MouseUtils" xml:space="preserve">
<value>Mouse utilities</value>
<comment>Mouse as in the hardware peripheral</comment>
</data>
<data name="Oobe_MouseUtils_FindMyMouse.Text" xml:space="preserve">
<value>Find My Mouse</value>
<comment>Mouse as in the hardware peripheral</comment>
</data>
<data name="Oobe_MouseUtils_FindMyMouse_Description.Text" xml:space="preserve">
<value>Click twice on the Left Control key to focus on your mouse.</value>
<comment>Mouse as in the hardware peripheral. Key as in a keyboard key</comment>
</data>
<data name="Launch_Run.Content" xml:space="preserve">
<value>Launch PowerToys Run</value>
</data>
@@ -1621,6 +1645,9 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="ImageResizer.SecondaryLinksHeader" xml:space="preserve">
<value>Attribution</value>
</data>
<data name="MouseUtils.SecondaryLinksHeader" xml:space="preserve">
<value>Attribution</value>
</data>
<data name="PowerLauncher.SecondaryLinksHeader" xml:space="preserve">
<value>Attribution</value>
</data>
@@ -1661,4 +1688,18 @@ From there, simply click on a Markdown file, PDF file or SVG icon in the File Ex
<data name="Awake_TimeBeforeAwake.Header" xml:space="preserve">
<value>Time before returning to the previous awakeness state</value>
</data>
<data name="MouseUtils.ModuleTitle" xml:space="preserve">
<value>Mouse utilities</value>
</data>
<data name="MouseUtils.ModuleDescription" xml:space="preserve">
<value>A collection of mouse utilities.</value>
</data>
<data name="MouseUtils_Enable_FindMyMouse.Header" xml:space="preserve">
<value>Enable Find My Mouse</value>
<comment>"Find My Mouse" is the name of the utility.</comment>
</data>
<data name="MouseUtils_Enable_FindMyMouse.Description" xml:space="preserve">
<value>Press the Left Control key twice to focus the mouse pointer.</value>
<comment>"Left Control" is a keyboard key.</comment>
</data>
</root>

View File

@@ -0,0 +1,32 @@
<Page
x:Class="Microsoft.PowerToys.Settings.UI.Views.MouseUtilsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
AutomationProperties.LandmarkType="Main">
<controls:SettingsPageControl x:Uid="MouseUtils"
ModuleImageSource="ms-appx:///Assets/Modules/MouseUtils.png">
<controls:SettingsPageControl.ModuleContent>
<StackPanel Orientation="Vertical">
<controls:Setting x:Uid="MouseUtils_Enable_FindMyMouse" Icon="&#xF272;">
<controls:Setting.ActionContent>
<ToggleSwitch IsOn="{x:Bind ViewModel.IsFindMyMouseEnabled, Mode=TwoWay}" HorizontalAlignment="Right"/>
</controls:Setting.ActionContent>
</controls:Setting>
</StackPanel>
</controls:SettingsPageControl.ModuleContent>
<controls:SettingsPageControl.PrimaryLinks>
<controls:PageLink x:Uid="LearnMore_MouseUtils" Link="https://aka.ms/PowerToysOverview_MouseUtilities"/>
</controls:SettingsPageControl.PrimaryLinks>
<controls:SettingsPageControl.SecondaryLinks>
<controls:PageLink Text="Raymond Chen's Find My Mouse" Link="https://devblogs.microsoft.com/oldnewthing/author/oldnewthing"/>
</controls:SettingsPageControl.SecondaryLinks>
</controls:SettingsPageControl>
</Page>

View File

@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.Library.ViewModels;
using Windows.UI.Xaml.Controls;
namespace Microsoft.PowerToys.Settings.UI.Views
{
public sealed partial class MouseUtilsPage : Page
{
private MouseUtilsViewModel ViewModel { get; set; }
public MouseUtilsPage()
{
var settingsUtils = new SettingsUtils();
ViewModel = new MouseUtilsViewModel(SettingsRepository<GeneralSettings>.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage);
DataContext = ViewModel;
InitializeComponent();
}
}
}

View File

@@ -95,6 +95,14 @@
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Shell_MouseUtilities"
helpers:NavHelper.NavigateTo="views:MouseUtilsPage">
<muxc:NavigationViewItem.Icon>
<BitmapIcon UriSource="ms-appx:///Assets/FluentIcons/FluentIconsMouseUtils.png"
ShowAsMonochrome="False" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage">
<muxc:NavigationViewItem.Icon>

View File

@@ -68,6 +68,7 @@ namespace PowerToys.Settings
case "Run": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerLauncherPage); break;
case "ImageResizer": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ImageResizerPage); break;
case "KBM": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.KeyboardManagerPage); break;
case "MouseUtils": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.MouseUtilsPage); break;
case "PowerRename": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerRenamePage); break;
case "FileExplorer": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.PowerPreviewPage); break;
case "ShortcutGuide": app.StartupPage = typeof(Microsoft.PowerToys.Settings.UI.Views.ShortcutGuidePage); break;