Copy SSH keys

Provides a quick way to copy your public keys to the clipboard

Image preview of Copy SSH keys plugin.

copy-ssh-keys.sh

Edit
Open on GitHub
#!/bin/bash

# <xbar.title>Copy SSH keys</xbar.title>
# <xbar.version>v1.0</xbar.version>
# <xbar.author>Bastian Kersting</xbar.author>
# <xbar.author.github>1c3t3a</xbar.author.github>
# <xbar.desc>Provides a quick way to copy your public keys to the clipboard</xbar.desc>
# <xbar.image>https://imgur.com/GYOuLJ1</xbar.image>
# <xbar.dependencies></xbar.dependencies>

if [[ $1 ]]; then
    cd ~/.ssh && pbcopy < "$1"
fi


# display icon
echo "|image=iVBORw0KGgoAAAANSUhEUgAAAD4AAABCCAYAAAAPIWX+AAAAAXNSR0IArs4c6QAAAAlwSFlzAAAuIwAALiMBeKU/dgAAActpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx4bXA6Q3JlYXRvclRvb2w+d3d3Lmlua3NjYXBlLm9yZzwveG1wOkNyZWF0b3JUb29sPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KGMtVWAAAEZxJREFUeAHNmwuwXVV5x79z9jnnPvKgASk0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WBw+OdsLC3tWJtgJmQOgJaS1qV+yr5ZTwn+8hfieVfq0qEEs8PCby3gcsJ9X6WrcoFn/y8vexM99DPMQzB1m3W/6H32NOcs89vb7XjxagutCDAiRDgGHwB1fzoTV+zZ5542n523nvtVZ53yiagFDpbxzuv3ObFk/zw3z2qHFT6WiJb9cc32SsCfSyZTsc64EPZ4O4N9ovfX2GP8necQ7zD1juvAdR6J18uPIDwn7n5Lvvvni6rdHRb4+bbbNt5v+d/1CrwwUzgMRsOmoHbyYFn1dov2m52aJUbb5z0nadCHIsY2c16AS9HYipAzx9Za883J78RR+ASV51Ldt+Io6983tby9uTrumes9D46+9SKJbHKaawyNmE7+RLigs/1zB+mJa+CA1dC4HeeaQ2B0r2CgJ6BU6JpUHLg77jBruGL//tVlkpVB89f9PHNeQt7g52lyM7/zK22e76ot+RMQwY8ySgANssjndj3tHgca0CUIo7uuNE+xdvNBxgAvViwxXxvMjxqO/jb7/Ov67E98xG0ZM9A6uZwgsDrI10ON43bb7Au1PvLGL23wfr3+Wuh66+7ff6CFs7/BdJJhnhLPIgPAAAAAElFTkSuQmCC";
echo "---"

# navigate to key directory (provide the location if the plugin doesn't work)
cd ~/.ssh || echo "Please configure ssh key location"
for filename in *.pub;do
    echo "${filename} | bash='$0' param1='${filename}' terminal=false"
done