[wishlist] [solved] .lnk file support

Bug #1240211 reported by jpka on 2013-10-15
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gnome-exe-thumbnailer (Ubuntu)
Undecided
Unassigned

Bug Description

Hi! I need support for MS Windows .lnk (binary) files thumbnailing. I try to modify '/usr/bin/gnome-exe-thumbnailer' program and it looks works for me. Please look at patch below. I test it in old 'gnome-exe-thumbnailer.sh' in Ubuntu 10.04 LTS and in new 'gnome-exe-thumbnailer' at Xubuntu 12.10.
It is also need to add MIME type for .lnk file. For Gnome3, i add 'application/x-ms-shortcut' to /usr/share/thumbnailers/exe-dll-msi.thumbnailer. For Gnome2, this should work, i will test it later: http://ubuntuforums.org/showthread.php?t=998758&page=2 (seek for 'gconftool-2' there).
---

$ diff -u /usr/bin/gnome-exe-thumbnailer.orig /usr/bin/gnome-exe-thumbnailer
--- /usr/bin/gnome-exe-thumbnailer.orig 2013-10-15 22:47:21.969804950 +0400
+++ /usr/bin/gnome-exe-thumbnailer 2013-10-15 23:37:46.433940001 +0400
@@ -70,6 +70,14 @@
  TUNE='-modulate 120,100,0'

 else
+ # get .exe name from .lnk (we hope .exe contains icon)
+ if [[ ${INPUTFILE##*.} = 'lnk' ]]
+ then
+ INPUTFILE=$(winepath -u `winedump "$INPUTFILE" | grep -a 'Icon path' | cut -c 12-`)
+ # write debug info; may be removed
+ echo $INPUTFILE
+ fi
+
  # Extract group_icon resource.
  # If we get the "wrestool: $INPUTFILE could not find `1' in `group_icon' resource." error,
  # there is a 99.9% chance that input file is an installer.

jpka (jopka) wrote :

The attachment "thumbs-lnk.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Jan Nekvasil (jan-nekvasil) wrote :

@jpka: Thanks, that's a great idea. I'm implementing this just now, I will post the new version here for testing today.

Jan Nekvasil (jan-nekvasil) wrote :

I added the support for application/x-ms-shortcut (.lnk) files based on the jopka's patch. Whoever is interested in this feature, please test the attached tarball (sudo tar xjvf gnome-exe-thumbnailer_0.9.2.tar.bz2 -C/). There are also some minor fixes and features included that didn't made it to the official release yet.

jpka (jopka) wrote :

Thank you! It work perfectly.

P.S. #1. While it intended for Gnome3, i also test it in old Ubuntu 10.04 LTS. Some tricks are needed for such Gnome2-based OS, maybe it can be helpful for someone:

[code]# Emulate 'gsettings' program which is not exist for Gnome2
sudo touch /usr/bin/gsettings
sudo chmod a+rwx /usr/bin/gsettings
sudo echo "echo Humanity" > /usr/bin/gsettings
# Make new folder and config file
mkdir $HOME/.cache/thumbnails
gsettings > $HOME/.cache/thumbnails/gnome-exe-thumbnailer.cfg
# Link new thumbnailer
gconftool-2 --type=bool --set "/desktop/gnome/thumbnailers/application@x-ms-dos-executable/enable" true
gconftool-2 --type=bool --set "/desktop/gnome/thumbnailers/application@x-ms-shortcut/enable" true
gconftool-2 --type=string --set "/desktop/gnome/thumbnailers/application@x-ms-dos-executable/command" "/usr/bin/gnome-exe-thumbnailer %i %o"
gconftool-2 --type=string --set "/desktop/gnome/thumbnailers/application@x-ms-shortcut/command" "/usr/bin/gnome-exe-thumbnailer %i %o"

# Link original thumbnailer if you need it suddenly:
gconftool-2 --type=string --set "/desktop/gnome/thumbnailers/application@x-ms-dos-executable/command" "/usr/bin/gnome-exe-thumbnailer.sh %i %o"
gconftool-2 --type=string --set "/desktop/gnome/thumbnailers/application@x-ms-shortcut/command" "/usr/bin/gnome-exe-thumbnailer.sh %i %o"[/code]

P.S. #2. It is useful sometimes to create .lnk file from msdos/windows executable. I use it for tests. There is proprietary program 'xxmklink' exist for it, it is free for non-profit use: http://www.xxcopy.com/xxcopy38.htm
Place xxmklink.exe to system32 (and to syswow64 folder for x64 OS).
To use it with Ubuntu, i create small glue logic:
[code]sudo touch /usr/bin/mklnk
sudo chmod a+rwx /usr/bin/mklnk
sudo echo 'wname=`winepath -w "$1"` ; wpath=${wname%'$'\047''\'$'\047''*} ; wdescr=`zenity --entry --text="Enter text description (No empty allowed):" --entry-text=Description` ; echo *$wname* ; echo *$wpath* ; wine "xxmklink.exe" "$wname" "$wname" "%1 %2 %3 %4 %5 %6 %7 %8 %9" "$wpath" "$wdescr" 1 "$wname":1 | zenity --text-info' > /usr/bin/mklnk [/code]
and for Gnome2, you just select "Use custom command..." from context menu of your .exe file and type 'mklnk'.
For Gnome3, one may use:
[code]1) use this once:
mimeopen -d '/home/full path/to/your app.exe'
 use application # <-- Select (Other...)
 use command: mklnk
2) next time use context 'Open with...' menu as in Gnome2 (select mklnk) on your exe files.[/code]

James Lu (tacocat) on 2016-08-30
Changed in gnome-exe-thumbnailer (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers