fedora-csb-system-manager
1#!/usr/bin/env bash
2# Launch a new kitty window, either in existing instance or new one
3
4# Use KITTY_LISTEN_ON if available (when launched from within kitty)
5if [ -n "$KITTY_LISTEN_ON" ]; then
6 exec kitty @ launch --type=os-window
7else
8 # Find the socket with PID suffix (kitty auto-appends PID)
9 SOCKET=$(find /tmp -maxdepth 1 -name 'my-kitty-*' -type s -printf '%T@ %p\n' 2>/dev/null | sort -rn | head -1 | cut -d' ' -f2-)
10 if [ -n "$SOCKET" ]; then
11 exec kitty @ --to "unix:$SOCKET" launch --type=os-window
12 else
13 # No existing instance, start fresh
14 exec kitty
15 fi
16fi