Contributing to Unity for non-developers: Keywords

After all the terrific feedback and contributions we received from community contributors as a result of my Quicklists article, I’ve been asked to talk about how to contribute to improving another feature of Unity, the Applications Lens.

Search is the heart of the Unity Dash, and making search better is great way to contribute to the overall quality and usability of Ubuntu.  And just like Quicklists, there are ways you can do this without being a developer.  In this article, I will show you how to add Keywords to an application that will be used by the Dash’s search function.

Just like in my previous tutorial on Quicklists, I will once again be using Geany as my example application since it is one of my most-used programs.  Geany will be found in a search for “IDE” or “Development”, thanks to those words being in the Comment and GenericName fields of it’s .desktop file.  However, I think it should also be found in a search for “Code” and “Programming”, which it currently does not.

Step 0: File bug reports

This wasn’t part of the Quicklist tutorial, because I had already  filed bugs for the apps we were targetting.  But this time there is no list, so it’s up to you to make sure there is a bug report.  For ubuntu, you can file it against:

https://bugs.launchpad.net/ubuntu/+source/<source_name>/

It’s equally important to file a bug in the upstream’s Bug Tracker.  Refer to the stems up my post about upstreaming your quicklists for how to find your upstream.

Once you  have your bugs filed, post a link to them in the comments so that others know you are working on them.

Step 1: Getting the package code

Everything in Ubuntu exists in bzr, which makes getting the source for the package easy.  just “bzr branch ubuntu:<project>”.  For geany, this is what I ran:

bzr branch ubuntu:geany

If you followed the Quicklist tutorial, you’ll have already done this.  However, if your merge proposal hasn’t been accepted yet, it’ll be easier to do these changes on a clean branch.  You can give the name of a new directory for this checkout by running:

bzr branch ubuntu:geany ./geany-keywords

Step 2: Adding keywords

Again, just like with Quicklists, you first need to locate the .desktop file for your application.  For me, it was located in the root of the branch in a file called “geany.desktop.in”.  If you don’t see it in the root of your project’s branch, try running this command:

find ./ -name "*.desktop*"

This may not look exactly like the file in your /usr/share/applications/, since some processing is done to add translated strings for the application name and comments.  But as long as you are just adding the Keywords item to the bottom of the file you shouldn’t have to worry about that.

Next you  should look for deprecated keyword fields.  “Keywords” is a new part of the XDG specification, but your application may have already been using the desktop-specific field “X-GNOME-Keywords”.  If it does, go ahead and rename it to “Keywords”.  Also check for the existence of fields starting with an underscore, like “_Name”.  If your .desktop file has those, that means it’s probably setup for translations already, and you should use “_Keywords” instead, so that they can be translated as well.

For geany, there was no existing Keywords field of any kind, but it was setup for translations, so I used the following:

mhall@mhall-laptop:~/projects/Ubuntu/unity/quicklists/geany$ bzr diff
=== modified file 'geany.desktop.in'
--- geany.desktop.in	2012-02-24 19:30:41 +0000
+++ geany.desktop.in	2012-02-27 18:31:39 +0000
@@ -10,3 +10,4 @@
 Categories=GTK;Development;IDE;
 MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
 StartupNotify=true
+_Keywords=Code;Editor;Programming;

Step 3: Submitting to Ubuntu

Now you need to send your changes to Ubuntu.  This is very similar to what we did for Quicklists, but I’ve added one extra piece to the commit command.

bzr commit -m "Add Keywords to .desktop file" --fixes lp:942154
bzr push lp:~mhall119/ubuntu/precise/geany/add_keywords

By passing the –fixes flag, along with your Launchpad bug #, to the bzr commit command, you will automatically link your new branch with the bug report you created in step 0.

The next step is to once again propose that your changes be merged into the Ubuntu package. To do that, run the following command to open the Launchpad page for your new branch:

bzr lp-open

On that page you’ll see a link labeled “Propose for merging”, click that and fill out the form on the next page to create your merge proposal.

Step 4: Submitting to Upstream

The final step is to send your changes upstream as well.  This is good practice whenever you are making changes, plus it makes it easier for Ubuntu’s package maintainers.  Since every upstream is different in how they want to get submissions, I recommend following my previous upstreaming tutorial for this step.

This entry was posted in OpenSource, Programming, Work and tagged , , , , , . Bookmark the permalink.

22 Responses to Contributing to Unity for non-developers: Keywords

  1. Jef Spaleta says:

    Why isn’t submitting to upstream placed a step ahead of submitting to Ubuntu?

    Submitting to Ubuntu without a clear understanding as to upstream’s interest in the patch seems like your a setting up the Ubuntu package maintainer team for a long term maintainence burden unncessarily.

    -jef

    • Michael Hall says:

      Because we have a very short window for these changes to make it into Ubuntu 12.04, which is an LTS so they would be missing for a very long time. I was told that we can get them accepted as a patch to the Ubuntu package in 12.04 if they were also submitted upstream so that they would not require an Ubuntu patch in 12.10.

      • Jef Spaleta says:

        I’m not going to opine as to the trade-offs inherent in the chosen release model.

        But I would encourage you to read over the “What are you doing next Friday? ” thread on ubuntu-devel-list if you haven’t already. There may be a communication breakdown here as to what “you were told” and what other people actually want to see.

        My reading of the thread is that submitting to Ubuntu ahead of upstream is considered problematic by some who are being asked to do the sponsorship work.

        -jef

        • Michael Hall says:

          Believe me, I’ve been made aware of the communication problems that became evident during the Quicklist work. I have been in much closer coordination with them this time around.

          Yes, submitting to Ubuntu ahead of upstream causes more work on the us. Letting these improvements wait 6 months to be released, and missing out on the entire LTS lifetime of 12.04 provides less benefit to our users. We are taking a pragmatic approach by doing things this way.

          • Jef Spaleta says:

            I would have thought pragmatism would have pointed to a change in the sacrosanct release schedule to better fit realities of the pace of Unity development which is very out of sync with the Ubuntu mixed focus release cadence as I understand it. The decision making with regard to pushing Unity changes into LTS contrast quite brightly when compared to the decision making for other projects which are less directly tied to Canonical business interests at present. If Unity was set up and regard as just another upstream project, I dare say pragmatic approach would see Unity lagging in LTS to avoid a lot of last minute changes instead of the very distrinct push to cram as much new Unity features into the LTS deliverable as possible. But hey what do I know.

            Good luck.

          • Michael Hall says:

            Changing a long-standing release cadence for something as small as adding Launcher Quicklists to a dozen applications is not pragmatic.

          • Jef Spaleta says:

            I think you missed my point a little bit. the mixed cadence release model is a poor fit for certain markets (everything but server and corporate desktop deployments.) If Canonical is serious about chasing retail device OEMs, the quickstep ballroom dance-like model (quick quick slow, quick quick slow) is going to continually be a poor fit because device OEMs do not think about long term deployments as a driving factor at all and the cadency between LTS releases is way to long to meet OEM device cycle needs. Good luck. I am praying for Canonical.

  2. Nicolas Delvaux says:

    Once the rush for these new quicklists and keywords is over, please don’t forget to ping ubuntu-translators about this.

    For example, Geany translators work upstream, so they won’t be able to translate these new strings for Precise. So Ubuntu-translators will have to do it themselves, downstream.

    To sum-up, please provide ASAP a wiki-page (or similar) with all translations that require specific Ubuntu work before the release.

    • Michael Hall says:

      Only packages in Main will have these Quicklists applied for 12.04, this is specifically because we can provide translations for them and not packages in Universe. Packages in Universe we will try and get Quicklists accepted and translated upstream first, and then included into 12.10.

  3. Jeremy Bicha says:

    This has more or less been said on the ubuntu-devel-list but these merge proposals would be more useful if the changes were submitted as a quilt patch in debian/patches/ rather than making the change directly to the upstream source. Doing that takes a few more steps.

    And if the target for this is mostly main, it’s important to be aware that a large number of the default apps are actually packaged from https://code.launchpad.net/~ubuntu-desktop/ . I guess it depends on whether this contribution opportunity should be easy for people new to packaging or to the sponsors. I don’t mean to say we aren’t happy for the help because we are.

  4. Vincent Untz says:

    > +_Keywords=Code;Editor;Programming
    You’re missing the trailing “;” and this will result in an invalid .desktop file.

    • Michael Hall says:

      Thanks, I didn’t realize a trailing semi-colon was required, it didn’t seem too matter when I was testing it locally. I have updated the article to include it though.

  5. Nekhelesh says:

    Added keywords for Vlc. Here is the bug report also showing the merge request. https://bugs.launchpad.net/ubuntu/+source/vlc/+bug/943014

  6. Nekhelesh says:

    Added keywords for gnome terminal. Here is the bug report also showing the merge request. https://bugs.launchpad.net/ubuntu/+source/gnome-terminal/+bug/943020

  7. Nekhelesh says:

    Added keywords for evince. Here is the bug report also showing the merge
    https://bugs.launchpad.net/ubuntu/+source/evince/+bug/943022

  8. Nekhelesh says:

    Added keywords for evince. Here is the bug report also showing the merge request. https://bugs.launchpad.net/ubuntu/+source/eog/+bug/943028

  9. Nekhelesh says:

    Here is the bug report and merge request for gnome-system-monitor. https://bugs.launchpad.net/ubuntu/+source/gnome-system-monitor/+bug/943032

  10. yesmathew says:

    I am not happy with the way I have to search application. Currently it is only thru dash. What if I do not remember the name of the application. How I will find it out? Thanks.

    • Michael Hall says:

      Search works on more than just the application’s name, such as these Keywords we’re adding. You don’t need to remember whether you have Firefox of Chromium installed, just search for “web” or “browser” and it will be found. A search for “chat” will give you results for Empathy, Pidgin, or whatever other chat program you have installed, as well as chat programs available to install. As long as you know what you want to do, the Dash will be able to find it for you.

  11. Pingback: Ubuntu Weekly Newsletter Issue 255 | Ubuntu Linux FAQs

Comments are closed.