Table of Contents
Show zenity notifcation on string selection
Install xclip and zenity if you don't have it:
sudo apt install xclip zenity
Example of showing hostname when IP is selected in primary clipboard. Put the following in script and call it via some keyboard shortcut.
zenity --notification --text=$(grep -B1 $(xclip -o) $HOME/.ssh/ssh_config.d/yourhostconfig.conf | head -n1 | cut -d" " -f 2,3,4,5)
Your host entry needs to be formated so that the “Hostname” directive is the second one in the file e.g.
Host myhost alias2 alias3 Hostname <serverip> User root ...rest of ssh options...
or you will need to tweak the grep command.
- Ubuntu 20.04.3