mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[MWB]Migrate to PowerToys-style shortcuts and better defaults(#27442)
* [MWB] Migrate to PowerToys-style shortcuts and disable Ctrlx3 for multiple mode * f: analyzer fixes * f: add Win to all default shortcuts * f: remove capture screen feature * f: add ability to disable shortcut * f: restrict disabling shortcuts only for MWB for now, because we don't explicitly support this feature anywhere else * handle downgrade->upgrade scenario * f: res loader * f: fix disabled state * f: fix L hotkey handling
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Interfaces;
|
||||
@@ -20,7 +21,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
{
|
||||
Name = ModuleName;
|
||||
Properties = new MouseWithoutBordersProperties();
|
||||
Version = "1.0";
|
||||
Version = "1.1";
|
||||
}
|
||||
|
||||
public string GetModuleName()
|
||||
@@ -28,10 +29,51 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
return Name;
|
||||
}
|
||||
|
||||
public HotkeySettings ConvertMouseWithoutBordersHotKeyToPowerToys(int value)
|
||||
{
|
||||
// VK_A <= value <= VK_Z
|
||||
if (value >= 0x41 && value <= 0x5A)
|
||||
{
|
||||
return new HotkeySettings(false, true, true, false, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Disabled state
|
||||
return new HotkeySettings(false, false, false, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// This can be utilized in the future if the settings.json file is to be modified/deleted.
|
||||
public bool UpgradeSettingsConfiguration()
|
||||
{
|
||||
#pragma warning disable CS0618 // We use obsolete members to upgrade them
|
||||
bool downgradedThenUpgraded = Version != "1.0" && (Properties.HotKeyToggleEasyMouse != null ||
|
||||
Properties.HotKeyLockMachine != null ||
|
||||
Properties.HotKeyReconnect != null ||
|
||||
Properties.HotKeySwitch2AllPC != null);
|
||||
|
||||
if (Version == "1.0" || downgradedThenUpgraded)
|
||||
{
|
||||
Version = "1.1";
|
||||
|
||||
Properties.ToggleEasyMouseShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyToggleEasyMouse.Value);
|
||||
|
||||
Properties.LockMachineShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyLockMachine.Value);
|
||||
|
||||
Properties.ReconnectShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeyReconnect.Value);
|
||||
|
||||
Properties.Switch2AllPCShortcut = ConvertMouseWithoutBordersHotKeyToPowerToys(Properties.HotKeySwitch2AllPC.Value);
|
||||
|
||||
Properties.HotKeyToggleEasyMouse = null;
|
||||
Properties.HotKeyLockMachine = null;
|
||||
Properties.HotKeyReconnect = null;
|
||||
Properties.HotKeySwitch2AllPC = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
#pragma warning restore CS0618
|
||||
}
|
||||
|
||||
public virtual void Save(ISettingsUtils settingsUtils)
|
||||
|
||||
Reference in New Issue
Block a user