xboard-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XBoard-devel] Opening pgn files in xboard


From: h.g. muller
Subject: Re: [XBoard-devel] Opening pgn files in xboard
Date: Fri, 30 Dec 2011 12:58:03 +0100

I tried to play a little with this, and the info you posted at WB forum, but I was not succesful. Most probably due tomy almost complete lack of kowledge on Linux matters. WhatI tried todo, though,was a bit more encompassing as the original question.

For starters, the mime type application/x-chess-pgn was already defined, but it was associated with some primitive chess-viewer application. And as I noticed that the .xml mime-type file also specifies the icon, and I did not like the text-x-generic icon for PGN files, I tried to change that first. But icons seem to be scattered all over the place. I looked in /usr/share/icons/hicolor/*/mimetypes, but I could not find the text-x-generic there. Finally I found something in /usr/share/icons/gnome, and copied our xboard.svg to the 'scalable/mimetypes' subdirectory, and specified that for the x-chess-pgn mimetype, but it did not alter the icons displayed for PGN files in the file explorer.

So my first question is: how can I install new icons, and associate those to mime types?

Now I don't only want to do this for PGN files, but also for FEN an TRN. Can I do that in a single xboard.xml file, by multiplying the <mime-type> block? I did find an xml file for the x-chess-pgn type on my system (I think it was in /usr/share/mime), and it roughly looked like you described, except that there were zillions of internationalized versions of the 'Comment' line, and that the <mime-info> and <mime-type> tags seemed to be combined into one. I guess if we create an xboard.xml for distribution with xboard, we best copy all those messages into it as well.

Now there seems to exist an application/x-chess-fen mime type, although I got only a single hit for it with Google (and the actual page to which it brought me did not contain is...). But I am pretty sure there is nothing for TRN, as this extension I cooked up myself. So the question is, do these mime-types referred to from the xml file have to be officially existing, or can I take an arbitrary identifier for them (say application/x-game-tourney)? The XBoard tourney files are easily recognized by content, which always starts with '-participants {'. I could not think of a pattern to recognize FENs, so I guess that we should simply drop this <magic> block for the x-chess-fen mime type?

As to the desktop file. We seem to already have an xboard.desktop file in our source tree, but it is for a bare "xboard" command (i.e. it starts up in engine mode, with fairymax). Do I understand correctly that we would have to create several .desktop files of different names, like pgnviewer.desktop, fenviewer.desktop, chesstourney.desktop, only differing in the Exec line, MimeType and Comment? (And what exactly is the function of the name field?)


At 02:06 23-12-2011 +0100, Byrial Jensen wrote:
Hi

I saw that someone in the winboard forum asked about opening pgn files by double clicking in linux. I am not a member of the forum, so I cannot answer directly, so perhaps you will bring my answer.

Someone asked:

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.

Answer:

pgn files have the MIME type "application/x-chess-pgn". That is usually defined in /usr/share/mime/packages/freedesktop.org.xml. So what is needed is a desktop file for xboard to associate xboard with that MIME type. xboard really should be distributed with just a file. I guess I will make one for the next release.

You find the specification for desktop files at http://www.freedesktop.org/wiki/Specifications/desktop-entry-spec

The desktop file can be installed with xdg-desktop-menu from the Xdg-utils package. See http://portland.freedesktop.org/xdg-utils-1.0/xdg-desktop-menu.html for details about that.

Regards,
- Byrial




reply via email to

[Prev in Thread] Current Thread [Next in Thread]