aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-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"