About me

Music producer, (ex-)DJ, electronics tinkerer, Linux enthusiast and coder.

Indicator for Gnote

My favorite note-taking app Tomboy is no longer available in Ubuntu software repositories since 19.04. The similar Gnote lacks the handy indicator menu (also known as a tray icon) providing quick access to recently edited notes, so I rolled my own.

I've built many indicator apps for my my own use, so creating one for Gnote was pretty easy with Python's GTK bindings. The script watches for changes in the directory where Gnote stores the notes and then updates the indicator menu accordingly, reading note titles from their XML data. The simple XML stuff actually became the biggest headache, as Python's high-level XML modules don't have options to ignore namespaces (see this issue, for example). I decided to write a parser of my own, reducing dependencies and memory footprint. Win–win!

The indicator should work on all GTK-based desktops like GNOME, Xfce, Unity, MATE, Cinnamon, and so on. Python 3.5 or newer is required, and you'll also need Gnote, of course.

Use these commands to install my Gnote indicator on your system:

wget https://github.com/Martinique/indicator-gnote/raw/master/indicator-gnote
chmod +x indicator-gnote
sudo mv -f indicator-gnote /usr/local/bin

It's a bad habit to run unknown scripts, of course, so you can open it in a text editor (or on Github) and read through it to see that it doesn't, for example, "phone home" or access any other files besides the notes in ~/.local/share/gnote.

You can start the indicator from a terminal or Alt+F2 by entering indicator-gnote. You might also want to add it to your Startup Applications to have it start automatically.

If the indicator fails to start, complaining that "Namespace AppIndicator3 is not available", you'll need an additional package:

sudo apt install gir1.2-appindicator3-0.1

There's a convenience option to alter the maximum number of notes displayed (10 by default), so if you want to see more, run it with indicator-gnote -c 20

Please comment if you come up with some better code to improve this. For instance, memory usage is higher than I expected, and I couldn't figure out why.


Post a Comment