Skip to content

Conversation

@pzim-devdata
Copy link
Contributor

Paste clipboard content into new documents with format selection

  • Paste rich formatted text (HTML, bold, colors, tables preserved)
  • Paste images from clipboard or copied files
  • 11 output formats (ODT, PDF, TXT, MD, JSON, YAML, CSV, PY, SH, ODS, ODG)
  • Smart filename suggestion based on content
  • GTK dialog for filename and format selection
  • Document created without auto-opening
  • Includes 21 language translations
  • Distinct from existing "paste-into-file" (text only)

Paste clipboard content into new documents with format selection

- Paste rich formatted text (HTML, bold, colors, tables preserved)
- Paste images from clipboard or copied files
- 11 output formats (ODT, PDF, TXT, MD, JSON, YAML, CSV, PY, SH, ODS, ODG)
- Smart filename suggestion based on content
- GTK dialog for filename and format selection
- Document created without auto-opening
- Includes 21 language translations
- Distinct from existing "paste-into-file" (text only)
@pzim-devdata
Copy link
Contributor Author

Description

Paste clipboard content directly into a new document from Nemo's context menu with multiple format options. Unlike the existing "paste-into-file" action which only creates plain text files, this action creates formatted LibreOffice documents and offers 11 different output formats.

Features

  • Rich text support: Preserves HTML formatting (bold, italic, colors, tables, lists, etc.)
  • Image support: Paste images from clipboard or copied image files
  • Multiple formats: 11 output formats available
    • Text/Code: TXT, Markdown, JSON, YAML, CSV, Python, Shell script
    • Documents: LibreOffice Writer (ODT), PDF, Calc (ODS), Draw (ODG)
  • Smart filename: Auto-suggests filename based on clipboard content
    • Copied file → original filename
    • Text/HTML → first 3-5 words
    • Image → image_YYYYMMDD_HHMMSS
  • Format selector: GTK dialog for choosing output format
  • No auto-open: Creates document without opening it
  • Current location: Document created where user right-clicked

Why this action is useful

The existing "paste-into-file" action only creates plain text files without formatting. This action fills the gap by:

  • Preserving rich text formatting when pasting from web browsers, word processors, etc.
  • Supporting images (both clipboard and file URIs)
  • Offering multiple professional document formats
  • Providing LibreOffice document creation directly from Nemo

Distinction from existing action

  • Existing: "paste-into-file" → plain text only (.txt)
  • This action: "Paste into Document (.odt)" → rich formatting + 11 formats

The (.odt) in the name clearly distinguishes it from the text-only action.

Technical Details

  • Python 3 with GTK 3 for dialogs
  • LibreOffice headless mode for document conversion
  • HTML clipboard support for rich formatting
  • Base64 encoding for images
  • Automatic executable permission for .sh files
  • Two-step conversion for complex formats (HTML → ODT → PDF)

Dependencies

  • python3 (pre-installed on most systems)
  • libreoffice (for document conversion)

Testing

Tested on Debian Cinnamon with:

  • Rich formatted text from Firefox, Chrome, LibreOffice Writer
  • Images from GIMP, screenshot tool, copied files
  • All 11 output formats verified
  • Long filenames and special characters handled correctly

Thank you to the Linux Mint team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant