Petter Reinholdtsen: Is the desktop recommending your program for opening its files?
Linux desktop systems
have
standardized how programs present themselves to the desktop
system. If a package include a .desktop file in
/usr/share/applications/, Gnome, KDE, LXDE, Xfce and the other desktop
environments will pick up the file and use its content to generate the
menu of available programs in the system. A lesser known fact is that
a package can also explain to the desktop system how to recognize the
files created by the program in question, and use it to open these
files on request, for example via a GUI file browser.
A while back I ran into a package that did not tell the desktop
system how to recognize its files and was not used to open its files
in the file browser and fixed it. In the process I wrote a simple
debian/tests/ script to ensure the setup keep working. It might be
useful for other packages too, to ensure any future version of the
package keep handling its own files.
For this to work the file format need a useful MIME type that can
be used to identify the format. If the file format do not yet have a
MIME type, it should define one and preferably also
register
it with IANA to ensure the MIME type string is reserved.
The script uses the xdg-mime program from xdg-utils to
query the database of standardized package information and ensure it
return sensible values. It also need the location of an example file
for xdg-mime to guess the format of.
#!/bin/sh
#
# Author: Petter Reinholdtsen
# License: GPL v2 or later at your choice.
#
# Validate the MIME setup, making sure motor types have
# application/vnd.openmotor+yaml associated with them and is connected
# to the openmotor desktop file.
retval=0
mimetype="application/vnd.openmotor+yaml"
testfile="test/data/real/o3100/motor.ric"
mydesktopfile="openmotor.desktop"
filemime="$(xdg-mime query filetype "$testfile")"
if [ "$mimetype" != "$filemime" ] ; then
retval=1
echo "error: xdg-mime claim motor file MIME type is $filemine, not $mimetype"
else
echo "success: xdg-mime report correct mime type $mimetype for motor file"
fi
desktop=$(xdg-mime query default "$mimetype")
if [ "$mydesktopfile" != "$desktop" ]; then
retval=1
echo "error: xdg-mime claim motor file should be handled by $desktop, not $mydesktopfile"
else
echo "success: xdg-mime agree motor file should be handled by $mydesktopfile"
fi
exit $retval
It is a simple way to ensure your users are not very surprised when
they try to open one of your file formats in their file browser.
As usual, if you use Bitcoin and want to show your support of my
activities, please send Bitcoin donations to my address
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b.
Greetings from Viluppuram, Tamil Nadu, South India!
As a preparation and warm-up for DebConf in September, the Debian
people in India have organized a miniDebConf. Well, I don t want to be
unfair to them They have been regularly organizing miniDebConfs for
over a decade, and while most of the attendees are students local to
this state in South India (the very tip of the country; Tamil Nadu
is the Eastern side, and Kerala, where Kochi is and DebConf will be
held, is the Western side), I have talked with attendees from very
different regions of this country.
This miniDebConf is somewhat similar to similarly-scoped events I have
attended in Latin America: It is mostly an outreach conference, but
it s also a great opportunity for DDs in India to meet in the famous
hallway track.
India is incredibly multicultural. Today at the hotel, I was somewhat
surprised to see people from Kerala trying to read a text written in
Tamil: Not only the languages are different, but the writing systems
also are. From what I read, Tamil script is a bit simpler to Kerala s
Mayalayam, although they come from similar roots.


Witch Wells, AZ Snow

After my
For the fourth year in a row, I've asked Soci t de Transport de Montr al,
Montreal's transit agency, for the foot traffic data of Montreal's subway.
By clicking on a subway station, you'll be redirected to a graph of the
station's foot traffic.