← back to Ken
kalshi-dash/ken-trade-flash.sh
35 lines
#!/bin/bash
# ken-trade-flash.sh — flash "NEW TRADE BY KEN" in blinking red on the CURRENT iTerm2 pane.
# Resolves this session's pane tty from the ITERM_SESSION_ID guid via iTerm2 AppleScript,
# then writes a bold blinking bright-red banner + terminal bells straight to that tty device
# (not via 'write text', so it paints on screen without injecting into the Claude prompt).
# Usage: ken-trade-flash.sh "TICKER side count @ price" [detail line optional]
DETAIL="${1:-}"
GUID="${ITERM_SESSION_ID##*:}"; [ -z "$GUID" ] && GUID="${TERM_SESSION_ID##*:}"
TTY=$(osascript 2>/dev/null <<OSA
tell application "iTerm2"
repeat with w in windows
repeat with t in tabs of w
repeat with s in sessions of t
if (id of s) is "$GUID" then return tty of s
end repeat
end repeat
end repeat
end tell
OSA
)
if [ -z "$TTY" ] || [ ! -w "$TTY" ]; then echo "ken-trade-flash: could not resolve a writable tty ($TTY)"; exit 1; fi
RED=$'\033[1;5;97;101m' # bold + blink + white text on bright-red background
RESET=$'\033[0m'
BLANK=" "
for i in $(seq 1 14); do
{ printf '\a'
printf '\n%s 🔴 NEW TRADE BY KEN 🔴 %s\n' "$RED" "$RESET"
[ -n "$DETAIL" ] && printf '%s %s %s\n' "$RED" "$DETAIL" "$RESET"
} > "$TTY" 2>/dev/null
sleep 0.28
printf '\r%s\r' "$BLANK" > "$TTY" 2>/dev/null
sleep 0.18
done
printf '%s\n' "$RESET" > "$TTY" 2>/dev/null