mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
Display Key Mappings in Settings (#2314)
* Move changes * Display Key Mapping in Settings * Fix display of empty keys list Co-authored-by: Udit Singh <udsing@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
ca3a436fe5
commit
d941b31c45
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// 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.
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
|
||||
public bool PowerRename { get; set; }
|
||||
|
||||
[JsonPropertyName("Keyboard Manager")]
|
||||
public bool KeyboardManager { get; set; }
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
return JsonSerializer.Serialize(this);
|
||||
|
||||
@@ -7,12 +7,18 @@ using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
public class KeyboadManagerConfigModel
|
||||
public class KeyboardManagerProfile
|
||||
{
|
||||
[JsonPropertyName("remapKeys")]
|
||||
public RemapKeysDataModel RemapKeys { get; set; }
|
||||
|
||||
[JsonPropertyName("remapShortcuts")]
|
||||
public ShortcutsKeyDataModel RemapShortcuts { get; set; }
|
||||
|
||||
public KeyboardManagerProfile()
|
||||
{
|
||||
RemapKeys = new RemapKeysDataModel();
|
||||
RemapShortcuts = new ShortcutsKeyDataModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
// 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.Lib.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
@@ -13,5 +16,24 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
|
||||
[JsonPropertyName("newRemapKeys")]
|
||||
public string NewRemapKeys { get; set; }
|
||||
|
||||
private List<string> MapKeys(string stringOfKeys)
|
||||
{
|
||||
return stringOfKeys
|
||||
.Split(';')
|
||||
.Select(uint.Parse)
|
||||
.Select(Helper.GetKeyName)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<string> GetOriginalKeys()
|
||||
{
|
||||
return MapKeys(OriginalKeys);
|
||||
}
|
||||
|
||||
public List<string> GetNewRemapKeys()
|
||||
{
|
||||
return MapKeys(NewRemapKeys);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,5 +11,10 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
[JsonPropertyName("inProcess")]
|
||||
public List<KeysDataModel> InProcessRemapKeys { get; set; }
|
||||
|
||||
public RemapKeysDataModel()
|
||||
{
|
||||
InProcessRemapKeys = new List<KeysDataModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
$"Microsoft\\PowerToys\\{powertoy}\\{fileName}");
|
||||
}
|
||||
|
||||
public static bool SettingsExists(string powertoy, string fileName = DefaultFileName)
|
||||
public static bool SettingsExists(string powertoy = DefaultModuleName, string fileName = DefaultFileName)
|
||||
{
|
||||
return File.Exists(GetSettingsPath(powertoy, fileName));
|
||||
}
|
||||
|
||||
@@ -11,5 +11,10 @@ namespace Microsoft.PowerToys.Settings.UI.Lib
|
||||
{
|
||||
[JsonPropertyName("global")]
|
||||
public List<KeysDataModel> GlobalRemapShortcuts { get; set; }
|
||||
|
||||
public ShortcutsKeyDataModel()
|
||||
{
|
||||
GlobalRemapShortcuts = new List<KeysDataModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user