• Stars
    star
    161
  • Rank 233,470 (Top 5 %)
  • Language
    Go
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

wayland clipboard manager

cliphist

clipboard history β€œmanager” for wayland

  • write clipboard changes to a history file
  • recall history with dmenu / rofi / wofi (or whatever other picker you like)
  • both text and images are supported
  • clipboard is preserved byte-for-byte
    • leading / trailing whitespace / no whitespace or newlines are preserved
    • won’t break fancy editor selections like vim wordwise, linewise, block mode
  • no concept of a picker, only pipes

requires: go, wl-clipboard, xdg-utils (for image mime inferance)


install

  • you could try using your distro's repos if it's available there
  • or stick a static binary from the releases page somewhere in your $PATH
  • or just install it from source with go and $ go install go.senan.xyz/cliphist@latest

usage

listen for clipboard changes

$ wl-paste --watch cliphist store
this will listen for changes on your primary keyboard and write it to the history.
call it once per session - for example in your sway config

select old item

$ cliphist list | dmenu | cliphist decode | wl-copy
bind it to something nice on your keyboard

delete old item

$ cliphist list | dmenu | cliphist delete
or else query manually
$ cliphist delete-query "secret item"

clear database

$ cliphist wipe


picker examples

dmenu

cliphist list | dmenu | cliphist decode | wl-copy

fzf

cliphist list | fzf | cliphist decode | wl-copy

rofi

rofi -modi clipboard:/path/to/cliphist-rofi -show clipboard with contrib/cliphist-rofi

rofi dmenu mode

cliphist list | rofi -dmenu | cliphist decode | wl-copy


faq

why do i have numbers in my picker? can i get rid of them?

it's important that a line prefixed with a number is piped into cliphist decode. this number is used to lookup in the database the exact original selection that you made, with all leading, trailing, non printable etc whitespace presevered. none of that will not be shown in the preview output of cliphist list

since the format of cliphist list is "<id>\t<100 char preview>", and most pickers consider "\t" to be column seperator, you can try to just select column number 2

# fzf
cliphist list | fzf -d $'\t' --with-nth 2 | cliphist decode | wl-copy
# rofi
cliphist list | rofi -dmenu -display-columns 2 | cliphist decode | wl-copy
# wofi
# it kind of works but breaks with quotes in the original selection. i recommend not trying to hide the column with wofi
cliphist list | wofi --dmenu --pre-display-cmd "echo '%s' | cut -f 2" | cliphist decode | wl-copy
how do i narrow down the items that are copied to cliphist, or always copy images from my browser?

it's also possible to run wl-paste --watch several times for multiple mime types

for example in your window manager's startup you could run

wl-paste --type text --watch cliphist store
wl-paste --type image --watch cliphist store

now you should have text and raw image data available in your history. make sure you have xdg-utils installed too


packaging


video

bone.mp4

More Repositories

1

gonic

music streaming server / subsonic server API implementation
Go
1,062
star
2

betanin

beets based mitm of your torrent client and music player
Python
322
star
3

fish-pipenv

🐟🐍 a fish plugin that automatically activates the pipenv subshell
Shell
200
star
4

wlr-sunclock

wayland desktop widget to show to the sun's shadows on earth
C
44
star
5

vim-print-debug

assisted printf debugging for vim
Vim Script
38
star
6

dotfiles

my dotfiles
Shell
18
star
7

standardnotes-extensions

auto updating extensions for your standardnotes server
Go
17
star
8

socr

screenshot OCR server
Go
11
star
9

socr-cli

searchable auto generated screenshot ocr database
Python
9
star
10

compose-status

simple home server status page, compose and traefik aware
Go
8
star
11

wl-gammactld

a daemon for wl-gammactl
Shell
7
star
12

bandcamp_downloader

a python 3+ script for downloading, renaming, and tagging albums from Bandcamp
Python
6
star
13

vi-pipe

edit text in the middle of a shell pipeline, and store a diff to replay changes after further invocations
Go
5
star
14

hexchat_python_addons

a python 3+ collection of HexChat addons
Python
5
star
15

reboodt

a python 3+ IRC bot
Python
4
star
16

cliphist-sh

wayland clipboard manager
Shell
4
star
17

rsl

reserialise: lossy but versatile conversion between data serialisation formats
Go
3
star
18

honk-docker

docker image for honk
Dockerfile
3
star
19

nvim-lsp-compose

compose language servers, and formatters / linters via efm in a language * feature matrix
Lua
2
star
20

beside

unix pipeline stage with before and after preview
Go
1
star
21

go-filelock

Go
1
star
22

log-proxy

a reverse proxy to a single address, logging request and response bodies
Go
1
star
23

xyz

personal jekyll website
Sass
1
star