Tag : gtk

post image

How to install Inkscape 0.92 (latest) as a snap in Ubuntu 16.04

Inkscape is professional open-source vector graphics editor. The latest version is 0.92. Here is a video demonstrating the new Inkscape 0.92 features. And detailed Inkscape 0.92 Release Notes.

Here is how to install as the Inkscape snap on Ubuntu 16.04 (and other GNU/Linux distributions that support snaps). The snap was created by Inkscape Board member Ted Gould.

Let’s see what is available as a snap for Inkscape.

$ snap info inkscape
name:      inkscape
summary:   "Vector Graphics Editor"
publisher: inkscape
description: |
  An Open Source vector graphics editor, with capabilities similar to
  Illustrator, CorelDraw, or Xara X, using the W3C standard Scalable Vector
  Graphics (SVG) file format.
  Inkscape supports many advanced SVG features (markers, clones, alpha blending,
  etc.) and great care is taken in designing a streamlined interface.
  It is very easy to edit nodes, perform complex path operations, trace
  bitmaps and much more.
  We also aim to maintain a thriving user and developer community by using
  open, community-oriented development.
  stable:    0.92.0     (1880) 148MB -
  candidate: 0.92.0     (2307) 149MB -
  beta:      0.92.0     (2307) 149MB -
  edge:      0.92+devel (2314) 149MB -

We can see that there is already a stable snap for 0.92. If we are comfortable with the stable snap (it’s 0.92!), we can install it from the Ubuntu Software as well.

The one with the nonfree tag is that snap. The other is the package from the repositories, an older version. For some reason, the snaps have the nonfree tag, which weirdly helps to distinguish from the repository packages.

Let’s install the stable Inkscape snap and let’s run it.

Ok, it has a retro look. What’s going on? Is retro in fashion again?

Let’s run the snapped Inkscape from the command line:

$ inkscape
Gtk-Message: Failed to load module "overlay-scrollbar"
Gtk-Message: Failed to load module "gail"
Gtk-Message: Failed to load module "atk-bridge"
Gtk-Message: Failed to load module "canberra-gtk-module"

So this is what is going on. There is a bug in the current stable version of the snap. These errors mean, among other things, that the theming is not working. You can read some feedback in a recent AskUbuntu answer about snap packaging by Sergio Schvezov. In addition, it was a bug that was mentioned on G+ a few days ago.

Let’s try out the package from the edge channel and see whether it has fixed the theming issue.

$ snap remove inkscape
inkscape removed
$ snap install inkscape --channel=edge
inkscape (edge) 0.92+devel from 'inkscape' installed

Instead of the option –channel=edge above, you can also use –edge. My preference is to show the verbose version when I type commands in tutorials so that it is easy to see that edge refers to the channel.

Let’s run the edge Inkscape from the command line.

$ inkscape
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

Only the canberra GTK module is missing now, which is a nice improvement. canberra refers to libcanberra and has to do with sound events.

Let’s try Inkscape, minus the sound events.

Here it is then, and it looks fine.

Most users do not know much about vector graphics. Inkscape makes it easy to learn because it has built-in tutorial.

Here is how to get it to load up.

You click on Help→Tutorials→Inkscape: Basic to start off with the first tutorial. You can see that there is a good set of tutorials.

Here is how the first tutorial looks like. It is an Inkscape document (*.svg), and you can freely edit the document while you are reading and learning more about Inkscape!

Make an effort to complete the full set of the Inkscape tutorials.

How to type Greek, Greek Polytonic in Linux

Update 2010: Please see the docs.google.com edition of the guide as it has the latest material. See link below.

There is a new guide on how to write Greek and Greek Polytonic in Linux, and in particular using the latest versions of Linux distributions.

https://docs.google.com/View?docID=dccdrjqk_4cqjn9zcj (LATEST VERSION)

The guide shows in detail how to add the Greek keyboard layout to your Linux desktop, and how to write Greek, Greek Polytonic and other Ancient Greek characters.

The guide is also available in both ODT and PDF format. (both files are somewhat obsolete. use google docs URL from above instead)

For a Greek version of the guide, please see http://docs.google.com/Doc?id=dccdrjqk_3gx3bq5f9 (does not update as often as the English version)

We attach the HTML version of the guide in this post. The docs.google.com version is the latest, please read that instead.

Again, you can find the latest version of this document at


These are the presentation slides of my talk on improving the writing support in GTK+. It relates to several posts I have in my other (now not used anymore) blog at http://blogs.gnome.org/simos/2008/07/23/guadec-2008-presentation-slides/.

Enhancing the writing support in GTK+

Note: The title may not appear properly because I use a fancy effect that does not support the full range of Unicode characters. It’s a drawback of being trendy. The title says “Éńĥãǹčīṅǧ·ẗḧë·ẃṛīťıñĝ·ṩụṗṗọṙẗ·ıń·ǦŤḰ+”.

Keyboard layout editor UI concept

(click for bigger image)

At the top we select the keyboard layout file, the variant, and set the corresponding verbose name.

The keyboard layout editor shows a standard keyboard, where each keyboard key can show up to four levels. When you select a key, the bottor-left window shows the characters that have been set (here we use four levels). In this bottom-left window we can drag and drop characters (from Unicode blocks) and dead keys that are found from the right of the image. Dead keys are shown in red boxes.

The user is also able to include existing keyboard layout files in the current layout.

At this stage I am thinking how to easily draw the keyboard in a PyGTK application. It would be important not to draw it manually. It would be cool to have a GTK+ keyboard key widget, that you can specify the size, and the text that appears on it, then build a keyboard in Glade. Another option would be to have the basic keyboard as an SVG file (already exists), then draw over it with Cairo. I am inclined for the second option.

How to easily modify a program in Ubuntu (updated)?

Some time ago we talked about how to modify easily a program in Ubuntu. We gave as an example the modification of gucharmap; we got the deb source package, made the change, compiled, created new .deb files and installed them.

We go the same (well, similar) route here, by modifying the gtk+ library (!!!). The purpose of the modification is to allow us to type, by default, all sort of interesting Unicode characters, including ⓣⓗⓘⓢ , ᾅᾷ, ṩ, and many more.

The result of this exercise is to create replacement .deb packages for the gtk+ library that we are going to install in place of the system libraries. Because these new libraries will not be original Ubuntu packages, the update manager will be pestering us to rollback to the official gtk+ packages. This is actually good in case you want to switch back; you will have the enhanced functionality for as long as you postpone that update.

There is a chance we might screw up our system, so please make backups, or have a few drinks first and come back. I take no responsibility if something bad happens on your system. If you are having any second thoughts, do not follow the next steps; use the safer alternative procedure. You may try however this guide just for the kicks; up to the dpkg command below, no changes are being made to your system.

We use Ubuntu 7.10 here. This should work in other versions, though your mileage may vary.

The compilation procedure takes time (about 30 minutes) and space. Make sure you use a partition with >2GB of free space. We are not going to use up 2GB (a bit less than 1GB), but it’s nice not to fill up partitions.

We are going to use the generic instructions on how to recompile a debian package by ducea.

First of all, install the development packages,

sudo apt-get install devscripts build-essential

Next, we use the apt-get source command to get the source code of the GTK+ 2 library,

cd /home/ubuntu/bigpartition_over2GB/
apt-get source libgtk2.0-0

We then pull in any dependencies that GTK+ may require. They are normally about a dozen packages, but we do not have to worry for the details.

apt-get build-dep libgtk2.0-0

At this stage we need to touch up the source code of GTK+ before we go into the compilation phase. Visit the bug report #321896 – Synch gdkkeysyms.h/gtkimcontextsimple.c with X.org 6.9/7.0 and download the patch (look under the Attachment section). You should get a file named gtk-compose-update.patch. If you have a look at the patch, you will notice that it expects to find the source of gtk+ in a directory called gtk+. Making a link solves the problem,

ln -s libgtk2.0-0 gtk+

We then attempt to apply the patch (perform a dry run), just in case.

patch -p0 --dry-run < /tmp/gtk-compose-update.patch

If this does not show an error message, you can the command again without the –dry-run.

patch -p0 < /tmp/gtk-compose-update.patch

Finally, we are ready to build our fresh GTK+ library.

cd libgtk2.0-0
debuild -us -uc

This will take time to complete, so go and do some healthy cooking.

At the end of the compilation, if all went OK, you should have about a dozen .deb files created. These are one directory higher (do a “cd ..“). To install, use dpkg,

dpkg -i *.deb

If you have any other deb files in this directory, it’s good to move them away before running the command. If all went ok, the .deb files should install without a hitch.

The final step is to restart your system. To test the new support, see the last section at this post. Use Firefox and OpenOffice.org to type those Unicode characters.

If you managed to wade through all these steps, I would appreciate it if you could post a comment.

Good luck!

FOSDEM ’08, summary and comments

I attended FOSDEM ’08 which took place on the 23rd and 24th of February in Brussels.

Compared to other events, FOSDEM is a big event with over 4000 (?) participants and over 200 lectures (from lightning talks to keynotes). It occupied three buildings at a local university. Many sessions were taking place at the same time and you had to switch from one room to another. What follows is what I remember from the talks. Remember, people recollect <8% of the material they hear in a talk.

The first keynote was by Robin Rowe and Gabrielle Pantera, on using Linux in the motion picture industry. They showed a huge list of movies that were created using Linux farms. The first big item in the list was the movie Titanic (1997). The list stopped at around 2005 and the reason was that since then any significant movie that employs digital editing or 3D animation is created on Linux systems. They showed trailers from popular movies and explained how technology advanced to create realistic scenes. Part of being realistic, a generated scene may need to be blurred so that it does not look too crisp.

Next, Robert Watson gave a keynote on FreeBSD and the development community. He explained lots of things from the community that someone who is not using the distribution does not know about. FreeBSD apparently has a close-knit community, with people having specific roles. To become a developer, you go through a structured mentoring process which is great. I did not see such structured approach described in other open-source projects.

Pieter Hintjens, the former president of the FFII, talked about software patents. Software patents are bad because they describe ideas and not some concrete invention. This has been the view so that the target of the FFII effort fits on software patents. However, Pieter thinks that patents in general are bad, and it would be good to push this idea.

CMake is a build system, similar to what one gets with automake/autoconf/makefile. I have not seen this project before, and from what I saw, they look quite ambitious. Apparently it is very easy to get your compilation results on the web when you use CMake. In order to make their project more visible, they should make effort on migration of existing projects to using CMake. I did not see yet a major open-source package being developed with CMake, apart from CMake itself.

Richard Hughes talked about PackageKit, a layer that removes the complexity of packaging systems. You have GNOME and your distribution is either Debian, Ubuntu, Fedora or something else. PackageKit allows to have a common interface, and simplifies the workflow of managing the installation of packages and the updates.

In the Virtualisation tracks, two talks were really amazing. Xen and VirtualBox. Virtualisation is hot property and both companies were bought recently by Citrix and Sun Microsystems respectively. Xen is a Type 1 (native, bare metal) hypervisor while VirtualBox is a Type 2 (hosted) hypervisor. You would typically use Xen if you want to supply different services on a fast server. VirtualBox is amazingly good when you want to have a desktop running on your computer.

Ian Pratt (Xen) explained well the advantages of using a hypervisor, going into many details. For example, if you have a service that is single-threaded, then it makes sense to use Xen and install it on a dual-core system. Then, you can install some other services on the same system, increasing the utilisation of your investment.

Achim Hasenmueller gave an amazing talk. He started with a joke; I have recently been demoted. From CEO to head of virtualisation department (name?) at Sun Microsystems. He walked through the audience on the steps of his company. The first virtualisation product of his company was sold to Connectix, which then was sold to Microsoft as VirtualPC. Around 2005, he started a new company, Innotek and the product VirtualBox. The first customers were government agencies in Germany and only recently (2007) they started selling to end-users.

Virtualisation is quite complex, and it becomes more complex if your offering is cross platform. They manage the complexity by making VirtualBox modular.

VirtualBox comes in two versions; an open-source version and a binary edition. The difference is that with the binary edition you get USB support and you can use RDP to access the host. If you installed VirtualBox from the repository of your distribution, there is no USB support. He did not commit whether the USB/RDP support would make it to the open-source version, though it might happen since Sun Microsystems bought the company. I think that if enough people request it, then it might happen.

VirtualBox uses QT 3.3 as the cross platform toolkit, and there is a plan to migrate to QT 4.0. GTK+ was considered, though it was not chosen because it does not provide yet good support in Win32 (applications do not look very native on Windows). wxWidgets were considered as well, but also rejected. Apparently, moving from QT 3.3 to QT 4.0 is a lot of effort.

Zeeshan Ali demonstrated GUPnP, a library that allows applications to use the UPnP (Universal Plug n Play) protocol. This protocol is used when your computer tells your ADSL model to open a port so that an external computer can communicate directly with you (bypassing firewall/NAT). UPnP can also be used to access the content of your media station. The gupnp library comes with two interesting tools; gupnp-universal-cp and gupnp-network-light. The first is a browser of UPnP devices; it can show you what devices are available, what functionality they export, and you can control said devices. For example, you can use GUPnP to open a port on your router; when someone connects from the Internet to port 22 on your modem, he is redirected to your server, at port 22.

You can also use the same tool to figure out what port mapping took place already on your modem.

The demo with the network light is that you run the browser on one computer and the network light on another, both on the local LAN (this thing works only on the local LAN). Then, you can use the browser to switch on/off the light using the UPnP protocol.

Dimitris Glezos gave a talk on transifex, the translation management framework that is currently used in Fedora. Translating software is a tedious task, and currently translators spent time on management tasks that have little to do with translation. We see several people dropping from translations due to this. Transifex is an evolving platform to make the work of the translator easier.

Dimitris talked about a command-line version of transifex coming out soon. Apparently, you can use this tool to grab the Greek translation of package gedit, branch HEAD. Do the translation and upload back the file.

What I would like to see here is a tool that you can instruct it to grab all PO files from a collection of projects (such as GNOME 2.22, UI Translations), and then you translate with your scripts/tools/etc. Then, you can use transifex to upload all those files using your SVN account.

The workflow would be something like

$ tfx --project=gnome-2.22 --collection=gnome-desktop --action=get
Reading from http://svn.gnome.org/svn/damned-lies/trunk/releases.xml.in... done.
Getting alacarte... done.
Getting bug-buddy... done.
Completed in 4:11s.
$ _

Now we translate any of the files we downloaded, and we push back upstream (of course, only those files that were changed).

$ tfx --project=gnome-2.22 --collection=gnome-desktop --user=simos --action=send
 Reading local files...
Found 6 changed files.
Uploading alacarte... done.
Completed uploading translation files to gnome-2.22.
$ _

Berend Cornelius talked about creating OpenOffice.org Wizards. You get such wizards when you click on File/Wizards…, and you can use them to fill in entries in a template document (such as your name, address, etc in a letter), or use to install the spellchecker files. Actually, one of the most common uses is to get those spellchecker files installed.

A wizard is actually an OpenOffice.org extension; once you write it and install it (Tools/Extensions…), you can have it appear as a button on a toolbar or a menu item among other menus.

You write wizards in C++, and one would normally work on an existing wizard as base for new ones.

When people type in a word-processor, they typically abuse it (that’s my statement, not Berend’s) by omitting the use of styles and formatting. This makes documents difficult to maintain. Having a wizard teach a new user how to write a structured document would be a good idea.

Perry Ismangil talked about pjsip, the portable open-source SIP and media stack. This means that you can have Internet telephony on different devices. Considering that Internet Telephony is a commodity, this is very cool. He demonstrated pjsip running two small devices, a Nintendo DS and an iPhone. Apparently pjsip can go on your OpenWRT router as well, giving you many more exciting opportunities.

Clutter is a library to create fast animations and other effects on the GNOME desktop. It uses hardware acceleration to make up for the speed. You don’t need to learn OpenGL stuff; Clutter is there to provide the glue.

Gutsy has Clutter 0.4.0 in the repositories and the latest version is 0.6.0. To try out, you need at least the clutter tarball from the Clutter website. To start programming for your desktop, you need to try some of the bindings packages.

I had the chance to spend time with the DejaVu guys (Hi Denis, Ben!). Also met up with Alexios, Dimitris x2, Serafeim, Markos and others from the Greek mission.

Overall, FOSDEM is a cool event. In two days there is so much material and interesting talks. It’s a recommended technical event.

task update (el)

Ακολουθώντας το παράδειγμα του Δημήτρη για συνοπτική ενημέρωση των πεπραγμένων,

  • Πρόσθεσα τις μεταφράσεις του Γιάννη Κατσαμπίρη στο SVN του GNOME. Έκανα έλεγχο των μεταφράσεων και έστειλα σχόλια στη λίστα του gnome.gr. Ο Γιάννης μετέφρασε ή ενημέρωσε τις μεταφράσεις για τα vinagre, gnome-mag, mousetweaks, mousetweaks-help.
  • Έκανα σχόλια στο http://laptop.grinia.net/ για τη διαβούλευση για το μαθητικό υπολογιστή. Βλέπω ότι δεν έχουν γίνει πολλά σχόλια από άλλους. Είναι καλό να το κάνετε.
  • Πρόσθεσα το ιστολόγιο του Αλέξανδρου στον πλανήτη. Ανταλλάξαμε μερικά γράμματα για κάποια τεχνικά ζητήματα (μια εγγραφή είχε ένα χαρακτήρα που δεν είναι utf-8 οπότε όλο το feed φαινόταν με ?????, πως μπορούμε να συνδιάσουμε κατηγορίες του wordperss για τη δημιουργία πιο κατάλληλου feed, χρήση του feedburner). Απομένουν: χρήση των ειδικών βελτιώσεων του feedburner όπως αναγραφή αριθμού σχολίων. Χμμ, ολόκληρες εγγραφές στο feed;
  • Έστειλα γράμματα στη λίστα εξελληνισμού του μαθητικού υπολογιστή για 1) υπενθύμηση του glossary που παρέχει το ellak.gr για όρους πληροφορικής (μπορεί κάποιος να κάνει σχόλια/αλλαγές), 2) αναφορά για τη μετάφραση του eToys (τώρα είμαστε στο %6).
  • Πριν από μερικές εβδομάδες έγινε δεκτό το patch για την ελληνική διάταξη πληκτρολογίου, για τη χρήση των συμβόλων dead_psili, dead_dasia. Αυτό σημαίνει ότι στις νέες διανομές του Μαρτίου/Απριλίου το πολυτονικό θα δουλεύει, αλλά μπορεί και όχι…
  • Στάλθηκε patch για την υποστήριξη του πολυτονικού από το GTK+· λόγω του σχεδόν κλειστού παραθύρου για εισαγωγή νέων χαρακτηριστικών στο GTK+, αυτό θα μπει μάλλον αργότερα, στην επόμενη έκδοση.
  • Όταν κάνεις αποπροσάρτηση ενός τόμου/συσκευής USB, το σύστημα δεν θέτει τη συσκευή σε κατάσταση εκτός λειτουργίας ή χαμηλής κατανάλωσης. Αυτά σε Nautilus αλλά πιστεύω και αλλού. Δεν έχουν όλες οι συσκευές τη δυνατότητα αυτή και φαίνεται ότι δεν έχω ούτε μία τέτοια συσκευή (που να υποστηρίζει off-standby). Από την άλλη πλευρά, το VirtualBox κατάφερε να θέσει μια τέτοια συσκευή σε κατάσταση off (πώς το έκανε!;!;) Η προσθήκη υποστήριξης είναι στο TODO για τώρα.
  • Το Σ/Κ θα είμαι στις Βρυξέλλες για το FΟSDΕΜ!

Ενημέρωση: σύνδεσμος με τα σχόλια από τη διαβούλευση.

Create flash videos of your desktop with recordmydesktop

John Varouhakis is the author of recordmydesktop and gtk-recordmydesktop (front-end) which is a tool to help you record a session on your Linux desktop and save it to a Flash video (.flv).

To install, click on System/Administration/Synaptic Package Manager, and search for gtk-recordmydesktop. Install it. Then, the application is available from Applications/Sound&Video/gtkRecordMyDesktop.

Screenshot of gtk-recordmydesktop

Before you are ready to capture your Flash video, you need to select the video area. There are several ways to do this; the most common is to click on Select Window, then click on the Window you want to record. A common mistake is that people try to select the window from the preview above. If you do that, when you would have selected the recorder itself to make a video of, which is not really useful. You need to click on the real window in order to select it; then, in the desktop preview you can see the selected window. In the above case, I selected the OpenOffice Writer window.

Assuming that you do not need to do any further customisation, you can simple press Record to start recording. Generally, it is good to check the recording settings using the GNOME Sound recorder beforehand. While recording, you can notice a special icon on the top panel. This is gtk-recordmydesktop. Once you press it, recording stops and the program will do the post-processing of the recording. The resulting file goes into your home folder, and has the extension .ogv.

Some common pitfalls include

  • I did not manage to get audio recording to work well for my system; I had to disable libasound so that the audio recording would not skip. With ALSA, sound skips while with OSS emulation it does not. Weird. Does it work for you?
  •  The post-processing of the recording takes some time. If you have a long recording, it may take some time to show that it makes progress, so you might think it crashed. Have patience.

I had made one such recording, which can be found at the Greek OLPC mailing list. John told me that the audio part of the video was not loud enough, and one can use extra post-processing to make it sound better. For example, one could extract the audio stream of the video, remove the noise, beautify (how?) and then add back to the video.

It’s good to try out gtk-recordmydesktop, even for a small recording. Do you have some cool tips from your Linux desktop that you want to share? Record your desktop!

Typing squiggles and dots in GNOME and GTK+ applications

Garrett asks how to type squiggles and dots in GNOME; that is, how to type characters such as á à ä ã â ą ȩ ę ő ǰ ǩ ǒ ġ ṅ ȯ ṁ ė.

There are several ways, and one can choose depending on how frequently they need to type them or how much time they need to invest learning.

① One option is to start the Character Map (Applications/Accessories/Character Map), pick the character, copy and paste it. This is good for rare characters and weird situations such as



The Unicode standard, apart from defining characters for languages, it also defines symbols, dingbats and all sort of things. If your distribution is based on the DejaVu fonts (such as Ubuntu), then you are probably covered for many of these symbols. If you do not have a suitable font, or you use Windows, you will be wondering what the hell I am talking about.

② Another option is to use the Character Palette applet which shows an applet on the panel with a configurable small repertoire of characters such as áàéíñó½©ث€. You select one of the characters with the mouse, and wherever you middle-click, this character is typed. This is an improvement over ①, and good when you want to type often rare characters. It is not convenient to type characters found normally on a keyboard layout.

③ To type characters normally found in a specific language(s), it is good to setup a suitable keyboard layout. For this, it is good to add the Keyboard Indicator applet; right click on the panel, click Add to panel… and choose the Keyboard Indicator from the Utilities section. The US English keyboard layout (Default variant) does not provide any interesting characters apart from those shown printed on the keys of a US Keyboard.
Keyboard layout US Intl with dead keys
The US English International (with dead keys) variant might be a better option,

Keyboard layout GB

Or the United Kingdom layout.

You can get a similar image for your layout when you right-click on the Keyboard Indicator applet, then click Show Current Layout.

Each key in the images contain up to four letters. Starting from bottom-left and going clock-wise, these are the keys produced when

ⓐ you press the key

ⓑ you press the key with Shift (or Caps Lock)

ⓒ you press the key with AltGr and Shift (or Caps Lock)

ⓓ you press the key with AltGr

For example, with the UK keyboard layout, the key G produces g, G, Ŋ, ŋ.

If AltGr + Shift + letter does not work for you, see the FDO Bug #2871 Different results for shift-altgr and altgr-shift.

Using the appropriate keyboard layout is the way to go when writing text that require squiggles. You can either choose a layout with dead keys (meaning that some keys lose their normal functionality), or you can pick a layout that still allows you to have dead keys but are available when you press AltGr + key. For example, in the UK Keyboard layout – Default variant, AltGr + ; + a produces á, or AltGr+Shift+]+e produces ē.

OLPC showing the keyboard

Photo by titanas.

The OLPC uses those four level for the keyboard layout. You can see the all the variations printed on the keyboard. Click on the image, choose Large size for the details.

④ Another option to produce more characters on the keyboard is to enable the compose key, and use compose sequences. A compose sequence looks similar to what we described above (i.e. AltGr+Shift+]+e to ē) but the idea is that we use it for characters we want to be available across different keyboard layouts that you may have enabled.
Configuring the compose key
The compose key is very powerful functionality, thus it is not enabled by default, and lays hidden in the Layout Options tab. I prefer to set it to Menu, but every person has their own preference.

For example,

  • Compose key + – + a produces ã,
  • Compose key + < + c produces č
  • Compose key + 1 + s produces ¹ (Superscript on 1. Try to replace 1 with 2.)
  • Compose key + + + – procudes ±

Currently, GTK+ provides 640 such compose sequences involving the Compose key, and hopefully soon it will increase to over 3000.

The Compose key is known as Multi_key in the source code (Xorg, GTK+, etc).

The Compose key compose sequences offer the ability to define smart mnemonics on how to produce characters. It is much easier to type ComposeKey + 1 + s rather than remembering the codepoint value of ¹ (1 superscript). As with many things open-source, there are too many options, and with the Compose key there is the issue of which shall we pick as a sensible default, and how to make it prominent for those who might want to use it.

It appears to me that there should be more effort to promote the functionality that is provided with the standard keyboard layouts (choose a better keyboard layout, produce characters provided in the third and fourth levels, etc). In this respect, Compose key compose sequences should complement after the main discussion on keyboard layouts take place.

⑤ There is a last issue on switching keyboard layouts to cover in a separate post.

Improving input method support in GTK+-based apps

When a bug report gets long with many comments, it gets more difficult for someone to get the full picture of what is going on. I’ll attempt to summarise here what’s being said in Bug 321896, Synch gdkkeysyms.h / gtkimcontextsimple.c with X.org 6.9/7.0.

GTK+-based applications use by default the GTK+ Input Method in order to let users type in different languages. Some scripts are very complex (such as SE Asian scripts) and in this case SCIM is used, replacing the GTK+ Input Method. One can even disable GTK+ IM altogether and use the basic X Input Method (XIM) which is provided by the Xorg server, by setting GTK_IM_MODULE to xim. However, the majority of the users have GTK+ IM enabled.

Between GTK+ IM and XIM, the keyboard layouts are being managed by the xkeyboard-config project and Sergey Udaltsov. A keyboard layout is simply a mapping of keyboard keys to Unicode characters, but you can also have compose sequences for some characters using what we call dead keys. When you press a dead key nothing appears on screen but when you press a letter immediately afterwards, you can get an á. This functionality is common to add accents, and there is a big table for these compose sequences (1.3MB) and what Unicode characters they produce.

If you change your keyboard layout (System/Preferences/Keyboard/Layout) to something like U.S. English International (with dead keys), then the ‘ key on your keyboard becomes dead_acute, and the compose sequence

<dead_acute> <a>  : "á"   U00E1 # LATIN SMALL LETTER A WITH ACUTE

works when you press and then a.

There is an issue with compose sequences and input methods; XIM maintains the official upstream version of the compose sequences, and projects such as GTK+ and SCIM carry their own copies of that table.

The issue with GTK+ regarding the compose sequences is that it has a very old version compared to what is available upstream. This is what Bug 321896 is about.

The bug would be have been resolved much much earlier if it wasn’t for the insistence of the GTK+ maintainers to cut the fat and reduce the size of the table (~6000 entries) with clever optimisations.

Tor suggested a clever optimisation; a good number of compose sequences (which looks like <dead_acute> <a> : “á”) resemble the decomposed form (a la Unicode) of those characters. Thus, we can let the user type what she wants, and we can try Unicode normalisation to see if the sequence is composed to a single Unicode character. Lets demonstrate in Python,

$ python
>>> import unicodedata
>>> sequence=[65, 0x301]     # That's 'a' and acute
>>> result = unicodedata.normalize('NFC',"".join(map(unichr, sequence)))
>>> result
>>> print len(result)
>>> print result

That long line above takes the array, applies the unichr() function on each member so that they become Unicode characters and then joins them in a single string. Finally, it normalises the (decomposed) string to a single character. The fact that the resulting string has length 1 (single character) is key to this optimisation. Over 1000 compose sequences can be removed from the compose table through this optimisation. This includes a big chunk of the Latin Unicode blocks, about a few dozens of Cyrillic characters, all of modern Greek and Greek polytonic, some Indic languages (are they actually used?) and other misc sequences.

Matthias laid out the requirements for the optimisation of the remaining compose sequences; ① it has to be static const so a single copy is shared all over the place, ② the first column (out of six) is repeated too often, thus use subtables, and ③ each row ends with a varying number of zeroes, so cut on those zeroes as well. This also required the automatic generation of the optimised table using a script.

The work has not finished yet, and requires testing of the patch. The high priority testing is that keyboard layouts do not get any regressions (that is, compose sequences with dead keys must continue to work along with any new sequences).

With an updated compose table in GTK+, one can write things like ⒼⓃⓄⓂⒺ and all variations of accents on characters, in an easier way.

I’ld like to thank Matthias and Tor for their support in this work. And Jeff for adding this blog to Planet GNOME!

ert-archives.gr: “Linux/Unix operating systems are not supported”

ERT (Hellenic Broadcasting Corporation) is the national radio/television organisation of Greece.

ERT recently made available online part of its audio and video archive, at the website http://www.ert-archives.gr/

When browsing the website from Linux, you were blocked with a message that Linux/Unix operating systems are not supported. This message was appearing due to User-Agent filtering. Even if you altered your User-Agent, the page would not show the multimedia.

There has been a heated discussion on this on local mailing lists, with many users sending their personal polite comments to the feedback page at the ERT website. Many individual, personal comments have value and are taken into account.

Since today, http://www.ert-archives.gr/ does no do filtering on the User-Agent, and has changed the wording at the support page saying that

Σχετικά με υπολογιστές που χρησιμοποιούν λειτουργικό σύστημα Linux σχετικές οδηγίες θα υπάρξουν στο άμεσο μέλλον.

which means that they will be providing instructions for Linux systems in the immediate future.

Going through the HTML code of http://www.ert-archives.gr/ one can see that the whole system would work well under Linux, out of the box, if they could change

<embed id=”oMP” name=”oMP” width=”800″ height=”430″ type=”application/x-ms-wmp


<embed id=”oMP” name=”oMP” width=”800″ height=”430″ type=”video/x-ms-wmp

