Skip to content

Instantly share code, notes, and snippets.

@3ximus
Last active August 5, 2024 04:30
Show Gist options
  • Save 3ximus/636a4367ff380570d2f3a95c4df67e77 to your computer and use it in GitHub Desktop.
Save 3ximus/636a4367ff380570d2f3a95c4df67e77 to your computer and use it in GitHub Desktop.
Rofi + KDE Plasma Klipper for clipboard history selection
#!/bin/bash
clipboard-history(){
for (( i=0; i<20 ; i++ )) ; do
qdbus org.kde.plasmashell /klipper org.kde.klipper.klipper.getClipboardHistoryItem $i | paste -sd ' ' | cut -c1-80
done
}
selected=$(clipboard-history | rofi -dmenu -format i -i -p "clipboard")
if [ $? == 0 ] ; then
qdbus org.kde.plasmashell /klipper org.kde.klipper.klipper.getClipboardHistoryItem $selected \
| head -c -1 \
| xargs -0 -IREPLACE qdbus org.kde.plasmashell /klipper org.kde.klipper.klipper.setClipboardContents REPLACE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment