Skip to main content
Version: 1.4

Clipboard Manager


██████╗██╗     ██╗██████╗ ██████╗  ██████╗  █████╗ ██████╗ ██████╗
██╔════╝██║     ██║██╔══██╗██╔══██╗██╔═══██╗██╔══██╗██╔══██╗██╔══██╗
██║     ██║     ██║██████╔╝██████╔╝██║   ██║███████║██████╔╝██║  ██║
██║     ██║     ██║██╔═══╝ ██╔══██╗██║   ██║██╔══██║██╔══██╗██║  ██║
╚██████╗███████╗██║██║     ██████╔╝╚██████╔╝██║  ██║██║  ██║██████╔╝
╚═════╝╚══════╝╚═╝╚═╝     ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚═╝  ╚═╝╚═════╝

The dms cl command provides a Wayland clipboard manager with history, search, and other configurable knobs. It uses the ext_data_control_v1 protocol for clipboard access.

Overview

CommandRequires ServerDescriptiondms cl copy [text]NoCopy text to clipboard (reads stdin if no arg)dms cl pasteNoPaste clipboard contents to stdoutdms cl watch [cmd]NoWatch clipboard changes, optionally pipe to commanddms cl historyYesList clipboard history with previewsdms cl get <id>YesGet full entry data by IDdms cl delete <id>YesDelete history entry by IDdms cl clearYesClear all clipboard historydms cl search [query]YesSearch history with filtersdms cl config getYesGet current configdms cl config setYesUpdate config options

Quick Start

# Copy text to clipboard
echo "hello" | dms cl copy
dms cl copy "hello world"

# Paste clipboard contents
dms cl paste

# View clipboard history
dms cl history

# Search history
dms cl search "password"

Commands

dms cl copy [text]

Copies data to the Wayland clipboard. Forks a background process by default to serve paste requests.

dms cl copy [text] [flags]

Arguments:

Flags:

Examples:

# Copy string directly
dms cl copy "Hello, world!"

# Copy from stdin
echo "piped content" | dms cl copy

# Copy file contents
dms cl copy < file.txt

# Copy image with MIME type
dms cl copy -t image/png < screenshot.png

# One-shot copy (clipboard cleared after first paste)
dms cl copy -o "temporary secret"

# Download image from URL to clipboard
dms cl copy --download "https://example.com/image.png"

Download Mode

The --download flag fetches a file from a URL and copies it to the clipboard as text/uri-list. This works with both native apps and sandboxed Flatpaks.

dms cl copy --download "https://example.com/photo.jpg"

How it works:

  1. Downloads the URL to ~/.cache/dms/clipboard/
  2. Validates the content is an image or video
  3. Offers two MIME types to the clipboard:

Portal support: When available, the XDG Desktop Portal's FileTransfer interface lets sandboxed Flatpak apps access the downloaded file securely. If the portal isn't running, only native apps will work.

dms cl paste

Reads current clipboard selection and writes to stdout.

dms cl paste

Examples:

# Paste to terminal
dms cl paste

# Paste to file
dms cl paste > output.txt

# Pipe to another command
dms cl paste | wc -l

dms cl watch [command]

Watches for clipboard changes. Without arguments, prints changes to stdout.

dms cl watch [command] [flags]

Arguments:

Flags:

Examples:

# Print clipboard changes to stdout
dms cl watch

# Pipe each clipboard change to a command
dms cl watch notify-send

# Output as JSON
dms cl watch --json

# Store to history without running the server
dms cl watch --store

JSON output format:

{"data": "clipboard content", "mimeType": "text/plain", "timestamp": 1699900000, "size": 17}

dms cl history

Lists history entries with ID, type, timestamp, and preview. Requires the DMS server.

dms cl history [flags]

Flags:

Example output:

ID Type Timestamp Preview
─────────────────────────────────────────────────────────────
1 text/plain 2024-01-15 10:30:00 Hello, world!
2 image/png 2024-01-15 10:31:00 [image 1920x1080]
3 text/plain 2024-01-15 10:32:00 Some longer text that gets trunca...

dms cl get <id>

Retrieves full entry data by ID. Outputs raw data by default.

dms cl get <id> [flags]

Arguments:

Flags:

Examples:

# Get raw data
dms cl get 42

# Get as JSON
dms cl get 42 --json

# Save image to file
dms cl get 42 > image.png

dms cl delete <id>

Delete a history entry by ID. Requires the DMS server.

dms cl delete <id>

dms cl clear

Clear all clipboard history. Requires the DMS server.

dms cl clear

dms cl search [query]

Search history with text matching and filters. Requires the DMS server.

dms cl search [query] [flags]

Arguments:

Flags:

Examples:

# Search for text
dms cl search "password"

# Find all images
dms cl search --images

# Find text entries containing "http"
dms cl search --text "http"

# Paginate results
dms cl search --limit 10 --offset 20

# Filter by MIME type
dms cl search -m "image/png"

Configuration

dms cl config get

Get current clipboard manager configuration as JSON.

dms cl config get

dms cl config set

Update configuration options.

dms cl config set [flags]

Flags:

Examples:

# Set max history to 500 entries
dms cl config set --max-history 500

# Auto-clear entries older than 7 days
dms cl config set --auto-clear-days 7

# Disable history persistence
dms cl config set --disable-history

# Clear history on each startup
dms cl config set --clear-at-startup

Configuration File

Settings are stored at $XDG_CONFIG_HOME/DankMaterialShell/clsettings.json (defaults to ~/.config/DankMaterialShell/clsettings.json).

Configuration Options

FieldTypeDefaultDescriptiondisabledboolfalseDisable clipboard manager entirelydisableHistoryboolfalseDon't persist clipboard to databasemaxHistoryint100Max entries to keep in historymaxEntrySizeint10485760Max single entry size in bytes (10MB)autoClearDaysint0Auto-delete entries older than N days (0 = disabled)clearAtStartupboolfalseClear history when server starts

JSON schema:

{
"disabled": false,
"disableHistory": false,
"maxHistory": 100,
"maxEntrySize": 10485760,
"autoClearDays": 0,
"clearAtStartup": false
}

IPC Methods

For programmatic access, the clipboard manager exposes JSON-RPC methods over the DMS IPC socket.

MethodParamsDescriptionclipboard.getHistorynoneGet all history entriesclipboard.getEntry{id: uint64}Get entry by IDclipboard.deleteEntry{id: uint64}Delete entry by IDclipboard.clearHistorynoneClear all historyclipboard.search{query?, limit?, offset?, mimeType?, isImage?}Search historyclipboard.getConfignoneGet current configclipboard.setConfigconfig fieldsUpdate config

Example IPC call:

dms ipc call clipboard.search '{"query": "hello", "limit": 10}'

Command Reference

dms cl [command] [flags]

Available Commands:

Global Flags: