Hack Warp Enter

This commit is contained in:
Peter Steinberger 2025-06-22 16:04:15 +02:00
parent 4fb6e925ac
commit 0e8b0d199a

View file

@ -164,6 +164,8 @@ enum Terminal: String, CaseIterable {
} }
// Special handling for Warp terminal // Special handling for Warp terminal
// Warp doesn't recognize standard key codes for Enter (36 or 76)
// and requires ASCII character 13 (carriage return) to execute commands
if self == .warp { if self == .warp {
return """ return """
tell application "\(processName)" tell application "\(processName)"
@ -171,12 +173,12 @@ enum Terminal: String, CaseIterable {
tell application "System Events" tell application "System Events"
-- Create new window -- Create new window
keystroke "n" using {command down} keystroke "n" using {command down}
delay 0.5 delay 1.0
-- Paste command from clipboard -- Paste command from clipboard
keystroke "v" using {command down} keystroke "v" using {command down}
delay 0.3 delay 0.5
-- Try numeric keypad Enter with small delay -- Warp requires ASCII character 13 instead of key code 36
key code 76 keystroke (ASCII character 13)
end tell end tell
end tell end tell
""" """