#!/bin/bash # ssh-tab - ssh to an alias in a tab of the running kitty # Copyright (C) 2026 Danilo M. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # Lifted from blackpearl-sshmenu.sh, the rofi menu this shell replaces. # 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. name=${1:?usage: ssh-tab } 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 kitty ssh "$name"