#!/bin/bash SOCKET="unix:/tmp/kitty" if kitty @ --to "$SOCKET" focus-window 2>/dev/null; then kdotool search --class kitty | head -1 | xargs kdotool windowactivate else kitty --listen-on "$SOCKET" & fi