Skip to content

rhafaelcm/thumbnail_cdr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CDR Thumbnail (CorelDRAW) Generator for GNOME

Thumbnailer for the GNOME desktop environment that displays thumbnails for CorelDRAW (.cdr) files in the file manager (Nautilus/Files).

It works by extracting the embedded thumbnail that already exists inside the .cdr file (which is actually a ZIP archive in versions X4+).

Features

  • Extracts embedded thumbnails from .cdr files (tries multiple internal paths: previews/thumbnail.png, preview.png, metadata/thumbnails/thumbnail.png).
  • Optionally resizes the thumbnail to the requested size if ImageMagick is installed.
  • Integrates with GNOME to display thumbnails in the file manager.

Dependencies

  • Bash: Script interpreter.
  • unzip: To extract the thumbnail from the .cdr file. Install with sudo apt install unzip if needed.
  • GNOME Desktop Environment: Required for thumbnailer integration (Nautilus/Files).
  • ImageMagick (optional): To resize thumbnails. Install with sudo apt install imagemagick.

Installation

First, make the scripts executable:

chmod +x install.sh uninstall.sh

Then run the installer:

./install.sh

The script will:

  1. Check that unzip is installed.
  2. Copy cdr-thumbnailer.sh to /usr/bin/ and make it executable (requires sudo).
  3. Copy cdr.thumbnailer to ~/.local/share/thumbnailers/.
  4. Update the paths in the .thumbnailer file.

Note: The thumbnailer script must be installed in /usr/bin/ because GNOME 43+ runs thumbnailers inside a bubblewrap (bwrap) sandbox that only has access to /usr, /lib, and /lib64. Scripts in ~/.local/bin/ are not accessible inside the sandbox.

After installation, clear the thumbnail cache and restart Nautilus:

rm -rf ~/.cache/thumbnails/*
nautilus -q

Uninstallation

./uninstall.sh

After uninstalling, clear the cache and restart Nautilus:

rm -rf ~/.cache/thumbnails/*
nautilus -q

Manual Installation

If you prefer to install manually:

  1. Copy the script to /usr/bin/ and make it executable:
sudo cp cdr-thumbnailer.sh /usr/bin/
sudo chmod +x /usr/bin/cdr-thumbnailer.sh
  1. Create the thumbnailers directory (if it doesn't exist) and copy the configuration file:
mkdir -p ~/.local/share/thumbnailers
cp cdr.thumbnailer ~/.local/share/thumbnailers/
  1. Update the paths in the .thumbnailer file:
sed -i "s|^TryExec=.*|TryExec=/usr/bin/cdr-thumbnailer.sh|" ~/.local/share/thumbnailers/cdr.thumbnailer
sed -i "s|^Exec=.*|Exec=/usr/bin/cdr-thumbnailer.sh %i %o %s|" ~/.local/share/thumbnailers/cdr.thumbnailer
  1. Clear the cache and restart Nautilus:
rm -rf ~/.cache/thumbnails/*
nautilus -q

How It Works

GNOME uses .thumbnailer files in ~/.local/share/thumbnailers/ (user-level) or /usr/share/thumbnailers/ (system-level) to generate thumbnails.

The cdr.thumbnailer file specifies:

  • MimeType: MIME types for CorelDRAW files (application/x-cdr, application/vnd.corel-draw, image/x-cdr, image/cdr, application/x-vnd.corel.zcf.draw.document+zip).
  • TryExec: Path to the script. The system checks if it exists before using it.
  • Exec: Command executed by GNOME. %i = input file, %o = output file, %s = requested size.

The cdr-thumbnailer.sh script receives these arguments, attempts to extract a thumbnail from the .cdr (ZIP) file trying multiple possible paths, and optionally resizes it with ImageMagick.

GNOME 43+ runs external thumbnailers inside a bubblewrap (bwrap) sandbox for security. The sandbox only mounts /usr, /lib, and /lib64 as read-only, which is why the script must be installed in /usr/bin/.

Troubleshooting

  • Thumbnails not showing:

    • Check that unzip is installed: which unzip
    • Verify the paths in ~/.local/share/thumbnailers/cdr.thumbnailer are correct.
    • Check that cdr-thumbnailer.sh is executable: ls -la /usr/bin/cdr-thumbnailer.sh
    • Clear the cache: rm -rf ~/.cache/thumbnails/* and restart: nautilus -q
    • Check logs: journalctl --user -b | grep -i thumb
  • Manual script test:

/usr/bin/cdr-thumbnailer.sh /path/to/file.cdr /tmp/test.png 256

Contributing

Feel free to open issues or pull requests if you find problems or have suggestions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages