UnityHacking

App Developer Week -- STORY: Unity, hacking on a real-world app -- Trevinho -- Mon, Apr 12th, 2011

   1 [22:03] <Trevinho> Hi all!
   2 [22:03] <Trevinho> I'm Marco Trevisan, also known in the Ubuntu Community as Treviño or 3v1n0
   3 [22:04] <Trevinho> just for giving few informations about me, I'm a 25 years old student in Computer Science and I'm an Ubuntu user since the release of (K)ubuntu Breezy Badger (well, I started as a kubuntu user in fact)
   4 [22:04] <Trevinho> My first approaches to the hUbuntu core were done as a 3rd party packager: I started packagin a lot of extra software in my "3v1n0" repository
   5 [22:05] <Trevinho> that was also for a certain period of time the main community reference for the ubuntu Compiz (Fusion) packages and loader scripts.
   6 [22:05] <Trevinho> In recent times I've been involved in projects like Openmoko, Freesmartphone and SHR (www.openmoko.org, www.freesmartphone.org, www.shr-project.org, all related to the free phone development), Enlightenment (http://enlightenment.org with some elementary widget library work), Vala (the new GObject based language).
   7 [22:07] <Trevinho> Few months ago when Unity was announced to be the future of Ubuntu, also for the "standard" distribution, I was so excited since for me it was the first great step that ubuntu was doing for becoming something of really different, but using an open way.
   8 [22:08] <Trevinho> This decision surely shown a great courage of the "Ubuntu headquarters", but I found that it have to be supported by the community to become real
   9 [22:09] <Trevinho> Now, Unity of course can't be considered just as the simple "lp:"unity" branch that basically includes the Compiz plugin that is able to creat the deskopt environment that we all known as "unity"
  10 [22:09] <Trevinho> Unity is more
  11 [22:10] <Trevinho> unity is a new ecosystem made of many applications and libraries which cooperates in various ways allowing to get what you see as an "united" interface.
  12 [22:10] <Trevinho> Also if it should be quite known, the unity architecture is based basically on:
  13 [22:11] <Trevinho>  * Compiz, which is the basic windows manager upon the unity interface is built
  14 [22:11] <Trevinho>  * unity-window-decorator, the windows decorator based on libmetacity
  15 [22:12] <Trevinho>  * libindicator, which is a library that factorizes some common features of an indicator, allowing to load one or a set of indicators into the unity panel
  16 [22:13] <Trevinho> * BAMF, the Application Matching Framework which allows to associate each window to an application witha related .desktop file (if it exists)
  17 [22:13] <Trevinho> Going more in the deep you can see unity (the compiz plugin) as the painter of the items that its sub-libraries and services allows to manage and connect
  18 [22:14] <Trevinho> If you look at the main parts of the unity interface you can consider the Panel, the Launcher and the Dash
  19 [22:15] <Trevinho> The Panel is, in the current implementation, basically fully populated by indicators; excluding the window title and controls, in fact, that bar is populated with (when installed):
  20 [22:15] <Trevinho> libappmenu (indicator-appmenu, the indicator showing the menu)
  21 [22:15] <Trevinho> libapplication (the indicator which loads and shows all the libappindicator's)
  22 [22:15] <Trevinho> libsoundmenu (indicator-sound)
  23 [22:15] <Trevinho>  libnetworkmenu (indicator-network)
  24 [22:15] <Trevinho> libmessaging (indicator-messages)
  25 [22:16] <Trevinho> libdatetime (indicator-datetime)
  26 [22:16] <Trevinho> libme (indicator-me)
  27 [22:16] <Trevinho> libsession (indicator-session)
  28 [22:17] <Trevinho> The unity-panel-service (see unity/services) is the daemon which loads the indicators and tells to the unity pllugin tho to show them.
  29 [22:17] <Trevinho> the unity Launcher is used for showing the icons used both for loading the dash lenses and the new application instances by type
  30 [22:19] <Trevinho> Its role is quite easy to understand, but its implmenetation is quite complex due to the fact that in the X11 system there's not a direct link between an XWindow and a desktop file, or between more windows (of the same level / hierarchy) coming from the same application.
  31 [22:19] <Trevinho> Here's where BAMF comes.
  32 [22:19] <Trevinho> That framework has been written to export any window to an higher level and to associate them to a desktop file and a "dummy" application object.
  33 [22:20] <Trevinho> All the informations that BAMF catches and organizes are finally exported via DBus to be used bu the unity launcher to understand what is happening in the desktop and to draw/manage correctly the launcher items/icons
  34 [22:21] <Trevinho> Finally the dash is the place where any unity loaded lens is shown, but I won't go more in deep here since there are some other sessions related to it.
  35 [22:22] <Trevinho> Now, to go back to my story which entitled the session, I've to say that I'm an advanced PC user and so I need that the tools I use are able to do what I expect from them; that's why every time I find and interesting project that needs some tuning I work on it to get what I'm missing...
  36 [22:23] <Trevinho> That's in practice my application of the Eric S. Raymond famous motto «Every good work of software starts by scratching a developer's personal itch» that he states in "The Cathedral and the Bazaar".
  37 [22:24] <Trevinho> Few montsh ago, my first "unity" related "itch" appeared when I found this article by OMGubuntu ( http://go.3v1n0.net/eMRF4l ) showing a way to customiz the ubuntu clock panel applet.
  38 [22:25] <Trevinho> Since I was (as I still am) a great fan of the application indicators, also in Maverick I always used the indicator-applet-complete gnome-panel applet, to reduce to the minimum the usage of the other gnome applets.
  39 [22:26] <Trevinho> So, when I found this nice trick, I looked a way to get it working in indicator-datetime too... I knew that indicator-datetime would be the future, so I decided to improve it.
  40 [22:27] <Trevinho> I never hacked the sources of an Ubuntu internal project (excluding patches), so I had to learn something about it
  41 [22:28] <Trevinho> I generally I don't use too much IRC or mailing lists, until I don't need to do that (for issues, or for RFCs), so I started my work by my own
  42 [22:29] <Trevinho> So, the basic of bazaar usage are here: http://go.3v1n0.net/fDRS9Q and I guess that everyone here knows how to use it
  43 [22:32] <Trevinho> So after branching it, I just had to work on it... And the hack I wanted to do was very easy so in few hours everything was on my branch at http://go.3v1n0.net/gwJkLo
  44 [22:33] <Trevinho> For you informations, thanks to this clock-label-improvements for indicator-datetime
  45 [22:34] <Trevinho> you can use any date/time style, included the ones you find in the OMGubuntu! article posted before with commands like:
  46 [22:34] <Trevinho> gsettings set org.ayatana.indicator.datetime time-format "'custom'"
  47 [22:34] <Trevinho> gsettings set org.ayatana.indicator.datetime custom-time-format "'%a <b>%I:%M %p</b>'"
  48 [22:35] <Trevinho> However, after this hack... I found the process of the ubuntu development very quick and open to the community
  49 [22:35] <Trevinho> so I decided to continue in my path working on other things that I missed in "my" ubuntu....
  50 [22:37] <Trevinho> A great itch I had about indicator-sound was that I wasn't able to see in aprecise way the new volume level of my system when using the scrolling hweel over the indicator icon to adjust the volume.
  51 [22:37] <Trevinho> That was a very common operation for me and since indicators doesn't support, by design, any form of tooltips
  52 [22:38] <Trevinho> I decided to implement it using a particular way, following what has already been done for the volume keys...
  53 [22:40] <Trevinho> Basically I made possible to show a notify-osd bubble showing the new volume level
  54 [22:41] <Trevinho> when a scroll-event was registerd over the indicator-sound icon; more informations about this implementation are available at the merge proposal: http://go.3v1n0.net/gNy0Qj
  55 [22:43] <Trevinho> All this work lead to me to a greater work
  56 [22:43] <Trevinho> which made me understand a lot of the unity infrastructure related to ubuntu indicators
  57 [22:44] <Trevinho> or better, an ubuntu AppIndicator
  58 === Trevinho_ is now known as Trevinho
  59 [22:51] <ClassBot> There are 10 minutes remaining in the current session.
  60 [22:52] <Trevinho> Ok I'm back
  61 [22:52] <Trevinho> sorry I had a network outage
  62 [22:52] <Trevinho> and I wasn't able to get the permission to write back :P
  63 [22:53] <ClassBot> jsjgruber89 asked: How do libapplication and unity-panel-service determine what to load?
  64 [22:53] <Trevinho> Well, libappapplication is used by applications that want to add an AppIndicator
  65 [22:55] <Trevinho> unity-panel-service is a service as the name states, that waits incoming DBus calls. These calls are perfomed by libappindicators
  66 [22:56] <ClassBot> There are 5 minutes remaining in the current session.
  67 [22:58] <Trevinho> However going back to the story.... I was telling about the libappindicator work I did...
  68 [22:59] <Trevinho> Practically I added support for developers to catch the "scroll" events over an appindicator icont too.
  69 [22:59] <Trevinho> But this work was quite complex as you can read in this bug report I did: https://bugs.launchpad.net/indicator-application/+bug/708180
  70 === emma_ is now known as em
  71 [23:00] <Trevinho> because an indicator-application is really a set of indicators
  72 [23:01] <Trevinho> and there is a mix of DBus signals and methods and glib signals to perform operations from the lower level (the libindicator) to the higher one (the unity panel)
  73 [23:01] <ClassBot> Logs for this session will be available at http://irclogs.ubuntu.com/2011/04/12/%23ubuntu-classroom.html
  74 === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat ||
  75 [23:02] <Trevinho> So, the hour is finished, but I'll use bit of extra time to end the story :P
  76 [23:03] <Trevinho> so, to make the long story short, Afther this first bounch of patches I continued with some others more unity related
  77 [23:04] <Trevinho> work with some patches
  78 [23:04] <Trevinho> to improve its look like
  79 [23:05] <Trevinho> https://code.launchpad.net/~3v1n0/unity/fading-title (which cuts long window titles with fading, that then I've made also for metacity)
  80 [23:05] <Trevinho> And the intellihide / autohide support https://code.launchpad.net/~3v1n0/unity/autohide-intellihide
  81 [23:07] <Trevinho> However, I guess that you can read more about these patches in launchpad (they are all here: http://go.3v1n0.net/fcFZO9)
  82 [23:09] <Trevinho> the important thing that I want to explain is how to get there... The first part is study the sources and army yourself with the grep and few others development tools like gedit and some gedit-plugins you like
  83 [23:09] <Trevinho> for managing the sources I've mostly used plain bazaar with the bzr-gtk plugin
  84 [23:10] <Trevinho> to use tools like "bzr glog", "bzr gcommit", "bzr gdiff" (and so on) commands which could speed up your sources versioning process
  85 [23:10] <Trevinho> Basically when you want to hack to an ubuntu project all you need to do is
  86 [23:10] <Trevinho> * branch it wit bzr branch lp:<project_name>
  87 [23:11] <Trevinho> * work on it with your tools
  88 [23:11] <Trevinho> when you're ready just push it as  a your branch of that project with
  89 [23:11] <Trevinho> bzr push lp:~YourLPname/<project_name>/<branch-name>
  90 [23:12] <Trevinho> So you need to do a merge proposal
  91 [23:12] <Trevinho> And you can do it with launchpad powerful merging tools
  92 [23:13] <Trevinho> this is the key moment.
  93 [23:14] <Trevinho> I've to say that in my experience the reviewers were always very fast to approve, and I got very few corrections (just typos), but it could happen that you get rejected or you need to rewrite something
  94 [23:15] <Trevinho> however the ubuntu developers are and I guess that will always be very open to the community contributions
  95 [23:15] <Trevinho> especially with unity coming, that is the creation of something new from the basis.
  96 [23:18] <Trevinho> About contacting the developers, I'd suggest you to use the launchpad mails or the ayatana ML if you need to do augmented discussions, but for a very fast communication
  97 [23:18] <Trevinho> it's better to use new channels as are the microblogs like twitter or identi.ca
  98 [23:19] <Trevinho> many ubuntu developers are there (see https://twitter.com/list/3v1n0/ubuntu) and I think that it's the better way to keep them in touch.
  99 [23:20] <Trevinho> Finally I remember you that if you want to start to work in Unity and related projects
 100 [23:20] <Trevinho> the best way is to start from the bitesize bugs: https://wiki.ubuntu.com/Unity/Bitesize
 101 [23:21] <Trevinho> read that wiki and the many castrojo's blogs about them go get started
 102 [23:21] <Trevinho> and join the ubuntu development!
 103 [23:22] <Trevinho> If there are no more questions (don't use the ClassBot, but just post them in #ubuntu-classroom-chat), I thank you all for the attention and who gave me this opportunity
 104 [23:23] <Trevinho> Sorry for the network issues and my time overrun...
 105 [23:23] <Trevinho> :)
 106 [23:26] <Trevinho> Ok... Good bye all so :)

MeetingLogs/appdevweek1104/UnityHacking (last edited 2011-04-13 18:27:11 by net-93-146-31-19)