The past couple of weeks have been busy for just about everybody at Canonical as we prepare for the release of Ubuntu 12.04, which is shaping it to be a remarkable release indeed. But I was able to spend a little bit of time hacking on Hello Unity again (see episode 1 and 2), and it has received two updates this week.
New in 0.3: Sound Menu
I was stuck on this one for a while, it appeared at first that the libunity API wasn’t working from Python, but with the help of Conor Curran I was able to trace the source of my trouble back to the fact that my .desktop file has a space in the Name field. Removing that got me back on track, and I was able to quickly finish adding Sound Menu integration.
This demonstrates how to integrate a media player with the Unity sound menu, how to respond to user interaction with that menu’s playback controls, and how to send information to the menu about the playback state and current track metadata. It also demonstrates adding a Playlist to the menu.
New in 0.4: Quicklists
Talking with Jono Bacon the other day about his Accomplishments application, I decided that Hello Unity should demonstrate how to add Quicklists to the Launcher. There are two ways to do this in Unity, statically in the .desktop file, and dynamically using libunity and Dbusmenu. For now I’ve only implemented the dynamic lists.
This will add a Quicklist action item for each of the sections in Hello Unity. Clicking on one of those menu items will call a function in the Launcher demonstration code that will bring that section’s tab forward.
There is still more that I plan on adding to Hello Unity, but it’s already covering many areas for Unity integration available to application developers. Here’s the breakdown of what Hello Unity currently demonstrates:
- Progress Bar
- Dynamic Quicklists
- Message Menu
- Indicator Count
- Set Menu Attention
- Sound Menu
- Playback controls
- Track Metadata
Throughout writing this program, I’ve been constantly surprised at just how easy it is to integrate with Unity. All of the implemented features above still amounts to less than 500 lines of actual code.