Spotlight | Reviews | Current Issue | Academy | Newsletter | Subscribe | Shop |
Departments

Yatego Shopping
Yatego International
Germany's Shoppingmall No.1! 10000 Shops and over 3,4 Mio. Products. Computer, Software and Technic Guidebooks.

user friendly

Admin Magazine

ADMIN Network & Security

Subscribe now and save!

 ADMIN - Explore the new world of system administration! ADMIN is a smart, technical magazine for IT pros on heterogeneous networks. Each issue delivers technical solutions to the real-world problems you face every day. Learn the latest techniques for better:

  • network security
  • system management
  • troubleshooting
  • performance tuning
  • virtualization
  • cloud computing

 on Windows, Linux, Solaris, and popular varieties of Unix.

http://www.admin-magazine.com/

  linuxpromagazine.com » Online » Blogs » Productivity Sauce » Save Text Selection as a Tomboy Note with Autokey  

Productivity Sauce
Productivity Sauce

Save Text Selection as a Tomboy Note with Autokey

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") 
newnote=tomboy.CreateNamedNote(title) 
tomboy.SetNoteContents(newnote, 
  tomboy.GetNoteTitle(newnote) + "\n\n" + snippet) 
tomboy.DisplayNote(newnote)

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


Print this page. Recommend
Share