First experience with Vala

Published on 10/19/2022

This article is a short resume of my first experience with Vala.

What is Vala

Vala is an object-oriented programming language with a syntax very similar to C#. The compiler could produce a native binary or generate C code.

The current version is 0.56, meanwhile I used the 0.54.1.

The language was born in 2006 and altrought it hasn’t reach the version 1.0 it’s used in a lot of GNOME applications and it’s the main choice for implementing application in Elementary OS.

Why Vala

I’m interested in the creation of GTK applications for Linux. The possibilities I found to reach this goal are:

  • Use C, but I used it only for an exam in my first university years. I was afraid to not reach a concrete result in a short time.
  • Use Python, probably the simple solution, but I was interested in creating a native application.
  • Use Go, but my perception was that the GTK libraries for Go were immature and incomplete.
  • Use Rust, but I was intimidited by the steep learning curve.

So I decided to explore Vala because:

  • it’s a language created by the GNOME Foundation with the scope to permit the implementation of native GNOME (so GTK) application at a high level.
  • it’s well integrated with GTK libraries so it permits to be immediately operative.

First impressions

Some consideration after this short experience.

I have to admit that it has been not so easy to reach my goal. I think that a lot of problems and slowness has been caused by my inexperience in developing desktop applications in general.

The official Vala documentation is valadoc.org. I found the ecosystem of libraries around the language still immature: it’s not easy to found information or examples (and often when you find something it’s pretty old). There isn’t a standardization of the documentation of the libraries. This fact doesn’t help a newbie.

Looking some examples implemented in Python, it has helped me a lot to understand how to use notifications and how to implement an indicator (the main part of my little experiment).

In the next future I’m going to try again to implement other simple applications using Vala.

Pommy

Pommy is a simple timer to measure an activity duration. It’s an indicator staying in the notification bar and it notifies you the end of the activity session.

It takes inspirations from gtk-pomo-indicator, a Python application I used for years to break my daily routine into work sessions, following some concepts from the pomodoro tecnique.

Pommy is released under GPLv3 and it is available here.

  • Article is published under CC-BY 4.0
  • If not explicitly declared code snippets are published under MIT license