| Crates.io | clipdir |
| lib.rs | clipdir |
| version | 0.1.0 |
| created_at | 2025-01-03 17:44:58.372638+00 |
| updated_at | 2025-01-03 17:44:58.372638+00 |
| description | wayland clipboard manager with a syncable directory backend |
| homepage | https://github.com/hashworks/clipdir |
| repository | https://github.com/hashworks/clipdir |
| max_upload_size | |
| id | 1502652 |
| size | 30,699 |
Clipdir is a clipboard history manager for wayland. Its workflow is the same as cliphist, but instead of a database it stores each clipboard entry as its own file in a directory. This makes it simple to sync the clipboard history across multiple devices.
dmenu/rofi/fzf or similar pickersCLIPBOARD_STATE (see man wl-clipboard)Currently, only cargo is supported: cargo install clipdir
$ clipdir help
Usage: clipdir [OPTIONS] <COMMAND>
Commands:
store, -s, --store Store a clipboard entry by stdin
list, -l, --list List clipboard entries prefixed with their id
decode, -d, --decode Output a clipboard entry by dmenu stdin
help Print this message or the help of the given subcommand(s)
$ clipdir store --help
Usage: clipdir {store|--store|-s} [OPTIONS]
Options:
--state <state>
[env: CLIPBOARD_STATE=] [default: data]
--storage-path <storage-path>
[env: CLIPDIR_STORAGE_PATH=] [default: /home/hashworks/.local/share/clipdir]
--byte-limit <byte-limit>
[env: CLIPDIR_BYTE_LIMIT=] [default: 5242880]
--dedupe-search-limit <dedupe-search-limit>
[env: CLIPDIR_DEDUPE_SEARCH_LIMIT=] [default: 1000]
Call this with your desktop environment: wl-paste --watch clipdir store
wl-paste will listen for changes to your clipboard and call clipdir store which will store the clipboard entry in the storage directory (~/.local/share/clipdir by default). If not specified otherwise it will store entries up to 5 MiB and search for duplicates in the last 1000 entries.
$ clipdir list --help
List clipboard entries prefixed with their id
Usage: clipdir {list|--list|-l} [OPTIONS]
Options:
--preview-length <preview-length>
[env: CLIPDIR_PREVIEW_LENGTH=] [default: 100]
--storage-path <storage-path>
[env: CLIPDIR_STORAGE_PATH=] [default: /home/hashworks/.local/share/clipdir]
Add a keyboard binding to your desktop environment to pipe the output of clipdir list to dmenu/rofi/fzf or whatever picker you use. Afterwards extract the clipboard entry with clipdir decode and pipe it to wl-copy to set the clipboard.
$ clipdir list | dmenu | clipdir decode | wl-copy
$ clipdir list | rofi -dmenu | clipdir decode | wl-copy
$ clipdir list | fzf --no-sort | clipdir decode | wl-copy
You can clean up the history by deleting files in the storage directory. Simply add one of the following commands as a systemd timer:
Delete files older than 365 days:
$ find ~/.local/share/clipdir -type f -mtime +365 -exec rm {} \;
Only keep the last 100,000 files:
$ find ~/.local/share/clipdir -type f | sort -r | tail -n +100001 | xargs -I {} rm {}
Use tools like syncthing to sync the storage directory across multiple devices.