Linglish, or, some thoughts on a scripting language for the Linux desktop

After a few hours of fiddling around, I’ve come up with a thing I’m calling “Linglish”: it’s a very simple scripting language for the Linux desktop. It looks a lot like AppleScript, and it’s nowhere near finished. It basically allows you to write in a sort of bastardised English which then calls D-Bus functions, so you can say things like:

  • tell screensaver to lock
  • tell banshee‘s window to present
  • tell banshee‘s playerengine to pause
  • tell tomboy to createnamednote withMy Named Note
  • tell guake to add_tab
  • wait for tomboy‘s noteadded then tell banshee‘s playerengine to toggleplaying
  • wait repeatedly for tomboy‘s noteadded then tell banshee‘s playerengine to toggleplaying
  • wait 6 times for tomboy‘s noteadded then tell banshee‘s playerengine to toggleplaying

Like I say, it isn’t finished yet (the above all works, but there’s lots more that needs to happen). At the moment, for example, there’s no way to run more than one command, or to get a return value from any function and react on it. The question is, is this a good idea that’s worth pursuing? This will never be (and is obviously never intended to be) a replacement for a proper language; if you want to do something semi-complicated, drop into Python or JavaScript or Vala or C and make the D-Bus calls yourself. However, I can see it being useful to help people who don’t want to get to grips with proper programming but still want to control their applications. If you think it’s a bad idea, please let me know why and what you think should happen instead. If you think it’s a good idea, then here are a couple of other thoughts that I’ve had on how it might evolve:

  • A script editor program would be nice, which could dynamically inspect D-Bus to help you write scripts. It could compile a script to an executable that wouldn’t need the script runtime either without too much difficulty (one big Python script, perhaps, or using glick to make an actual executable).
  • Obviously it needs to be able to run multiple commands, and have later ones react to what happened in earlier ones. I’m imagining an ask banshee's engine for position sort of sentence, which would get the Position property and then stash it in an invisible result variable, meaning that the next command could be tell banshee's playerengine to seek to the result + 20 or something similar.

Key question is: is this worth pursuing? Or is it reasonable to demand that people who want to script our desktop should learn a more real programming language? Code (written in Python) in svn at http://svn.kryogenix.org/svn/linglish/; it’s only half a dozen files. If you want to fiddle with the grammar to add new ways of parsing commands you’ll need yapps2 (in Ubuntu as yapps2), and you’ll need the yapps2 runtime to actually run any commands (in Ubuntu as yapps2-runtime). Syntax: python linglish/runner.py -c "tell tomboy to createnamednote with 'named note'"

I'm currently available for hire, to help you plan, architect, and build new systems, and for technical writing and articles. You can take a look at some projects I've worked on and some of my writing. If you'd like to talk about your upcoming project, do get in touch.

More in the discussion (powered by webmentions)

  • Christian Kruse responded at twitter.com Well, I wish you success. An easy to use scripting language for writing simple automation for the Linux desktop would be nice.
  • Stuart Langridge responded at twitter.com Cabin isn't AppleScript -- it's a proposal for a way to write new (simple) apps, not to automate existing ones. (I too would like something AppleScrip…
  • Monica Ayhens-Madon responded at twitter.com