wiki:show_zenity_notifcation_string_selection
Table of Contents
Show zenity notifcation on string selection
Requisite packages
Install xclip and zenity if you don't have it:
sudo apt install xclip zenity
Show hostname
Example of showing hostname when IP is selected in primary clipboard. Put the following in script and call it via some keyboard shortcut.
- what_hostname.sh
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.
Tested on
- Ubuntu 20.04.3
See also
References
wiki/show_zenity_notifcation_string_selection.txt · Last modified: 2021/10/17 12:48 by antisa