Skip to content

Instantly share code, notes, and snippets.

@tadly
Last active May 16, 2022 07:17
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save tadly/2d5fc5879216382acec8c09d09b6fa61 to your computer and use it in GitHub Desktop.
Save tadly/2d5fc5879216382acec8c09d09b6fa61 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 -dmenu -i -p gpaste -kb-custom-1 Ctrl+x $@`
exit_code=$?
index=`echo $line | cut -d ':' -f1`
if ! [[ $index =~ ^[0-9]+$ ]]; then
exit 0
fi
if [ $exit_code == 0 ]; then
gpaste-client select $index
elif [ $exit_code == 10 ]; then
gpaste-client delete $index
fi
@tadly
Copy link
Author

tadly commented Jul 27, 2017

If you want me to change something, or have question, make sure to ping me directly (use @tadly) as otherwise I won't get a notification for your comment ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment