#!/usr/bin/env sh # launch a new kitty window. # If a kitty window is active, sets the new CWD to the current one. # Else just launch a new one. case "$XDG_CURRENT_DESKTOP" in "Hyprland") pid=$(hyprctl activewindow -j | jq '. | if .initialTitle == "kitty" then .pid else -1 end') ;; *) pid="-1" ;; esac if [[ "$pid" == "-1" ]]; then kitty & else kitten @ --to unix:@kitty-$pid launch --cwd current --type os-window & fi