Sacolevas wrote:Hello, I am using a Linux operating system (with LXDE as desktop environment) and have installed xboard. However, I don't know what should I do to be able to open a PGN file directly using xboard. In windows, I had the option to associate pgn files to winboard, so I could open a pgn file by just double-clicking the file. Here, I always have to open xboard and then open the file in xboard.
Hi Sacolevas,
I registered at this forum to be able to answer this question.
On Linux it is done in 2 steps:
1) Associate PGN files with a MIME type (usually application/x-chess-pgn)
2) Register xboard as a handler for the MIME type.
Step 1)
I think that step 1 is already done on most updated Linux systems. You can test if it is the case with the command mimetype. It should look like this:
$ mimetype somefile.pgn
somefile.pgn: application/x-chess-pgn
If pgn-files are recognized as having the MIME type application/x-chess-pgn, you can jump to step 2 below.
But if mimetype answers text/plain instead of application/x-chess-pgn, you will have define the MIME type. To do that, make a file called xboard.xml with this content:
- Code: Select all
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-chess-pgn">
<comment>PGN chess game notation</comment>
<generic-icon name="text-x-generic"/>
<glob pattern="*.pgn"/>
<sub-class-of type="text/plain"/>
<magic priority="50">
<match value="[Event " type="string" offset="0"/>
</magic>
</mime-type>
</mime-info>
See the specification for the file at
http://standards.freedesktop.org/shared ... ec/latest/ if you want to customize it.
Install the file with the xdg-mime program from the xdg-utils package:
$ xdg-mime install --mode <MODE> --novendor xboard.xml
<MODE> should be either "user" for a installation for the current user only, or "system" for a system wide installation. The latter of course requires root access.
Step 2)
Make a file called xboard.desktop with this content:
- Code: Select all
[Desktop Entry]
Type=Application
Name=XBoard
GenericName=X Window Chess Board
NoDisplay=true
Comment=Use XBoard to view PGN files
Exec=xboard -ncp -lgf %f
Terminal=false
MimeType=application/x-chess-pgn;
Categories=Game;BoardGame;
You can change the command line options in the Exec key as you wish. The file format is specified in
http://standards.freedesktop.org/deskto ... ec/latest/ if you wish change it.
Install the desktop file with:
$ xdg-desktop-menu install --mode <MODE> --novendor xboard.desktop
<MODE> is either "user" or "system" as before.
After the installation of the desktopfile, you may have to run
$ update-desktop-database
I am not sure if it is necessary.
Hope that helps,
- Byrial