Giter VIP home page Giter VIP logo

cliphist's Introduction

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 (dmenu mode)

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

rofi (custom mode)

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

(requires contrib/cliphist-rofi)

rofi (custom mode with images)

rofi -modi clipboard:/path/to/cliphist-rofi-img -show clipboard -show-icons

(requires contrib/cliphist-rofi-img)

wofi

cliphist list | wofi -S dmenu | cliphist decode | wl-copy

Example config for sway:

exec wl-paste --watch cliphist store
bindsym Mod1+p exec cliphist list | wofi -S 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

cliphist's People

Contributors

sentriz avatar mtvrsh avatar kkga avatar jdrowell avatar mathew-d avatar sonico98 avatar jones-josh avatar nxnjz avatar

Forkers

mechatour

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.