• Stars
    star
    206
  • Rank 190,504 (Top 4 %)
  • Language
    Python
  • Created over 4 years ago
  • Updated 4 months ago

Reviews

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

Repository Details

Cross platform clipboard | networkless! remote copy

Isomorphic Copy

Cross platform clipboard.

Both remote and local

Works out of the 📦 with most programs that use pbcopy, xclip, wl-copy, etc.

Works the same locally as over SSH, inside Docker containers, et al.

It even works inside Docker over SSH and then inside Docker!, infinitely chainable.

clippy


Networkless

isomorphic-cp communicates by stdio and unix socket only!

All it does is spawn subprocesses and listen to IO.

This makes it amazingly versatile.

diagram


Daemonless

You literally just run cssh <ssh-args> or cdocker <container-name>.

No local daemon required. The remote "daemon" is just a subprocess of a subprocess. Zero cost when you are not using it.


How to use

Requires xclip or wl-clipboard under GUI linux.

Clone this repo to the same location on two machines. Either relative to ~ or /.

Prepend isomorphic-copy/bin to your PATH for example:

export PATH="$XDG_CONFIG_HOME/isomorphic-copy/bin:$PATH" in your bash/zshrc file.

You need to do this on both local and remote.

--

Automatically most applications that use xclip, wl-clipboard, pbcopy and so forth will use isomorphic-copy with zero setup.

Works just like python virtualenv!

--

I added two convenience functions:

You don't have to use these. Things like pbcopy and pbpaste will continue to work.

echo <my message> | c Use c to copy to system clipboard

p > my_message.txt Use p to paste from system clipboard

--

Connect to remote with one of

cssh <ssh-args>

cdocker <docker container name>

Once daemon is launched, remote copy will propagate to local system clipboard.

Remote applications that use xclip, pbcopy, wl-copy will propagate to local system clipboard.

--

Local -> SSH -> Docker

If you want to copy from a Docker container on a remote machine.

from local run cssh <ssh-args> to remote

from remote run cdocker <container name / sha> to container

And you are set!

Integrations

Tmux

Copy will automatically propagate to local / remote tmux clipboard.

If daemon is run under tmux, copy will also propagate to the local tmux clipboard.

If no system clipboard is available, copy / paste will use tmux clipboard.

Copying FROM tmux will require this snippet.

set -g mouse on

bind -T copy-mode MouseDragEnd1Pane \
  send-keys -X stop-selection

bind -T copy-mode MouseDown1Pane \
  select-pane \;\
  send-keys -X copy-pipe "c" \;\
  send-keys -X clear-selection

Drag to select, click in dragged area to copy.

Replace copy-mode with copy-mode-vi if you are using vi emulation.

Vim

Neovim will only use xclip if the x11 environmental variable DISPLAY is set.

Vim will require an autocmd event.

Add this snippet to your vimrc, to work for both vims.

if has('nvim')
  " use unnamedplus only! or else will double set
  set clipboard=unnamedplus
  if getenv('DISPLAY') == v:null
    exe setenv('DISPLAY', 'FAKE')
  endif
else
  autocmd TextYankPost * call system("c", getreg('"'))
endif

Others

Most CLI applications will work out of the box. (such as lazygit, for example).

If not, check if they require DISPLAY like Neovim.

Fallback

If no system / tmux clipboard is found, setting environmental variable ISOCP_USE_FILE=1 will enable using a temp file as a crude clipboard.

It will write inside the git repo, put it somewhere safe.

More Repositories

1

coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
Python
3,435
star
2

sad

CLI search and replace | Space Age seD
Rust
1,681
star
3

chadtree

File manager for Neovim. Better than NERDTree.
Python
1,618
star
4

noact

Minimalist React (< 70 lines)
TypeScript
317
star
5

lua-async-await

Async Await in 90 lines of code.
Lua
309
star
6

gay

Colour your text / terminal to be more gay. 🏳️‍🌈
Python
305
star
7

kde-in-docker

So you can run KDE inside a browser
Dockerfile
109
star
8

docker-time-machine

Zero Configuration, time machine for MacOS | Docker 🐳
Shell
83
star
9

markdown-live-preview

markdown live preview | works with any editor
Python
73
star
10

windows-in-docker

Manage Windows in Docker (easy)
Python
61
star
11

coq.thirdparty

Module lua sources for `coq.nvim`, first & third party
Lua
61
star
12

windows-in-docker-old

WHY? So you can run Windows "as a container"
Shell
51
star
13

nvim_rc

Python
49
star
14

simple-traefik-dash

Zero conf service dashboard for Traefik v2 Ingress Controller
F#
33
star
15

sync-dockerhub-readme

Github action to sync <readme.md> to Dockerhub
Python
22
star
16

simple-traefik-identity

Simple & Configurable -- single sign-on auth, for Traefik.
F#
22
star
17

coq.artifacts

Python
16
star
18

docker-home-router

Python
13
star
19

vim.bench

Reproducible nvim completion framework benchmarks.
Python
13
star
20

vim.conf-2023

SCSS
10
star
21

download-windows-iso

Python script to download official windows iso
Python
9
star
22

pynvim_pp

Python
8
star
23

snips

Vim Snippet
7
star
24

tmux_rc

Python
6
star
25

forechan

Go style CSP for Python
Python
6
star
26

lab

We have cloud at home - mom
Shell
6
star
27

kaleidoscope

Interactive & arbitrary Chaos Game fractal visualization tool
TypeScript
5
star
28

vim.benchmarks

5
star
29

nda

NPM - Domain Agnostic :: use with NPM dependency manager
TypeScript
5
star
30

nodebook-docker

Docker in Docker version of Nodebook (multilang repl)
Dockerfile
5
star
31

shell_rc

Shell
5
star
32

simple-markdown-showcase

Responsive personal portfolio pages using Github APIs.
Python
5
star
33

bing-daily-images

A docker container that downloads bing daily images for you.
Python
4
star
34

simple-reeducks

Minimalist Classless Redux in Swift
Swift
4
star
35

auto-github-push

Github action to refresh various Github inactivity countdowns.
Python
4
star
36

sortd

sorting commands for stdin -> stdout
Python
4
star
37

ms-jpq

4
star
38

iterm2

Python
3
star
39

ms-jpq.github.io

https://ms-jpq.github.io
HTML
3
star
40

std2

Python
3
star
41

vim.conf

TeX
3
star
42

defcon604-2023

Shell
2
star
43

emacs_rc

Emacs Lisp
2
star
44

fda

Fsharp - Domain Agnostic :: use with Paket dependency manager
F#
2
star
45

py-dev

Python
2
star
46

deb

2
star
47

kaleidoscope-page

Page for Kaleidoscope
HTML
1
star
48

languagetool-cli

Python
1
star
49

homebrew-sad

Ruby
1
star
50

cda

SASS - Domain Agnostic :: use with NPM dependency manager
SCSS
1
star
51

noact-page

Page for Noact
CSS
1
star
52

deb-src

PPA builder, hosted on Github pages
Makefile
1
star
53

mol

Minimal hardware accelerated `curl -- linux.iso | qemu-system-aarch64` scripts.
Shell
1
star