Source at the Bit Powder Gitea
sshboard (formaly known as clippy) is a tool to interact with your desktop environment from a remote SSH sessions: share clipboard contents, open URLs and show notifications on your desktop. This way, your remote neovim session can paste directly from your clipboard, and yanking in a remote session will end up in your local clipboard manager (e.g. clipmenu). sshboard
uses the SSH connection (specifically UNIX domain socket forwarding), so the clipboard contents are encrypted during transmission.
sshboard
uses the SSH connection (specifically UNIX domain socket forwarding), so the clipboard contents are encrypted during transmission. Because it uses private UNIX domain sockets, instead of open port forwards like lemonade
, the security on shared servers is improved as only the current user can share the link to the desktop.
If no remote session is found, the local clipboard is used. There is some custom support to handle tmux sessions, so that reconnecting to a tmux session won't break your clipboard interactions.
Integrates with:
Linux/FreeBSD clipboard (for X11 needs package
xsel
, for Wayland needs packagewl-clipboard
);Android clipboard if run in Termux;
Windows clipboard if run under WSL;
macOS clipboard.
Installation
For FreeBSD, Debian, and Raspbian, add the bitpowder repository. See the instructions on that repository page.
For macOS:
brew tap bitpowder/indigo-ng https://gitea.bitpowder.com/bitpowder/indigo-ng.git
brew install --HEAD bitpowder/indigo-ng/sshboard
Update with brew reinstall bitpowder/indigo-ng/sshboard
.
To build the project from the source, you need cmake and a Rust compiler:
cargo build --release
Usage
sshboard
should be installed on both the client and the server. Use sshboard ssh
instead of ssh
to connect to remote computers. sshboard
set some additional options automatically for ssh.
If no sshboard daemon is running, it automatically starts a sshboard daemon that listens on a UNIX domain socket named /tmp/clipboard.username.something
, which is forwarded through SSH.
Commands:
sshboard ssh
to set up a sshboard ssh connection to a different host;sshboard get
to retrieve the clipboard contents;echo contents | sshboard set
to set the clipboard;sshboard notification [summary] [body]
to show a notification.sshboard openurl [url]
to open an URL in your default browser.
If you execute these commands locally, they also work. Making them suitable for integration in generic config files used both for a server and a client.
Set up for specific programs
Some software needs custom config options. Setup depends on the software you are using:
sshd (on some platforms set automatically)
On modern Debian (>= bullseye), Ubuntu (>= focal), and Raspbian (>= bullseye), these settings are automatically included when you install sshboard
.
Your sshd_config
on the server should have:
StreamLocalBindUnlink yes
AcceptEnv LC_SSHBOARD
On Linux add Include /etc/ssh/sshd_config.d/*
to your /etc/ssh/sshd_config
.
On FreeBSD add Include /usr/local/etc/ssh/sshd_config.d/*
to your /etc/ssh/sshd_config
.
tmux
Use with tmux-yank
(in ~/.tmux.conf
):
# move x clipboard into tmux paste buffer
bind ] run "tmux set-buffer \"$(sshboard get)\"; tmux paste-buffer"
set -g @override_copy_command 'sshboard set'
set-option -g -a update-environment "LC_SSHBOARD"
set-option -g -a update-environment "DISPLAY"
set-option -g -a update-environment "WAYLAND_DISPLAY"
The basic version, without any plugins (in ~/.tmux.conf
):
bind ] run "tmux set-buffer \"$(sshboard get)\"; tmux paste-buffer"
# move tmux copy buffer into x clipboard
bind -T copy-mode-vi y run "tmux save-buffer - | sshboard set"
bind -T copy-mode-emacs y run "tmux save-buffer - | sshboard set"
set-option -g -a update-environment "LC_SSHBOARD"
set-option -g -a update-environment "DISPLAY"
set-option -g -a update-environment "WAYLAND_DISPLAY"
neovim
In .config/nvim/init.vim
:
set clipboard+=unnamed,unnamedplus
let g:clipboard = {
\ 'name': 'sshboard_remote_clipboard',
\ 'copy': {
\ '+': 'sshboard set',
\ '*': 'sshboard set',
\ },
\ 'paste': {
\ '+': 'sshboard get'
\ '*': 'sshboard get',
\ },
\ 'cache_enabled': 0,
\ }
For more custom neovim
clipboard settings, see :help g:clipboard
.