mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[KBM]Allow remapping keys and shortcuts to arbitrary unicode sequences (#29399)
* [KBM] Allow remapping keys and shortcuts to arbitrary unicode sequences * f: spelling * f: tests * f: split shortcut configuration * f: address ui layout comments * [BugReport]Don't report personal info * f: fix crash in KBME * f: add missed type button * f: fix shortcut line UI elements alignment * f: align elements size * f: add warning about non-mapped keys
This commit is contained in:
@@ -28,9 +28,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
ArgumentNullException.ThrowIfNull(arg);
|
||||
|
||||
// Using Ordinal comparison for internal text
|
||||
return OriginalKeys.Equals(arg.OriginalKeys, StringComparison.Ordinal) &&
|
||||
NewRemapKeys.Equals(arg.NewRemapKeys, StringComparison.Ordinal) &&
|
||||
TargetApp.Equals(arg.TargetApp, StringComparison.Ordinal);
|
||||
return string.Equals(OriginalKeys, arg.OriginalKeys, StringComparison.Ordinal) &&
|
||||
string.Equals(NewRemapKeys, arg.NewRemapKeys, StringComparison.Ordinal) &&
|
||||
string.Equals(NewRemapString, arg.NewRemapString, StringComparison.Ordinal) &&
|
||||
string.Equals(TargetApp, arg.TargetApp, StringComparison.Ordinal);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,22 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("remapKeys")]
|
||||
public RemapKeysDataModel RemapKeys { get; set; }
|
||||
|
||||
[JsonPropertyName("remapKeysToText")]
|
||||
public RemapKeysDataModel RemapKeysToText { get; set; }
|
||||
|
||||
[JsonPropertyName("remapShortcuts")]
|
||||
public ShortcutsKeyDataModel RemapShortcuts { get; set; }
|
||||
|
||||
[JsonPropertyName("remapShortcutsToText")]
|
||||
public ShortcutsKeyDataModel RemapShortcutsToText { get; set; }
|
||||
|
||||
public KeyboardManagerProfile()
|
||||
{
|
||||
RemapKeys = new RemapKeysDataModel();
|
||||
RemapKeysToText = new RemapKeysDataModel();
|
||||
|
||||
RemapShortcuts = new ShortcutsKeyDataModel();
|
||||
RemapShortcutsToText = new ShortcutsKeyDataModel();
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
|
||||
@@ -18,6 +18,9 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
[JsonPropertyName("newRemapKeys")]
|
||||
public string NewRemapKeys { get; set; }
|
||||
|
||||
[JsonPropertyName("unicodeText")]
|
||||
public string NewRemapString { get; set; }
|
||||
|
||||
private static List<string> MapKeys(string stringOfKeys)
|
||||
{
|
||||
return stringOfKeys
|
||||
@@ -34,7 +37,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library
|
||||
|
||||
public List<string> GetMappedNewRemapKeys()
|
||||
{
|
||||
return MapKeys(NewRemapKeys);
|
||||
return string.IsNullOrEmpty(NewRemapString) ? MapKeys(NewRemapKeys) : new List<string> { NewRemapString };
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
|
||||
Reference in New Issue
Block a user