Dependencies: icoutils (can be found in most repositories).
This guide will allow your file browser (Nautilus is used in this guide, but with some amendments other browsers supporting external thumbnailers should work) to automatically extract and generate GNOME-compatible icons for Windows executables.
We'll use a combination of wrestool and icotool, provided by icoutils. First we will create a bash script to utilise these two binaries, since GNOME will only execute simple commands as thumbnailers, but not bash script or similar.
As root, create an empty file in /usr/bin named 'msiconailer' (or whatever you want to call your thumbnailer) then copy and paste this code into the contents of the file using a text editor:
#!/bin/bash wrestool -x -t14 $1 | icotool -x -o $2 -
This code first extracts the 'main' icon (type 14) from your Windows exe (specified by the first argument $1). These binaries can include multiple cursors/icons, so we need to use wrestool to make sure we get the one we want. The data for this icon will be passed to stdout by wrestool, which we then pipe into icotool, which converts this data into a PNG format image and writes it to disk in the location specified as the second argument ($2). Here's an example use of our script:
msiconailer /path/to/windows.exe /path/to/exportedicon.png
Once you've saved the script (and don't forget to make it executable), we can configure our thumbnailer in GNOME.
The thumbnailers are configured inside gconf-editor (you can access this via the Applications menu or just enter gconf-editor into a terminal). The specific path to the thumbnailers is /desktop/gnome/thumbnailers - but to add new keys here we must use the terminal. Execute these two commands in the terminal:
gconftool-2 --type=bool --set "/desktop/gnome/thumbnailers/application@x-ms-dos-executable/enable" true gconftool-2 --type=string --set "/desktop/gnome/thumbnailers/application@x-ms-dos-executable/command" "/usr/bin/msiconailer %i %o"
Your thumbnailer has been added - browse to a Windows executable using Nautilus to see icons generated.
If your exe icons don't appear, don't forget to empty the .thumbnails/fail folder in your home directory, and make sure things are configured correctly in Nautilus preferences (such as abandoning thumbnail-generation for files over a certain size or residing in a remote location).
|