Save Text Selection as a Tomboy Note with Autokey

Dmitri Popov

Productivity Sauce

Jun 16, 2011 GMT
Dmitri Popov

Since Autokey supports Python, you can automate virtually any task using simple (or complex) scripts. A recent addition to my ever-growing collection of handy Autokey scripts is a relatively simple solution for saving text selections as Tomboy notes:

import sys, dbus, gobject, dbus.glib 
snippet = clipboard.get_selection() 
retCode, title = dialog.input_dialog("Note Title", "Enter note title:") 
bus = dbus.SessionBus() 
obj = bus.get_object("org.gnome.Tomboy", "/org/gnome/Tomboy/RemoteControl") 
tomboy = dbus.Interface(obj, "org.gnome.Tomboy.RemoteControl") 
  tomboy.GetNoteTitle(newnote) + "\n\n" + snippet) 

The script above is largely based on stuff from the Using the Tomboy D-Bus interface article published on Ars Technica. All I had to do is to tweak a few things; for example, I added an input dialog that prompts the user to specify a note title.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More