X-Git-Url: http://pere.pagekite.me/gitweb/homepage.git/blobdiff_plain/8b1442e65cfc9e56cb3c5afa0cd42c013217a821..4d8d9c95b090065c0699fe65d3406dd962232b21:/blog/archive/2023/01/01.rss diff --git a/blog/archive/2023/01/01.rss b/blog/archive/2023/01/01.rss index b237e6797e..655205b721 100644 --- a/blog/archive/2023/01/01.rss +++ b/blog/archive/2023/01/01.rss @@ -3,13 +3,132 @@ Petter Reinholdtsen - Entries from January 2023 Entries from January 2023 - https://people.skolelinux.org/pere/blog/ + http://www.hungry.com/~pere/blog/ + + Is the desktop recommending your program for opening its files? + http://www.hungry.com/~pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html + http://www.hungry.com/~pere/blog/Is_the_desktop_recommending_your_program_for_opening_its_files_.html + Sun, 29 Jan 2023 11:00:00 +0100 + <p>Linux desktop systems +<a href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">have +standardized</a> 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.</p> + +<p>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.</p> + +<p>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 +<a href="https://www.iana.org/assignments/media-types/media-types.xhtml">register +it with IANA</a> to ensure the MIME type string is reserved.</p> + +<p>The script uses the <tt>xdg-mime</tt> 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.</p> + +<pre> +#!/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 +</pre> + +<p>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.</p> + +<p>As usual, if you use Bitcoin and want to show your support of my +activities, please send Bitcoin donations to my address +<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p> + + + + + Opensnitch, the application level interactive firewall, heading into the Debian archive + http://www.hungry.com/~pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html + http://www.hungry.com/~pere/blog/Opensnitch__the_application_level_interactive_firewall__heading_into_the_Debian_archive.html + Sun, 22 Jan 2023 23:55:00 +0100 + <p>While reading a +<a href="https://sneak.berlin/20230115/macos-scans-your-local-files-now/">blog +post claiming MacOS X recently started scanning local files and +reporting information about them to Apple</a>, even on a machine where +all such callback features had been disabled, I came across a +description of the Little Snitch application for MacOS X. It seemed +like a very nice tool to have in the tool box, and I decided to see if +something similar was available for Linux.</p> + +<p>It did not take long to find +<a href="https://github.com/evilsocket/opensnitch">the OpenSnitch +package</a>, which has been in development since 2017, and now is in +version 1.5.0. It has had a +<a href="https://bugs.debian.org/909567">request for Debian +packaging</a> since 2018, but no-one completed the job so far. Just +for fun, I decided to see if I could help, and I was very happy to +discover that +<a href="https://github.com/evilsocket/opensnitch/issues/304">upstream +want a Debian package too</a>.</p> + +<p>After struggling a bit with getting the program to run, figuring +out building Go programs (and a little failed detour to look at eBPF +builds too - help needed), I am very happy to report that I am +sponsoring upstream to maintain the package in Debian, and it has +since this morning been waiting in NEW for the ftpmasters to have a +look. Perhaps it can get into the archive in time for the Bookworm +release?</p> + +<p>As usual, if you use Bitcoin and want to show your support of my +activities, please send Bitcoin donations to my address +<b><a href="bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b</a></b>.</p> + + + LinuxCNC MQTT publisher component - https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html - https://people.skolelinux.org/pere/blog/LinuxCNC_MQTT_publisher_component.html + http://www.hungry.com/~pere/blog/LinuxCNC_MQTT_publisher_component.html + http://www.hungry.com/~pere/blog/LinuxCNC_MQTT_publisher_component.html Sun, 8 Jan 2023 19:30:00 +0100 <p>I watched <a href="https://yewtu.be/watch?v=jmKUV3aNLjk">a 2015 video from Andreas Schiffler</a> the other day, where he set up