aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-26 11:03:50 +0100
committerDanilo M. <danix@danix.xyz>2026-10-26 11:03:50 +0100
commita2287467b974c13e35016997c9dd84fea0491b5d (patch)
tree67ec89fa29474e618422eff640bdec152c7897cf
parent62062df913cc6843ccf3019b8a9526e86500f11f (diff)
downloadrofi-scripts-a2287467b974c13e35016997c9dd84fea0491b5d.tar.gz
rofi-scripts-a2287467b974c13e35016997c9dd84fea0491b5d.zip
feat(sshmenu): open the host in a tab of the running kitty
kitten @ launches it through the socket kitty.conf's listen_on opens, then Hyprland focuses the kitty window. Falls back to a new terminal when no kitty socket answers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-rwxr-xr-xbin/blackpearl-sshmenu.sh9
1 files changed, 9 insertions, 0 deletions
diff --git a/bin/blackpearl-sshmenu.sh b/bin/blackpearl-sshmenu.sh
index b0a0fc1..1092b83 100755
--- a/bin/blackpearl-sshmenu.sh
+++ b/bin/blackpearl-sshmenu.sh
@@ -37,4 +37,13 @@ done
i=$(IFS='|'; printf '%s' "${entries[*]}" | rofi -dmenu -i -markup-rows \
-sep '|' -eh 2 -format i -p '󰆍 SSH:' -theme ~/.config/rofi/udt/ssh.rasi) || exit
name=${hosts[i]%%$'\t'*}
+
+# A tab in the running kitty, through the socket kitty.conf's listen_on opens;
+# a new terminal when no kitty is up.
+# ponytail: first socket wins when several kitty instances run.
+sockets=("$XDG_RUNTIME_DIR"/kitty-*)
+if [[ -S ${sockets[0]} ]] && kitten @ --to "unix:${sockets[0]}" launch \
+ --type=tab --tab-title "$name" ssh "$name" >/dev/null; then
+ exec hyprctl dispatch 'hl.dsp.focus({ window = "class:kitty" })' >/dev/null
+fi
exec rofi-sensible-terminal -e ssh "$name"