A tmux plugin to save an image from your clipboard to a file and paste the file path directly into your pane.
Perfect for command-line tools that require image file paths, especially in a tiling window manager workflow (like i3wm, Sway, etc.). Also includes special support for Claude Code to work around terminal emulators that don't support image pasting (like Alacritty).
- Saves the current image in your clipboard as a
.pngfile. - Automatically pastes the full, quoted path of the new file into the current tmux pane.
- Smartly detects whether to use
xclip(X11) orwl-paste(Wayland). - Claude Code Integration: Automatically detects Claude Code sessions and uses the
/imagecommand for proper image attachment. - Configurable keybinding and save path.
You must have one of the following clipboard tools installed:
xclip(for X11)wl-pastefromwl-clipboard(for Wayland)
Installation (Debian/Ubuntu):
sudo apt update && sudo apt install xclip
Installation (Arch Linux):
sudo pacman -S xclip
With Tmux Plugin Manager (recommended)
-
Add the plugin to your list of TPM plugins in
.tmux.conf:set -g @tpm_plugins ' \ tmux-plugins/tpm \ jkhas/tmux-paste-image \ '
-
Press
prefix+Ito fetch the plugin and source it. You're ready to go!
- Clone the repository:
git clone [https://github.com/your-github-username/tmux-paste-image](https://github.com/your-github-username/tmux-paste-image) ~/.config/tmux/plugins/tmux-paste-image - Add this line to the bottom of your
.tmux.conf:run-shell ~/.config/tmux/plugins/tmux-paste-image/paste-image.tmux - Reload the tmux environment:
tmux source-file ~/.tmux.conf
- Take a screenshot using any tool (like Flameshot, Grim, etc.).
- Copy the screenshot to your clipboard (e.g.,
Ctrl+Cin Flameshot). - Switch to your tmux window.
- Press
prefix+P(or your custom key). - The file path will be pasted into your command line, ready to be used.
If you're using terminal emulators like Alacritty that don't support direct image pasting, this plugin provides a seamless workaround for Claude Code:
- Take a screenshot and copy it to your clipboard.
- In your Claude Code session, press
prefix+P. - The plugin automatically detects Claude Code and uses the
/imagecommand to properly attach the image. - Your image will be sent to Claude for analysis.
This feature was specifically developed to solve the limitation where Alacritty users cannot paste images directly into Claude Code using Ctrl+Shift+V.
You can customize the plugin by setting these options in your .tmux.conf. Make sure you set them before you initialize TPM.
# Change the keybinding from 'p' to 'i'
set -g @paste-image-key 'i'
# Change the default save location for the images
set -g @paste-image-path '~/Pictures/clipboard-pastes'
# Your TPM list
set -g @tpm_plugins ' \
# ... other plugins
your-github-username/tmux-paste-image \
'The plugin operates in two modes:
-
Standard Mode: For regular command-line applications, it saves the clipboard image and pastes the file path.
-
Claude Code Mode: When it detects you're in a Claude Code session (by checking for the › prompt), it automatically uses Claude's
/imagecommand to properly attach the image file. This is particularly useful for Alacritty users who cannot directly paste images.
This plugin was created to solve a specific problem: Modern terminal emulators like Alacritty don't support image pasting through traditional methods (Ctrl+Shift+V). This becomes problematic when using CLI tools like Claude Code that benefit from image input. This tmux plugin bridges that gap by:
- Capturing images from your system clipboard
- Saving them to disk with organized timestamps
- Intelligently detecting the context and pasting appropriately
- Providing a consistent keybinding across all terminal applications
MIT
