Files
nixos/scripts/WMScripts/kitty_window.sh
T
2026-10-06 22:34:05 +02:00

22 lines
448 B
Bash
Executable File

#!/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