Wednesday, April 15, 2009

Opening files via WINE in Ubuntu

As a windows user I enjoyed the power of Notepad2 (a lightweight yet powerful notepad replacement), and while the features of gedit are useful they're not what I'm useful. Indeed a number of what I would regard as essential features are in a secondary plugin set that you have to track down in the repos (gedit-plugins), hence I wanted to use Notepad2 in Ubuntu. Thankfully Notepad2 worked immediately under WINE, removing any troubles that I might have incurred there, though I still needed a way to directly open files into the program, preferably via a simple double click.

I investigated using a custom wine command, with a number of various symbols after the path to Notepad2, searching for the one that would pass the filename in a manner that it could understand, but without much luck. Google, however, had some answers and I found this post.

The solution is to call a small bash script which then generates a link file within WINE which points to the file you want. This works fine except that the program inside WINE doesn't get to see the original filename (this isn't a problem when saving, but is annoying when using programs that display the filename in the title bar and elsewhere). To resole this I made a couple of changes to the script such that the link file uses the name of the original file, rather than a pre-defined static one, these mods are in my reply to that thread.