cdown / clipmenu

Clipboard management using dmenu
MIT License
1.11k stars 90 forks source link

Add backup functionality #159

Closed korikori closed 3 years ago

korikori commented 3 years ago

I needed a way to make (part of) my clipboard permanent, so I added a rudimentary backup function to clipctl and a handler for the CM_BACKUP environmental variable (full path to backup directory) in clipmenud.

cdown commented 3 years ago

Hi! Sorry, but I think I'm unlikely to merge this -- it seems pretty niche. No judgment on the code itself though, thanks for contributing to clipmenu :-)

This also complicates the CM_MAX_CLIPS case, since it seems weird that they would be restored from backup at one point, but then potentially destroyed later.

clipmenu-agnostically, it should be possible to do something like the following:

for file in some_dir/*; do
    xclip -sel clip < "$file"

    # clipboard notifications in X are async, so wait a bit to avoid drops
    sleep 1
done
korikori commented 3 years ago

Thank you for the input!