diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-18 11:24:25 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-18 11:24:25 +0200 |
| commit | c29767aeccc1e6d9b36a9340142bae999f0d1c00 (patch) | |
| tree | 8a71d9d759b76ba78556c1e9e7d4f6dbb54d4d12 /bin | |
| parent | 4519646c1bc0f348ed99b7f2b0f0e9956bfae9e4 (diff) | |
| download | unified-desktop-theme-c29767aeccc1e6d9b36a9340142bae999f0d1c00.tar.gz unified-desktop-theme-c29767aeccc1e6d9b36a9340142bae999f0d1c00.zip | |
feat(rofi): ssh menu as a grid of host cards
rofi's ssh mode shows the alias only. blackpearl-sshmenu.sh now reads
~/.ssh/config itself and feeds dmenu two-line cards: the alias, then
"user · address" with the user only where the config sets one. ssh.rasi
lays them out 4x3 under an "SSH:" header lifted out of the inputbar.
The script moves into bin/ under the name hypr-theme's keybinding calls,
and install.sh links it and the theme like the other menus.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/blackpearl-sshmenu.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/blackpearl-sshmenu.sh b/bin/blackpearl-sshmenu.sh new file mode 100755 index 0000000..a94217e --- /dev/null +++ b/bin/blackpearl-sshmenu.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# SSH menu: the hosts in ~/.ssh/config as cards, rofi themed by udt. +# Copyright (C) 2026 Danilo M. <danix@danix.xyz> +# Licensed under the GNU General Public License v2 only. + +# rofi's own ssh mode shows the alias only, so the config is read here. +# ponytail: plain "Keyword value" lines in ~/.ssh/config only; Include and +# Match are not followed, wildcard Host patterns are skipped. +mapfile -t hosts < <(awk ' + function flush() { if (name != "") print name "\t" user "\t" addr } + tolower($1) == "host" { flush(); name = ($2 ~ /[*?]/) ? "" : $2; user = ""; addr = $2 } + tolower($1) == "hostname" { addr = $2 } + tolower($1) == "user" { user = $2 } + END { flush() }' ~/.ssh/config) + +# Two lines a card: the alias, then "user · address" with the user only where +# the config sets one. Entries are joined on "|" so each can hold a newline. +entries=() +for h in "${hosts[@]}"; do + IFS=$'\t' read -r name user addr <<< "$h" + entries+=("<b>$name</b> +<span size='small' fgalpha='65%'>${user:+$user · }$addr</span>") +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'*} +exec rofi-sensible-terminal -e ssh "$name" |
