summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
diff options
context:
space:
mode:
authorDeepankar Sharma <[email protected]>2025-08-13 13:32:54 -0400
committerGitHub <[email protected]>2025-08-13 17:32:54 +0000
commit9c7fb870c1a7c80741fafdfc6837d4b92e373b2d (patch)
tree1e31f201520c9724b4659ee7a36c21215e6280b9 /packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
parent74a13fb535b255797d6c9aa3499acfea6aadc58d (diff)
Add terminal setup command for Shift+Enter and Ctrl+Enter support (#3289)
Co-authored-by: jacob314 <[email protected]>
Diffstat (limited to 'packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts')
-rw-r--r--packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts b/packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
new file mode 100644
index 00000000..53c7566c
--- /dev/null
+++ b/packages/cli/src/ui/hooks/useKittyKeyboardProtocol.ts
@@ -0,0 +1,31 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import { useState } from 'react';
+import {
+ isKittyProtocolEnabled,
+ isKittyProtocolSupported,
+} from '../utils/kittyProtocolDetector.js';
+
+export interface KittyProtocolStatus {
+ supported: boolean;
+ enabled: boolean;
+ checking: boolean;
+}
+
+/**
+ * Hook that returns the cached Kitty keyboard protocol status.
+ * Detection is done once at app startup to avoid repeated queries.
+ */
+export function useKittyKeyboardProtocol(): KittyProtocolStatus {
+ const [status] = useState<KittyProtocolStatus>({
+ supported: isKittyProtocolSupported(),
+ enabled: isKittyProtocolEnabled(),
+ checking: false,
+ });
+
+ return status;
+}