Update 2007-08-16:
Visit the new home page of NFO Viewer. This HOWTO is now obsolete.
http://home.gna.org/nfoview/
NFO files are "ASCII-art" with the cp437 codepage, which includes a lot line- and block characters. To view the "ASCII-art" of NFO files correctly, it is enough to use the right encoding and font. As you might not want to set your normal text editor for those settings or perhaps your normal text editor is too slow to start, you can use a separate application written by me for viewing NFO files. Unlike text editors, NFOview will also allow you to click on links that appear in the text. This HOWTO will will walk you through setting that up.
The application I have written is very simple. It is not an editor, just a viewer. A text view widget in a window. No menubar, no toolbar, no statusbar, no buttons. Should be as fast as it gets with Python and GTK.
Screenshot with some random NFO file:
Part 1: Setting up nfoview
1.1 Install packages "python" and "python-gtk2" if you don't have them already.
1.2 Get the Lucida Console P font
Code:
cd ~/.fonts && wget http://home.online.no/~aageli/luconP.ttf
Lucida Console P has support for all the cp437 codepage characters. monospace font works as well, but it doesn't have all the characters.
1.3 Download the nfoview script
http://users.tkk.fi/~otsaloma/scripts/nfoview
Put it for example in ~/bin or some place that's in your $PATH and give it execute permissions.
1.4 Test it
1.5 Edit the settings in file ~/.nfoview if needed.
Part 2: Setting up file-associations
This section works at least in GNOME and should probably work in any desktop encironment that adheres to the FreeDesktop.org standards. In the instructions, just replace Nautilus with your preferred filemanager if you don't use GNOME.
2.1 Add a mime-type for NFO files.
Code:
gedit ~/.local/share/mime/packages/Override.xml
Make the file look the following (but don't remove other possible entries you might have):
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="text/x-extension-nfo">
<comment>NFO document</comment>
<glob pattern="*.nfo"/>
</mime-type>
</mime-info>
Note: I'm not sure if that should best be "text/x-extension-nfo" or "application/x-extension-nfo" or perhaps something else.
2.2 Rebuild the mime-type database. The changes should be instant-applied, but if not try logging out and logging back in.
Code:
update-mime-database ~/.local/share/mime
2.3 Right click an NFO file in Nautilus. The mime-type should now be "text/x-extension-nfo".
2.4 Add a desktop file.
Code:
gedit ~/.local/share/applications/nfoview.desktop
Paste the following. Fix the path on the "Exec" line and add translations if you wish.
Code:
[Desktop Entry]
Encoding=UTF-8
Name=NFOview
Comment=View NFO files
MimeType=text/x-extension-nfo;
Exec=/home/osmo/bin/nfoview
Type=Application
Terminal=false
NoDisplay=true
2.5 Right click an NFO file in Nautilus. You should now see an entry "Open with NFOview". If not, right click and go to Properties -> Open with -> Add -> Use other command.
2.6 Set a mime-type icon.
Place your preferred icon in your icon theme's folder as "scalable/mimetypes/gnome-mime-text-x-extension-nfo.png". You might need to refresh the icons by for example changing your icon theme to something else and then changing it back.
Notes: Using the "scalable" directory will change the icon for 32x32 and 48x48 icons with GNOME 2.16 default icon theme. The most elegant way to add custom icons indepedent of the icon theme you're currently using would probably be to create a new icon theme with your custom icons and have that inherit whatever icon theme you wish to use.
Bookmarks