MyNixOS website logo
Description

Simple clipboard manager to be integrated with rofi.

Simple clipboard manager to be integrated with rofi - Please see README.md

logo

Description

Recycle your clipboard selections with greenclip and don't waste your time anymore to reselect things over and over.

Purpose: Keeps track of your history of selections to quickly switch between them

Demo:Video Link
Video made by @gotbletu

Features:

  • Integrated with rofi
  • Permanently set some selections to added at the end (set static_history = [] in the config file)
  • Merge X Primary selection with clipboard selection (set use_primary_selection_as_input = true in the config file)
  • Blacklist some applications (see I want to blacklist some applications ! in the FAQ section)
  • Copy small images (you can disable it in the config)

Installation

  • It's a static binary so drop it anywhere in your $PATH env

wget https://github.com/erebe/greenclip/releases/download/v4.2/greenclip

  • Alternatively if you are using Archlinux you can install the package from AUR

yay rofi-greenclip

PS: If you want, you can add a permanent list of selections to be added to your current history. Go see the config file

Configuration file can be found at:

❯ cat ~/.config/greenclip.toml

[greenclip]
  history_file = "/home/erebe/.cache/greenclip.history"
  max_history_length = 50
  max_selection_size_bytes = 0
  trim_space_from_selection = true
  use_primary_selection_as_input = false
  blacklisted_applications = []
  enable_image_support = true
  image_cache_directory = "/tmp/greenclip"
  static_history = [
 '''¯\_(ツ)_/¯''',
]

Usage

Greenclip is intended to be used with rofi

  1. Spawn the daemon greenclip daemon
  2. When ever you need to get your selections history rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'
  3. The entry that you have selected will be in your clipboard now
  4. Configuration file can be found in .config/greenclip.toml

Migrating from 2.x version to 3.x one

  1. Kill all greenclip process already running
  2. Delete your old config file and old cache file (in ~/.cache/greenclip*)
  3. Start the new version of greenclip

Building the project

  1. Get stack for Haskell
  2. stack init && stack install

or you can look at the .travis.yml file

FAQ

Q. Greenclip does not copy selection !

A. Greenclip cannot run alongside other clipboard manager. If you have already one activated (there is one by default in KDE), you have first to disable it before trying to run greenclip


Q. I cannot paste images !

A. You can only keep in your history small images (~ <500 kb). I disabled the support for bigger images as it will turn your CPU into a heater for winter.


Q. I want to blacklist some applications !

A. There is in your config file a section for blacklisting applications. You can run greenclip daemon in a terminal to find what is the name of the application who has the current selection. Be aware that a lot of application does not name their clipboard process/window, so it will be empty most of the time. Be aware also, that if you use an electron application (like slack i.e) you will get a generic name like "Chromium clipboard"


Q. I want to paste selection directly after selecting them !

A. This is not possible as when you invoke rofi, you lose focus of your current window and there is no way to find it back (from greenclip point of view)

Nonetheless, you can emulate the feature with xdotool rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}' ; sleep 0.5; xdotool type $(xclip -o -selection clipboard)

or look at this issue for a more complete solution https://github.com/erebe/greenclip/issues/27


Q. I got a strange behavior when clearing the clipboard - greenclip clear

A. The command is not doing what it is supposed to do, if greenclip's daemon is running. You need to stop it first.

Use this command to clear the history pkill greenclip && greenclip clear && greenclip daemon &

For more information regarding why, refer to https://github.com/erebe/greenclip/issues/34


Q. I need multi-line text in staticHistory

A. https://github.com/erebe/greenclip/issues/78


Q. I don't want to use rofi !

A. You can also use greenclip with dmenu or fzf. Example usage:

greenclip print | grep . | dmenu -i -l 10 -p clipboard | xargs -r -d'\n' -I '{}' greenclip print '{}'
greenclip print | grep . | fzf -e | xargs -r -d'\n' -I '{}' greenclip print '{}'

Q. I want to thank you for greenclip !

A. Give a star to this repository.

Metadata

Version

4.2.0

Executables (1)

  • bin/greenclip

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows