Skip to content

Instantly share code, notes, and snippets.

@strix
Forked from tadly/rofi-gpaste.sh
Last active November 25, 2020 00:05
Show Gist options
  • Save strix/3a81adefe84d5df1b08068cb5ed86477 to your computer and use it in GitHub Desktop.
Save strix/3a81adefe84d5df1b08068cb5ed86477 to your computer and use it in GitHub Desktop.
rofi + gpaste
#!/usr/bin/env bash
#
# Use rofi to select an entry from gpaste
#
# Requirements:
# rofi, gpaste
#
line=`gpaste-client --oneline | \
rofi -theme Monokai -dmenu -i -p clipboard -kb-custom-1 Ctrl+x $@`
exit_code=$?
index=`echo $line | cut -d ':' -f1`
if ! [[ $index =~ ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$ ]]; then
exit 0
fi
if [ $exit_code == 0 ]; then
gpaste-client select $index
elif [ $exit_code == 10 ]; then
gpaste-client delete $index
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment