Skip to main content

jupyterlab_terminal_clipboard_extension

GitHub Actions npm version PyPI version Total PyPI downloads JupyterLab 4 Brought To You By KOLOMOLO Donate PayPal

[!TIP] This extension is part of the stellars_jupyterlab_extensions metapackage. Install all Stellars extensions at once: pip install stellars_jupyterlab_extensions

Terminal programs running inside JupyterLab normally cannot copy anything to your clipboard. Tools like password managers, vim, tmux, and other TUI applications that rely on xclip or xsel fail silently because there is no X11 display in a browser-based terminal. This extension fixes that - when a terminal program copies something, it lands in your browser clipboard so you can paste it anywhere.

Features

  • OSC 52 clipboard interception - captures clipboard escape sequences from terminal output
  • Auto-installing shims - deploys xclip, xsel, wl-copy replacements to ~/.local/bin/ on startup when real tools are not functional (no display server)
  • Non-destructive install - only installs shims when the real tools cannot work, and never overwrites a clipboard tool it did not create

Installation

Requires JupyterLab 4.0.0 or higher.

pip install jupyterlab_terminal_clipboard_extension

Ensure ~/.local/bin is in your PATH for the shims to work:

export PATH="$HOME/.local/bin:$PATH"

Uninstall

pip uninstall jupyterlab_terminal_clipboard_extension

Technical Details

The extension has two components. The frontend plugin registers an OSC 52 parser handler on each terminal's xterm.js instance. When a terminal application writes \033]52;c;<base64>\a, the handler decodes the payload and writes it to the browser clipboard via navigator.clipboard.writeText() with a document.execCommand('copy') fallback for HTTP (non-secure) contexts.

The server plugin runs on JupyterLab startup and installs lightweight POSIX shell shims into ~/.local/bin/. These shims replace xclip, xsel, and wl-copy - the system clipboard tools that terminal programs call. Instead of talking to an X11 display, the shims base64-encode the input and emit an OSC 52 escape sequence to /dev/tty, which the frontend plugin then intercepts.

terminal app -> xclip/xsel (shim) -> OSC 52 escape sequence -> extension -> browser clipboard

Shims are only installed when the real tools cannot function (no DISPLAY or WAYLAND_DISPLAY environment variable set). If a real X11 or Wayland clipboard is available, the shims are not deployed and the original tools are preserved. An existing file in ~/.local/bin that is not one of our shims is never overwritten - the installer logs a warning and skips it, so a clipboard tool you placed there yourself stays intact.

Because OSC 52 only reaches the browser through the terminal, the shims write the escape sequence exclusively to /dev/tty. When a program calls them without a controlling terminal, they exit non-zero with a message on stderr rather than emitting the sequence to stdout, where it would corrupt the caller's output.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jupyterlab_terminal_clipboard_extension-1.0.7.tar.gz (287.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file jupyterlab_terminal_clipboard_extension-1.0.7.tar.gz.

File metadata

File hashes

Hashes for jupyterlab_terminal_clipboard_extension-1.0.7.tar.gz
Algorithm Hash digest
SHA256 f2e2f6fef1f40557ef1ec0d7a88c69515590b9a64218ae59761fed0687185c45
MD5 e02ae3f7a2fb9461375d03a4fffa01ed
BLAKE2b-256 81ffda040012995f393e4e60ea61eb648333f89e6fc7f8f5859aafd1ef1978b6

See more details on using hashes here.

File details

Details for the file jupyterlab_terminal_clipboard_extension-1.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for jupyterlab_terminal_clipboard_extension-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 71ee46bbab8e6e9c601fb5fec243d96b0493601a9ce9b3320373775aa432b27e
MD5 0ec44eab6a096e94fea0e394e0a362bd
BLAKE2b-256 ce39b7e533f66473b4f147a7eda4e11e8e95af2bfa7b3ca0f4a3cfddd99a9308

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.8

2 files

This release

1.0.7 This release

2 files

1.0.3

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page