Power User Tools

Scriptable Clipboard & Custom Actions

L2Cache lets you build your own custom Clipboard Actions using standard shell commands, ruby scripts, or AI Prompts. Scoped dynamically to target only specific content types.

Standard clipboard managers are passive filing cabinets. They store your copied strings but can't do anything with them. If you want to transform a clipboard item (e.g. format JSON, strip formatting, extract IDs), you are forced to paste it into a scratchpad app, modify it, and copy it back.

L2Cache makes your clipboard programmable. With Custom Shell Actions, you can run any tool that accepts standard input (stdin), processes it, and returns the output via standard output (stdout).

How Custom Shell Actions Work

When you create a custom action, you write a standard shell command. When you copy an item and trigger that action:

  1. L2Cache pipes the copied text directly into the standard input (stdin) of your shell script.
  2. Your shell script executes (using /bin/bash -c under the hood).
  3. L2Cache intercepts the output (stdout) and updates the clipboard copy with the formatted result.

💡 Accessing the clipboard text: Your command receives the clipboard string via standard input (stdin). You can read it directly in Ruby using STDIN.read, in Perl using default inputs, or inside bash/curl commands using $(cat) to pass it as a parameter.

Scoped Content Filtering

You don't want a "Format SQL" action cluttering your options when you copy an image or a URL. L2Cache lets you choose exactly which content types trigger your action:

11 Shell Action Recipes to Try

1. Send Clipboard JSON payload to Local Server (using Curl)
Applies to: JSON
curl -s -X POST -H "Content-Type: application/json" -d "$(cat)" http://localhost:3000/api/webhook
2. Generate Mock JSON from Field Names (using Ruby)
Applies to: Text. Copy a list of comma-separated fields (e.g. id, name, email, price, created_at) and generate mock JSON output instantly.
ruby -rjson -rtime -e '
  fields = STDIN.read.strip.split(/\s*,\s*|\s+/)
  mock = fields.each_with_object({}) do |f, h|
    h[f] = case f
    when /id/i; rand(1000..9999)
    when /email/i; "user@example.com"
    when /name/i; "John Doe"
    when /created_at|updated_at|date/i; Time.now.utc.iso8601
    when /status/i; "active"
    when /price|amount/i; rand(9.99..99.99).round(2)
    else; "mock_value"
    end
  end
  puts JSON.pretty_generate(mock)
'
3. Strip URL Tracking Parameters
Applies to: URL
ruby -ruri -e '
  uri = URI.parse(STDIN.read.strip)
  if uri.query
    params = URI.decode_www_form(uri.query).reject { |k,_| k.start_with?("utm_") }
    uri.query = params.empty? ? nil : URI.encode_www_form(params)
  end
  puts uri.to_s
'
4. Convert SQL Schema to JSON (using Ruby)
Applies to: SQL
ruby -rjson -e '
  sql = STDIN.read
  fields = sql.scan(/(\w+)\s+(VARCHAR|INT|TEXT|TIMESTAMP|DATETIME)/i)
  puts JSON.pretty_generate(fields.to_h.transform_values(&:downcase))
'
5. Share Log/Text to ix.io (returns a shareable URL)
Applies to: Text. ix.io is a command-line pastebin that takes text input and returns a short paste URL.
curl -s -F "f:1=$(cat)" ix.io
6. Unix Epoch Timestamp to Human Date (using Ruby)
Applies to: Text. Parse raw Unix epoch timestamps (seconds or milliseconds) and print them in local, UTC, and ISO 8601 formats.
ruby -rtime -e '
  val = STDIN.read.strip.to_i
  val = val / 1000 if val > 9999999999
  t = Time.at(val)
  puts "Local: #{t.strftime("%Y-%m-%d %H:%M:%S %Z")}"
  puts "UTC:   #{t.utc.strftime("%Y-%m-%d %H:%M:%S UTC")}"
  puts "ISO:   #{t.iso8601}"
'
7. Variable Case Switcher (using Ruby)
Applies to: Text. Automatically toggle variable names between camelCase and snake_case format depending on input.
ruby -e '
  str = STDIN.read.strip
  if str =~ /_/
    puts str.gsub(/_([a-z])/) { $1.upcase }
  else
    puts str.gsub(/([a-z\d])([A-Z])/, "\\1_\\2").downcase
  end
'
8. Convert CSV to Markdown Table (using Ruby)
Applies to: Text. Copy any standard CSV block and automatically convert it into a clean, formatted Markdown table structure.
ruby -rcsv -e '
  rows = CSV.parse(STDIN.read.strip)
  exit if rows.empty?
  headers = rows.first
  divider = headers.map { |h| "-" * [h.to_s.length, 3].max }
  puts "| " + headers.map(&:to_s).join(" | ") + " |"
  puts "| " + divider.join(" | ") + " |"
  rows[1..].each do |row|
    next if row.nil? || row.empty?
    puts "| " + row.map { |v| v.to_s.gsub("|", "\\|") }.join(" | ") + " |"
  end
'
9. HTML Special Entities Encoder (using Ruby)
Applies to: Text. Escape all HTML characters (like <, >, &) into their safe HTML entity representations.
ruby -rcgi -e 'puts CGI.escapeHTML(STDIN.read)'
10. Escape JSON Object to String Literal (using Ruby)
Applies to: JSON. Minify and escape a raw JSON object string to be used safely inside string literal parameters.
ruby -rjson -e 'puts JSON.dump(STDIN.read.strip)'
11. Redact Sensitive Keys in JSON (using Ruby)
Applies to: JSON. Recursively checks all keys in a JSON object and replaces values matching sensitive names (like passwords, keys, tokens, or emails) with "[REDACTED]".
ruby -rjson -e '
  def redact(obj)
    case obj
    when Hash
      obj.each_with_object({}) do |(k, v), h|
        if k.to_s =~ /password|secret|key|token|auth|email|card|phone/i
          h[k] = "[REDACTED]"
        else
          h[k] = redact(v)
        end
      end
    when Array
      obj.map { |v| redact(v) }
    else
      obj
    end
  end
  puts JSON.pretty_generate(redact(JSON.parse(STDIN.read)))
'

📋 Copy this sample payload to your clipboard to test the action:

{
  "user": "dinesh_dev",
  "email": "dinesh@example.com",
  "session": {
    "auth_token": "live_tok_9823fha8921fh",
    "expires_at": "2026-09-01T00:00:00Z"
  },
  "payment": {
    "card_number": "4111-2222-3333-4444",
    "amount_usd": 49.00
  },
  "config": {
    "debug_mode": true,
    "aws_secret": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
  }
}

Custom AI Prompt Actions

Beyond traditional shell scripts, L2Cache allows you to define Custom AI Prompts that execute locally (via Ollama) or via cloud (Anthropic, OpenAI) against your clipboard contents.

1. Generate TypeScript Interfaces from JSON
Applies to: JSON
Create a TypeScript interface for this JSON payload. Use proper typings and nested interfaces where appropriate.
2. Explain Complex CLI Commands
Applies to: Terminal Commands
Explain this bash command step-by-step and describe what each flag does in plain English.
3. Error Log Analysis
Applies to: Logs
Summarize this error log, explain the likely root cause, and suggest a fix. Keep it concise.
4. Code Vulnerability Check
Applies to: Code
Analyze this code snippet for security vulnerabilities, such as injection flaws or memory leaks, and suggest improvements.

Local by Default, External Only When You Choose

Custom Shell Actions execute locally on your Mac. Commands that use local scripts, command-line tools, or localhost services can process clipboard content without sending it to a cloud service. If you create and invoke an action that calls an external API, webhook, or cloud LLM, that command sends the selected clipboard content to the endpoint you configured. Review the destination and its privacy policy before transmitting sensitive or proprietary data.

Looking for practical ideas? Explore these developer clipboard automation workflows for testing local APIs, replaying webhooks, querying developer tools, and invoking services you choose.