Thumbnailer for the GNOME desktop environment that displays thumbnails for PLT (.plt) and HP-GL (.hpgl) files in the file manager (Nautilus/Files).
This tool uses plotconvert to rasterize vector plot files into PNG thumbnails, with stroke scaling optimized for small preview sizes.
- Converts
.pltand.hpglfiles to PNG thumbnails via plotconvert. - Uses
--png-max-sizeto limit the longest side to the size requested by GNOME. - Uses
--png-stroke-scale 10for visible outlines in small thumbnails. - Registers a custom MIME type (
application/x-plt) for.pltfiles. - Also supports the standard MIME type
application/vnd.hp-hpglfor.hpglfiles. - Downloads the latest plotconvert binary automatically during installation.
- curl or wget: To download plotconvert from GitHub Releases. Install with
sudo apt install curlif needed. - GNOME Desktop Environment: Required for thumbnailer integration (Nautilus/Files).
- sudo: Required to install plotconvert and the thumbnailer script in
/usr/bin/.
First, make the scripts executable:
chmod +x install.sh install-and-update.sh uninstall.shThen run the installer:
./install.shTo install (if needed) and update plotconvert when a newer release is available:
./install-and-update.shThis script checks the latest version on GitHub, compares it with the installed plotconvert, downloads and installs the update when a newer version exists, and refreshes the thumbnailer files.
The script will:
- Fetch the latest plotconvert release from GitHub Releases.
- Download and install the
plotconvert-linux-x86_64binary to/usr/bin/plotconvert(requiressudo). - Register a custom MIME type (
application/x-plt) for.pltfiles at~/.local/share/mime/packages/. - Copy
plt-thumbnailer.shto/usr/bin/and make it executable (requiressudo). - Copy
plt.thumbnailerto~/.local/share/thumbnailers/. - Update the paths in the
.thumbnailerfile.
Note: The thumbnailer script and plotconvert binary 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 -qIf the thumbnailer is already installed, run:
./install-and-update.shThe script will:
- Fetch the latest plotconvert release from GitHub.
- Compare it with the installed version (
plotconvert --version). - Download and install the new binary when a newer version is available.
- Refresh
plt-thumbnailer.shandplt.thumbnailer.
If the thumbnailer is not installed yet, it runs ./install.sh automatically.
./uninstall.shAfter uninstalling, clear the cache and restart Nautilus:
rm -rf ~/.cache/thumbnails/*
nautilus -qIf you prefer to install manually:
- Download the latest plotconvert binary:
TAG=$(curl -fsSL https://api.github.com/repos/rhafaelcm/plotconvert/releases/latest \
| grep -o '"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"' \
| sed -E 's/.*"([^"]*)".*/\1/')
curl -fsSL "https://github.com/rhafaelcm/plotconvert/releases/download/${TAG}/plotconvert-linux-x86_64" \
-o /tmp/plotconvert
sudo install -m 755 /tmp/plotconvert /usr/bin/plotconvert- Register the custom MIME type:
mkdir -p ~/.local/share/mime/packages
cat > ~/.local/share/mime/packages/application-x-plt.xml << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-plt">
<comment>HP-GL Plot File</comment>
<glob pattern="*.plt"/>
</mime-type>
</mime-info>
EOF
update-mime-database ~/.local/share/mime- Copy the script to
/usr/bin/and make it executable:
sudo cp plt-thumbnailer.sh /usr/bin/
sudo chmod +x /usr/bin/plt-thumbnailer.sh- Create the thumbnailers directory (if it doesn't exist) and copy the configuration file:
mkdir -p ~/.local/share/thumbnailers
cp plt.thumbnailer ~/.local/share/thumbnailers/- Update the paths in the
.thumbnailerfile:
sed -i "s|^TryExec=.*|TryExec=/usr/bin/plt-thumbnailer.sh|" ~/.local/share/thumbnailers/plt.thumbnailer
sed -i "s|^Exec=.*|Exec=/usr/bin/plt-thumbnailer.sh %i %o %s|" ~/.local/share/thumbnailers/plt.thumbnailer- Clear the cache and restart Nautilus:
rm -rf ~/.cache/thumbnails/*
nautilus -qGNOME uses .thumbnailer files in ~/.local/share/thumbnailers/ (user-level) or /usr/share/thumbnailers/ (system-level) to generate thumbnails.
The plt.thumbnailer file specifies:
- MimeType:
application/x-pltfor.pltfiles andapplication/vnd.hp-hpglfor.hpglfiles. - 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 plt-thumbnailer.sh script receives these arguments and calls plotconvert:
plotconvert --to png --png-stroke-scale 10 --png-max-size <SIZE> --output <output> <input>The --png-max-size parameter receives the size requested by GNOME (%s), limiting the longest side of the PNG. The default is 256 pixels if no size is provided.
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 both plotconvert and the script must be installed in /usr/bin/.
-
Thumbnails not showing:
- Check that plotconvert is installed:
which plotconvert && plotconvert --version - Verify the MIME type is registered:
xdg-mime query filetype yourfile.plt(should returnapplication/x-plt) - Verify the paths in
~/.local/share/thumbnailers/plt.thumbnailerare correct. - Check that
plt-thumbnailer.shis executable:ls -la /usr/bin/plt-thumbnailer.sh - Clear the cache:
rm -rf ~/.cache/thumbnails/*and restart:nautilus -q - Check logs:
journalctl --user -b | grep -i thumb
- Check that plotconvert is installed:
-
Manual script test:
/usr/bin/plt-thumbnailer.sh /path/to/file.plt /tmp/test.png 256- Unsupported architecture:
- Currently only
x86_64is supported. The installer downloadsplotconvert-linux-x86_64from GitHub Releases.
- Currently only
Feel free to open issues or pull requests if you find problems or have suggestions.