Skip to content

Commit 0779277

Browse files
committed
Implement the Kitty Keyboard Protocol
1 parent 3ec372c commit 0779277

24 files changed

+862
-56
lines changed

src/cascadia/TerminalCore/ICoreSettings.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ namespace Microsoft.Terminal.Core
121121
String WordDelimiters { get; };
122122

123123
Boolean ForceVTInput { get; };
124+
Boolean AllowKittyKeyboardMode { get; };
124125
Boolean AllowVtChecksumReport { get; };
125126
Boolean AllowVtClipboardWrite { get; };
126127
Boolean TrimBlockSelection { get; };

src/cascadia/TerminalCore/Terminal.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ void Terminal::UpdateSettings(ICoreSettings settings)
9898
}
9999

100100
_getTerminalInput().ForceDisableWin32InputMode(settings.ForceVTInput());
101+
_getTerminalInput().ForceDisableKittyKeyboardProtocol(!settings.AllowKittyKeyboardMode());
101102

102103
if (settings.TabColor() == nullptr)
103104
{

src/cascadia/TerminalSettingsAppAdapterLib/TerminalSettings.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ namespace winrt::Microsoft::Terminal::Settings
349349
_ReloadEnvironmentVariables = profile.ReloadEnvironmentVariables();
350350
_RainbowSuggestions = profile.RainbowSuggestions();
351351
_ForceVTInput = profile.ForceVTInput();
352+
_AllowKittyKeyboardMode = profile.AllowKittyKeyboardMode();
352353
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
353354
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
354355
_PathTranslationStyle = profile.PathTranslationStyle();

src/cascadia/TerminalSettingsEditor/ProfileViewModel.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
166166
OBSERVABLE_PROJECTED_SETTING(_profile, AutoMarkPrompts);
167167
OBSERVABLE_PROJECTED_SETTING(_profile, RepositionCursorWithMouse);
168168
OBSERVABLE_PROJECTED_SETTING(_profile, ForceVTInput);
169+
OBSERVABLE_PROJECTED_SETTING(_profile, AllowKittyKeyboardMode);
169170
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtChecksumReport);
170171
OBSERVABLE_PROJECTED_SETTING(_profile, AllowVtClipboardWrite);
171172
OBSERVABLE_PROJECTED_SETTING(_profile, AnswerbackMessage);

src/cascadia/TerminalSettingsEditor/ProfileViewModel.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ namespace Microsoft.Terminal.Settings.Editor
157157
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AutoMarkPrompts);
158158
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RepositionCursorWithMouse);
159159
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, ForceVTInput);
160+
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowKittyKeyboardMode);
160161
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
161162
OBSERVABLE_PROJECTED_PROFILE_SETTING(String, AnswerbackMessage);
162163
OBSERVABLE_PROJECTED_PROFILE_SETTING(Boolean, RainbowSuggestions);

src/cascadia/TerminalSettingsEditor/Profiles_Terminal.xaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@
4949
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
5050
</local:SettingContainer>
5151

52+
<!-- Kitty Keyboard Mode -->
53+
<local:SettingContainer x:Uid="Profile_AllowKittyKeyboardMode"
54+
ClearSettingValue="{x:Bind Profile.ClearAllowKittyKeyboardMode}"
55+
HasSettingValue="{x:Bind Profile.HasAllowKittyKeyboardMode, Mode=OneWay}"
56+
SettingOverrideSource="{x:Bind Profile.AllowKittyKeyboardModeOverrideSource, Mode=OneWay}">
57+
<ToggleSwitch IsOn="{x:Bind Profile.AllowKittyKeyboardMode, Mode=TwoWay}"
58+
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
59+
</local:SettingContainer>
60+
5261
<!-- Allow VT Checksum Report -->
5362
<local:SettingContainer x:Uid="Profile_AllowVtChecksumReport"
5463
ClearSettingValue="{x:Bind Profile.ClearAllowVtChecksumReport}"

src/cascadia/TerminalSettingsEditor/Resources/en-US/Resources.resw

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,14 @@
546546
<value>Use the legacy input encoding</value>
547547
<comment>Header for a control to toggle legacy input encoding for the terminal.</comment>
548548
</data>
549+
<data name="Profile_AllowKittyKeyboardMode.Header" xml:space="preserve">
550+
<value>Kitty keyboard protocol mode</value>
551+
<comment>Header for a control to set the kitty keyboard protocol mode.</comment>
552+
</data>
553+
<data name="Profile_AllowKittyKeyboardMode.HelpText" xml:space="preserve">
554+
<value>Sets the baseline flags for the kitty keyboard protocol. Value is a sum of: 1=Disambiguate, 2=Report event types, 4=Report alternate keys, 8=Report all keys, 16=Report text.</value>
555+
<comment>Additional description for what the "kitty keyboard mode" setting does.</comment>
556+
</data>
549557
<data name="Profile_AllowVtChecksumReport.Header" xml:space="preserve">
550558
<value>Allow DECRQCRA (Request Checksum of Rectangular Area)</value>
551559
<comment>{Locked="DECRQCRA"}{Locked="Request Checksum of Rectangular Area"}Header for a control to toggle support for the DECRQCRA control sequence.</comment>
@@ -2575,19 +2583,19 @@
25752583
<comment>An option to choose from for the "path translation" setting.</comment>
25762584
</data>
25772585
<data name="Profile_PathTranslationStyleWsl.Content" xml:space="preserve">
2578-
<value>WSL (C:\ -> /mnt/c)</value>
2586+
<value>WSL (C:\ -&gt; /mnt/c)</value>
25792587
<comment>{Locked="WSL","C:\","/mnt/c"} An option to choose from for the "path translation" setting.</comment>
25802588
</data>
25812589
<data name="Profile_PathTranslationStyleCygwin.Content" xml:space="preserve">
2582-
<value>Cygwin (C:\ -> /cygdrive/c)</value>
2590+
<value>Cygwin (C:\ -&gt; /cygdrive/c)</value>
25832591
<comment>{Locked="Cygwin","C:\","/cygdrive/c"} An option to choose from for the "path translation" setting.</comment>
25842592
</data>
25852593
<data name="Profile_PathTranslationStyleMsys2.Content" xml:space="preserve">
2586-
<value>MSYS2 (C:\ -> /c)</value>
2594+
<value>MSYS2 (C:\ -&gt; /c)</value>
25872595
<comment>{Locked="MSYS2","C:\","/c"} An option to choose from for the "path translation" setting.</comment>
25882596
</data>
25892597
<data name="Profile_PathTranslationStyleMinGW.Content" xml:space="preserve">
2590-
<value>MinGW (C:\ -> C:/)</value>
2598+
<value>MinGW (C:\ -&gt; C:/)</value>
25912599
<comment>{Locked="MinGW","C:\","C:/"} An option to choose from for the "path translation" setting.</comment>
25922600
</data>
25932601
<data name="Profile_Delete_Orphaned.Header" xml:space="preserve">
@@ -2701,4 +2709,4 @@
27012709
<data name="Settings_ResetApplicationStateConfirmationButton.Content" xml:space="preserve">
27022710
<value>Yes, clear the cache</value>
27032711
</data>
2704-
</root>
2712+
</root>

src/cascadia/TerminalSettingsModel/MTSMSettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Author(s):
103103
X(bool, ReloadEnvironmentVariables, "compatibility.reloadEnvironmentVariables", true) \
104104
X(bool, RainbowSuggestions, "experimental.rainbowSuggestions", false) \
105105
X(bool, ForceVTInput, "compatibility.input.forceVT", false) \
106+
X(bool, AllowKittyKeyboardMode, "compatibility.kittyKeyboardMode", true) \
106107
X(bool, AllowVtChecksumReport, "compatibility.allowDECRQCRA", false) \
107108
X(bool, AllowVtClipboardWrite, "compatibility.allowOSC52", true) \
108109
X(bool, AllowKeypadMode, "compatibility.allowDECNKM", false) \

src/cascadia/TerminalSettingsModel/Profile.idl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ namespace Microsoft.Terminal.Settings.Model
8888
INHERITABLE_PROFILE_SETTING(Boolean, ReloadEnvironmentVariables);
8989
INHERITABLE_PROFILE_SETTING(Boolean, RainbowSuggestions);
9090
INHERITABLE_PROFILE_SETTING(Boolean, ForceVTInput);
91+
INHERITABLE_PROFILE_SETTING(Boolean, AllowKittyKeyboardMode);
9192
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtChecksumReport);
9293
INHERITABLE_PROFILE_SETTING(Boolean, AllowKeypadMode);
9394
INHERITABLE_PROFILE_SETTING(Boolean, AllowVtClipboardWrite);

src/cascadia/inc/ControlProperties.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
X(bool, TrimBlockSelection, true) \
5050
X(bool, SuppressApplicationTitle) \
5151
X(bool, ForceVTInput, false) \
52+
X(bool, AllowKittyKeyboardMode, true) \
5253
X(winrt::hstring, StartingTitle) \
5354
X(bool, DetectURLs, true) \
5455
X(bool, AutoMarkPrompts) \

0 commit comments

Comments
 (0)