Firefox, with the mplayerplugin, supports the video/x-ms-wmp streaming format. You can verify if you have it by writing about:plugins in the location bar and pressing Enter. For my system it says

Windows Media Player Plugin

File name: mplayerplug-in-wmp.so
mplayerplug-in 3.40Video Player Plug-in for QuickTime, RealPlayer and Windows Media Player streams using MPlayer
JavaScript Enabled and Using GTK2 Widgets
MIME Type Description Suffixes Enabled
video/x-ms-wmp Windows Media wmp,* Yes

I am not sure if the mplayerplugin package is installed by default in Ubuntu, and I do not know what is the workflow from the message that says that a plugin is missing to the process of getting it installed. If you use the Totem Media Player, it instructs you to download and install the missing packages. I would appreciate your input on this one.

A workaround is to write a Greasemonkey script to replace the string so that Firefox works out of the box. However, the proper solution is to have ERT fix the code.

I must say that I would have preferred to have Totem Movie Player used to view those videos.
ERT Ecology
I just finished watching a documentary from the 80s about ecology and sustainability of the forests on my Linux system. It is amazing to listen again to the voice-over which is sort of a signature voice for such documentaries of the said TV channel. The screenshot shows goats in a forest, and mentioning the devastating effects of said animals on recently-burnt forests.

Update (22Mar08): The problem has not been resolved yet. Dimitris Diamantis offers a work-around at the Ubuntu-gr mailing list.

Localisation issues in home directory folders (xdg-user-dirs)

In new distributions such as Ubuntu 7.10 there is now support for folder names of personal data in your local language. What this means is that ~/Desktop can now be called ~/Επιφάνεια εργασίας. You also get a few more default folders, including ~/Music, ~/Documents, ~/Pictures and so on.

This functionality of localised home folders has become available thanks to a new FreeDesktop standard, XDG-USER-DIRS. xdg-user-dirs can be localised, and the current localisations are available at xdg-user-dirs/po.

A potential issue arises when a user logs in with different locales; how does the system switch between the localised versions of the folder names? For GNOME there is a migration tool; as soon as you login into your account with a different locale, the system will prompt whether you wish to switch the names from one language to another. This is available through the xdg-user-dirs-gtk application.

Another issue is with users who use the command line quite often; switching between two languages (for those languages that use a script other than latin) tends to become cumbersome, especially if you have not setup your shell for intelligent completion. In addition, when you connect remotely using SSH, you may not be able to type in the local language at the initial computer which would make work very annoying.

Furthermore, there have been reports with KDE applications not working; if someone can bug report it and post the link it would be great. The impression I got was that some installations of KDE did not read off the filesystem in UTF-8 but in a legacy 8-bit encoding. This requires further investigation.

Moreover, OpenOffice.org requires some integration work to follow the xdg-user-dirs standard; apparently it has its own option as to which folder it will save into any newly created files. I believe this will be resolved in the near future.

Now, if we just installed Ubuntu 7.10 or Fedora 8, and we got, by default, localised subfolders in our home directory (which we may not prefer), what can we do to revert to non-localised folders?

The lazy way is to logout, choose an English locale as the default locale for the system and log in. You will be presented with the xdg-user-dirs-gtk migration tool (shown above) that will give you the option to switch to English folder names for those personal folders.

Clarification: It is implied for this workaround (logout and login thing), you then log out again, set the language to the localised one (i.e. Greek) and log in. This time, when the system asks to rename the personal folders, you simply answer no, and you end up with a localised desktop but personal folders in English. Mission really accomplished.

If you are of the tinkering type, the files to change manually are

$ cat ~/.config/user-dirs.locale




$ cat ~/.config/user-dirs.dirs

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you’re
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR=”$HOME/yyy”, where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR=”/yyy”, where /yyy is an
# absolute path. No other format is supported.
XDG_DESKTOP_DIR=”$HOME/Επιφάνεια εργασίας”
XDG_DOWNLOAD_DIR=”$HOME/Επιφάνεια εργασίας”

Personally I believe that having localised names appear under the home folder is good for the majority of users, as they will be able to match what is shown in Locations with the actual names on the filesystem.

There will be cases that software has to be updated and bugs fixed (such as in backup tools). As we proceed with more advanced internationalisation/localisation support in Linux, it is desirable to follow forward, and fix problematic software.

However, if enough popular support arises with clear arguments (am referring to Greek-speaking users and a current discussion) for default folder names in the English languages, we could follow the popular demand.

Also see the relevant blog post New Dirs in Gutsy: Documents, Music, Pictures, Blah, Blah by Moving to Freedom.