diff --git a/src/modules/poweraccent/PowerAccent.Core/Languages.cs b/src/modules/poweraccent/PowerAccent.Core/Languages.cs index 06c3a2bea3..2917feff91 100644 --- a/src/modules/poweraccent/PowerAccent.Core/Languages.cs +++ b/src/modules/poweraccent/PowerAccent.Core/Languages.cs @@ -224,7 +224,7 @@ namespace PowerAccent.Core LetterKey.VK_X => new[] { "ẋ", "×" }, LetterKey.VK_Y => new[] { "ẏ", "ꝡ" }, LetterKey.VK_Z => new[] { "ʒ", "ǯ", "ℤ" }, - LetterKey.VK_COMMA => new[] { "∙", "₋", "⁻", "–", "√" }, // – is in VK_MINUS for other languages, but not VK_COMMA, so we add it here. + LetterKey.VK_COMMA => new[] { "∙", "₋", "⁻", "–", "√", "‟", "《", "》", "‛", "〈", "〉", "″", "‴", "⁗" }, // – is in VK_MINUS for other languages, but not VK_COMMA, so we add it here. LetterKey.VK_PERIOD => new[] { "…", "⁝", "\u0300", "\u0301", "\u0302", "\u0303", "\u0304", "\u0308", "\u030B", "\u030C" }, LetterKey.VK_MINUS => new[] { "~", "‐", "‑", "‒", "—", "―", "⁓", "−", "⸺", "⸻", "∓" }, LetterKey.VK_SLASH_ => new[] { "÷", "√" }, @@ -302,6 +302,7 @@ namespace PowerAccent.Core LetterKey.VK_E => new[] { "€" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "»", "«" }, _ => Array.Empty(), }; } @@ -317,6 +318,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "ü" }, LetterKey.VK_Z => new[] { "ž" }, LetterKey.VK_S => new[] { "š" }, + LetterKey.VK_COMMA => new[] { "„", "“", "«", "»" }, _ => Array.Empty(), }; } @@ -344,6 +346,7 @@ namespace PowerAccent.Core LetterKey.VK_A => new[] { "ä", "å" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ö" }, + LetterKey.VK_COMMA => new[] { "”", "’", "»" }, _ => Array.Empty(), }; } @@ -360,6 +363,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ô", "ö", "ó", "ò", "õ", "œ" }, LetterKey.VK_U => new[] { "û", "ù", "ü", "ú" }, LetterKey.VK_Y => new[] { "ÿ", "ý" }, + LetterKey.VK_COMMA => new[] { "«", "»", "‹", "›", "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -376,6 +380,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_T => new[] { "þ" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "‘" }, _ => Array.Empty(), }; } @@ -393,7 +398,7 @@ namespace PowerAccent.Core LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú", "ü" }, - LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, + LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!", "«", "»", "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -411,7 +416,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú", "ü" }, LetterKey.VK_L => new[] { "·" }, - LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!" }, + LetterKey.VK_COMMA => new[] { "¿", "?", "¡", "!", "«", "»", "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -427,6 +432,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ō" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ū" }, + LetterKey.VK_COMMA => new[] { "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -443,6 +449,7 @@ namespace PowerAccent.Core LetterKey.VK_N => new[] { "ñ" }, LetterKey.VK_O => new[] { "ó", "ö", "ô" }, LetterKey.VK_U => new[] { "ú", "ü", "û" }, + LetterKey.VK_COMMA => new[] { "“", "„", "”", "‘", ",", "’" }, _ => Array.Empty(), }; } @@ -469,6 +476,7 @@ namespace PowerAccent.Core LetterKey.VK_V => new[] { "ü", "ǖ", "ǘ", "ǚ", "ǜ" }, LetterKey.VK_Y => new[] { "¥" }, LetterKey.VK_Z => new[] { "ẑ" }, + LetterKey.VK_COMMA => new[] { "“", "”", "‘", "’", "「", "」", "『", "』" }, _ => Array.Empty(), }; } @@ -505,6 +513,7 @@ namespace PowerAccent.Core LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_T => new[] { "₺" }, LetterKey.VK_U => new[] { "ü", "û" }, + LetterKey.VK_COMMA => new[] { "“", "”", "‘", "’", "«", "»", "‹", "›" }, _ => Array.Empty(), }; } @@ -522,6 +531,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_S => new[] { "ś" }, LetterKey.VK_Z => new[] { "ż", "ź" }, + LetterKey.VK_COMMA => new[] { "„", "”", "‘", "’", "»", "«" }, _ => Array.Empty(), }; } @@ -539,7 +549,7 @@ namespace PowerAccent.Core LetterKey.VK_P => new[] { "π" }, LetterKey.VK_S => new[] { "$" }, LetterKey.VK_U => new[] { "ú" }, - LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺" }, + LetterKey.VK_COMMA => new[] { "≤", "≥", "≠", "≈", "≙", "±", "₊", "⁺", "“", "”", "‘", "’", "«", "»" }, _ => Array.Empty(), }; } @@ -594,6 +604,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "‘", "»", "«", "›", "‹" }, _ => Array.Empty(), }; } @@ -608,6 +619,7 @@ namespace PowerAccent.Core LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó" }, LetterKey.VK_U => new[] { "ú" }, + LetterKey.VK_COMMA => new[] { "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -623,6 +635,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ò" }, LetterKey.VK_P => new[] { "£" }, LetterKey.VK_U => new[] { "ù" }, + LetterKey.VK_COMMA => new[] { "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -645,6 +658,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "ů", "ú" }, LetterKey.VK_Y => new[] { "ý" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "‘", "»", "«", "›", "‹" }, _ => Array.Empty(), }; } @@ -659,6 +673,7 @@ namespace PowerAccent.Core LetterKey.VK_O => new[] { "ö" }, LetterKey.VK_S => new[] { "ß" }, LetterKey.VK_U => new[] { "ü" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "‘", "»", "«", "›", "‹" }, _ => Array.Empty(), }; } @@ -689,6 +704,7 @@ namespace PowerAccent.Core LetterKey.VK_X => new string[] { "ξ" }, LetterKey.VK_Y => new string[] { "υ" }, LetterKey.VK_Z => new string[] { "ζ" }, + LetterKey.VK_COMMA => new[] { "“", "”", "«", "»", }, _ => Array.Empty(), }; } @@ -710,7 +726,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "וֹ", "וּ", "װ", "\u05b9" }, LetterKey.VK_X => new[] { "\u05b6", "\u05b1" }, LetterKey.VK_Y => new[] { "ױ" }, - LetterKey.VK_COMMA => new[] { "”", "’", "״", "׳" }, + LetterKey.VK_COMMA => new[] { "”", "’", "'", "״", "׳" }, LetterKey.VK_PERIOD => new[] { "\u05ab", "\u05bd", "\u05bf" }, LetterKey.VK_MINUS => new[] { "–", "־" }, _ => Array.Empty(), @@ -727,6 +743,7 @@ namespace PowerAccent.Core LetterKey.VK_I => new[] { "í" }, LetterKey.VK_O => new[] { "ó", "ő", "ö" }, LetterKey.VK_U => new[] { "ú", "ű", "ü" }, + LetterKey.VK_COMMA => new[] { "„", "”", "»", "«" }, _ => Array.Empty(), }; } @@ -740,6 +757,7 @@ namespace PowerAccent.Core LetterKey.VK_I => new[] { "î" }, LetterKey.VK_S => new[] { "ș" }, LetterKey.VK_T => new[] { "ț" }, + LetterKey.VK_COMMA => new[] { "„", "”", "«", "»" }, _ => Array.Empty(), }; } @@ -754,6 +772,7 @@ namespace PowerAccent.Core LetterKey.VK_I => new[] { "ì", "í" }, LetterKey.VK_O => new[] { "ò", "ó" }, LetterKey.VK_U => new[] { "ù", "ú" }, + LetterKey.VK_COMMA => new[] { "«", "»", "“", "”", "‘", "’" }, _ => Array.Empty(), }; } @@ -772,6 +791,7 @@ namespace PowerAccent.Core LetterKey.VK_R => new[] { "ř" }, LetterKey.VK_S => new[] { "ş" }, LetterKey.VK_U => new[] { "û", "ü" }, + LetterKey.VK_COMMA => new[] { "«", "»", "“", "”" }, _ => Array.Empty(), }; } @@ -789,6 +809,7 @@ namespace PowerAccent.Core LetterKey.VK_U => new[] { "û", "ü", "ù", "ú" }, LetterKey.VK_Y => new[] { "ŷ", "ÿ", "ỳ", "ý" }, LetterKey.VK_W => new[] { "ŵ", "ẅ", "ẁ", "ẃ" }, + LetterKey.VK_COMMA => new[] { "‘", "’", "“", "“" }, _ => Array.Empty(), }; } @@ -801,6 +822,7 @@ namespace PowerAccent.Core LetterKey.VK_A => new[] { "å", "ä" }, LetterKey.VK_E => new[] { "é" }, LetterKey.VK_O => new[] { "ö" }, + LetterKey.VK_COMMA => new[] { "”", "’", "»", "«" }, _ => Array.Empty(), }; } @@ -814,6 +836,7 @@ namespace PowerAccent.Core LetterKey.VK_D => new[] { "đ" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "’", "»", "«", "›", "‹" }, _ => Array.Empty(), }; } @@ -838,6 +861,7 @@ namespace PowerAccent.Core { LetterKey.VK_E => new[] { "ѐ" }, LetterKey.VK_I => new[] { "ѝ" }, + LetterKey.VK_COMMA => new[] { "„", "“", "’", "‘" }, _ => Array.Empty(), }; } @@ -869,6 +893,7 @@ namespace PowerAccent.Core LetterKey.VK_E => new[] { "€", "é" }, LetterKey.VK_O => new[] { "ø" }, LetterKey.VK_S => new[] { "$" }, + LetterKey.VK_COMMA => new[] { "«", "»", ",", "‘", "’", "„", "“" }, _ => Array.Empty(), }; } @@ -881,6 +906,7 @@ namespace PowerAccent.Core LetterKey.VK_A => new[] { "å", "æ" }, LetterKey.VK_E => new[] { "€" }, LetterKey.VK_O => new[] { "ø" }, + LetterKey.VK_COMMA => new[] { "»", "«", "“", "”", "›", "‹", "‘", "’" }, _ => Array.Empty(), }; } @@ -897,6 +923,7 @@ namespace PowerAccent.Core LetterKey.VK_S => new[] { "š" }, LetterKey.VK_U => new[] { "ų", "ū" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "‚", "‘" }, _ => Array.Empty(), }; } @@ -910,6 +937,7 @@ namespace PowerAccent.Core LetterKey.VK_E => new[] { "€" }, LetterKey.VK_S => new[] { "š" }, LetterKey.VK_Z => new[] { "ž" }, + LetterKey.VK_COMMA => new[] { "„", "“", "»", "«" }, _ => Array.Empty(), }; } diff --git a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs index fa020ee4fe..a50eedfc1b 100644 --- a/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs +++ b/src/modules/poweraccent/PowerAccent.Core/PowerAccent.cs @@ -20,6 +20,7 @@ public partial class PowerAccent : IDisposable // Keys that show a description (like dashes) when ShowCharacterInfoSetting is 1 private readonly LetterKey[] _letterKeysShowingDescription = new LetterKey[] { LetterKey.VK_O }; + private const double ScreenMinPadding = 150; private bool _visible; private string[] _characters = Array.Empty(); @@ -332,6 +333,11 @@ public partial class PowerAccent : IDisposable return Calculation.GetRawCoordinatesFromPosition(position, screen, window); } + public double GetDisplayMaxWidth() + { + return WindowsFunctions.GetActiveDisplay().Size.Width - ScreenMinPadding; + } + public Position GetToolbarPosition() { return _settingService.Position; diff --git a/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs b/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs index 311417851a..7eed6a9a1b 100644 --- a/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs +++ b/src/modules/poweraccent/PowerAccent.UI/Selector.xaml.cs @@ -59,6 +59,7 @@ public partial class Selector : FluentWindow, IDisposable, INotifyPropertyChange _selectedIndex = index; characters.SelectedIndex = _selectedIndex; characterName.Text = _powerAccent.CharacterDescriptions[_selectedIndex]; + characters.ScrollIntoView(character); } private void PowerAccent_OnChangeDisplay(bool isActive, string[] chars) @@ -73,6 +74,7 @@ public partial class Selector : FluentWindow, IDisposable, INotifyPropertyChange characters.ItemsSource = chars; characters.SelectedIndex = _selectedIndex; this.UpdateLayout(); // Required for filling the actual width/height before positioning. + SetWindowsSize(); SetWindowPosition(); Show(); Microsoft.PowerToys.Telemetry.PowerToysTelemetry.Log.WriteEvent(new PowerAccent.Core.Telemetry.PowerAccentShowAccentMenuEvent()); @@ -96,6 +98,11 @@ public partial class Selector : FluentWindow, IDisposable, INotifyPropertyChange this.Top = position.Y; } + private void SetWindowsSize() + { + this.characters.MaxWidth = _powerAccent.GetDisplayMaxWidth(); + } + protected override void OnClosed(EventArgs e) { _powerAccent.SaveUsageInfo();