Saturday, April 19, 2008

Konsole - KDE 4.1 Changes

I had a few emails recently asking for a summary of changes in the terminal and in particular 'Send Input to All' which was missing from KDE 4.0. So here are the changes in 4.1, in addition to the many bug fixes and tweaks.

  • Copy Input To dialog allows input to one session to be copied to all or a subset of other sessions. (Like 'Send Input to All' in KDE 3 but more flexible)

  • Drag and drop re-arrangement of tabs and movement of tabs between windows.

  • Better warnings and fallbacks if starting the shell fails (due to missing binary or crash).

  • Transparency is available by default (with an option to forcibly disable it)

  • Support for bi-directional text rendering. (Diego Iastrubni)

  • New 'Dark Pastels' colour scheme (adapted from one by Christoffer Sawicki)

  • Mouse-wheel scrolling in less and other non-mouse enabled terminal applications

Nothing ground breaking here but it should make KDE 4.1 a nice step forwards from KDE 3.5 for those who have stayed away from KDE 4.0.

In other news, like several other KDE developers I have started using git and git-svn locally. It is a huge improvement over SVN, especially when developing experimental features that touch many parts of the code alongside bug fixes to the current trunk. It does make you wonder how you ever managed before. A quick "git branch" on my current local checkout shows 10 branches for various little features in progress, for example:

custom-pty-fd
image-background
inheritance-ui
* master
port-to-mono
profile-editor-binding
profile-editor-improvements
window-tab-settings

Interestingly though and perhaps paradoxically given the open nature of the project, one of the most useful benefits is the ability to create branches to work on features without telling the whole world. There is much emphasis on the benefits of incremental development but at the same time I think it is important to be able to do some things in private so that they can arrive on the scene with a bang that gets attention. Compiz or git being good examples.

Monday, March 24, 2008

Users and User Research

I'd like to second Celeste's recent posts about user-research. Having watched KDE development fairly closely for a couple of years now I agree that it is why, despite many man-hours of development, some projects just aren't as useful as they could be.

A classic example for me is the story of my first patch to KDE. KDE's education suite includes a tool called KMPlot which takes a mathematical expression and plots it as a graph. At secondary school my teachers used a similar program called OmniGraph heavily. Aside from looking and feeling somewhat dated it had a raft of minor irritations which could easily be fixed with access to the code.

I wanted something similar to help with assignments at home and I found KMPlot (KDE 3.4x). I fired it up and entered a simple equation:

y = sin(x)

I was met with a somewhat cryptic error. It turns out that KMPlot required equations to be defined as named functions ( name(x) = expression ). Children at secondary schools in England don't learn about these until A-Levels, 4 years after they start playing with graphs. Whoops! My first patch fixed this by accepting "y = expression" equations and then re-writing them internally.

A more signficant problem was the interface design. A common use of OmniGraph was for teachers to load it up on their PC in a classroom which was connected to a projector. They would then enter several related equations into OmniGraph and use laser-pointers, electronic white-board pens or wooden rulers to explain the relationships between the various equations and their graphs. This environment imposes a couple of major requirements:

  • Projected images generally have poor contrast. The equations therefore need to be displayed in a big colorful font so that they can be read at a distance by pupils in a classroom.

  • In order to compare multiple equations and their graphs, equations need to be displayed alongside their graphs.

In KDE 3.x KMPlot only showed the graphs in the main window. Equations were hidden in a separate window and were displayed only at ordinary text size. Not difficult to fix during the design stages but really hurts its use in a classroom environment. Happily KMPlot in KDE 4.x goes some way to addressing these problems - although the interface is not as clean and uncluttered as OmniGraph. On the plus side, the graph rendering is much more attractive in KMPlot.

Sunday, December 30, 2007

Finishing touches and embedded terminal improvements

The KDE 4.0 release is now very close, so I have been concentrating on fixing bugs and tidying up loose ends. Many bugs and missing menu items in the embedded terminal have been fixed in recent days.

A number of features found in KDE 3's Konsole have not been implemented to acceptable standards yet and the UI for them has been removed. Konsole/KDE 4.0 will not have:

  • Session management (ie. remembering the tabs open in Konsole windows when logging out)

  • Sending input from one tab to all other tabs ("Send Input to All")

  • Support for terminal programs resizing the terminal window

The good news is that the embedded Konsole part became much more flexible in recent days as I fixed the context menu in the part so that it exposes features which were not previously available from the embedded terminal (in KDE 3 or the KDE 4 betas)

  • Profiles, including the default profile, are shared with the main Konsole application. They can be manipulated in the embedded terminal via 'Manage Profiles', 'Edit Current Profile' and 'Change Profile' on the context menu.

  • Save output as plain text or HTML

  • Scrollback options and clearing

If there are any particularly annoying bugs which you want to see fixed before the release, please make sure they are filed on bugs.kde.org and add votes to them to help me prioritise them. Thanks to everyone who has been testing the KDE 4 pre-releases and a happy new year to all :)

Tuesday, December 11, 2007

Memory-efficient KDE 4 debugging

The GNU Debugger (gdb) is the standard tool for debugging applications on Linux. Unfortunately starting a KDE 4 application using the gdb debugger as it comes "out of the box" takes a long time (over a minute on my laptop) and uses vast amounts of memory (> 500MB) due to the time required to load the debugging 'symbols' (class names, method names etc.). This a problem especially if you have built Qt, kdelibs and other important libraries with debugging information. If you are running on a machine with less than 1GB RAM (eg. my 512MB laptop used for development) then your system is likely to slow to a grinding halt for a while.

As I discovered talking to other KDE hackers at FOSSCamp 2007, this means that some people never use the debugger at all, relying solely on debugging messages printed by the program as it runs.

One solution to this is to only load debugging information for the code which you are interested in debugging. I wrote an email on the KDE developers list about how to do that here, which was written up more clearly by Constantin here (his blog does not appear to be syndicated on PlanetKDE, so hopefully this reaches a wider audience). One important thing to bear in mind is that you can only ask gdb to set breakpoints (ie. stop execution in) functions for which debugging information has been loaded.

Manually asking gdb to load the 3-6 libraries you need to debug a given problem can be quite a hassle. What I do is to define a few functions in my ~/.gdbinit file to load commonly used subsets of libraries. In order to debug most problems, you need the core Qt,KDE and C libraries loaded plus your application code. These all load relatively quickly and won't use too much memory, so it is usually useful to load them all together. If you need to examine the state of Qt widgets or other GUI-related things then you will need to load the QtGui library. This takes a few seconds and uses a fair amount of memory so it should be avoided otherwise.

Add the following to your ~/.gdbinit file,

def load-common-kde-libs
shar libc
shar glib
shar QtCore
shar kdecore
end

def load-gui-kde-libs
shar QtGui
shar kdeui
end

Then when debugging a KDE application, start the application with set auto-solib-add off (I put this command inside ~/.gdbinit as well, see the linked blog most and email above) and then interrupt it using Ctrl-C. Run load-common-kde-libs and then load any libraries specific to your application, usually shar <appname> will catch them. In many cases, this will be enough information to get useful backtraces (using bt) and examine the state of the application. If when you run the bt command the backtrace includes calls to functions inside the QtGui,kdeui or other libraries near the top before the calls to functions in your application's code then you will need to load those as well and then re-run bt in order to find out where in your code the problem is.

As mentioned on the KDE TechBase page, there is a script in SVN (trunk/KDE/kdesdk/scripts/kde-devel-gdb) which includes really useful gdb functions for debugging KDE applications, such as printq4string (prints the contents of QString objects) and identifyq4object (prints the class name of an object which inherits from QObject).

Other KDE debugging tricks

  • Stepping through an application which was built with compile-time optimization enabled (the default) can produce some really weird results because during compilation, the structure of the code may be altered and variables or function calls can be removed ('optimised out') to improve performance. Optimizations can be disabled by passing -DCMAKE_BUILD_TYPE=Debug to cmake when setting up the build. The resulting programs will run more slowly, depending on how much of the Qt/KDE library stack is built without optimisations (in my case, everything from Qt and up is).

  • Some applications in KDE (eg. dolphin, konsole) are single-instance, which means that there is only ever one process for that program. If you start a second copy of that program then it contacts the first, asks it to create a 'new instance' (usually this means a new window) and then immediately quits. Applications which are single-instance support the --nofork argument to prevent them from creating a new process on startup. You can find out whether an application supports this by looking at the output of appname --help-kde. If you are debugging such an application, you need to run it with the --nofork argument. In gdb you can do this by executing set args --nofork before running the program.

  • Some KDE components (eg. plasma) have their own crash handlers to trigger an automatic restart or bring up a specialized bug reporting tool (eg. amarok) in case of a crash. These custom crash handlers interfere with normal debugging, and they can be disabled by passing the --nocrashhandler argument on startup (like the above --nofork).

Over the Christmas period I hope to find time to write this up on the KDE TechBase page. Please try out the above and reply to this post with any problems/comments/queries so I can include the answers when I get around to it.

Monday, October 29, 2007

FOSSCamp

This weekend I was invited by Jonathan Riddell of Kubuntu fame to attend a completely unscheduled conference in Cambridge, MA called FOSSCamp. Most of the attendees were Canonical employees but there were many representatives from other projects and companies (such as gnome, Red Hat, Samba, the FSF) as well. I was joined by Troy from KDE's publicity machine and Leo, Jeff from Amarok. Thank-you to Canonical (Jonathan and Claire in particular) for inviting us.

I have never been to an 'unconference' before, but there were many interesting sessions going. Unfortunately given that there were 3-5 happening at any one time on the first day, I missed a few that I would have liked to attend. Here is a summary of the sessions which I was able to participate in.

Suspend and Resume

The first session I attended was a whistle-stop tour through the seedy and hack-filled world of what happens when your laptop goes to sleep and wakes up again, led by Matt Garratt. After a basic introduction to how suspend and resume are supposed to work, Matt explained why it doesn't always. The next few sentences allude to terrifying hacks and should not be read by young children and people of a nervous disposition.
The main problem faced at the moment is getting the video hardware programmed correctly on resume. Currently the BIOS is tricked into running its own video setup code on resume which may or may not work. Better documentation from the manufacturers should help but it is slow to appear. Debugging suspend and resume (using the system clock as a debug data store!) was also covered. The need for more public details on the process was raised and they will probably appear in the Ubuntu wiki soon.

HotWire

HotWire is a replacement for the standard shell. It is both a text-driven graphical user interface and an object-orientated command line written in Python. The front-end is designed to greatly improve the accessibility of the shell with better auto-completion and history preservation. It can also use a modern graphical UI to visualize the output of commands. For example, typing "ls" produces a list of files in the current directory with appropriate icons and columns which can be resized and arranged. Commands are executed asynchronously so that multiple commands can be executed simultaneously and their output switched between much more easily than a conventional terminal. The downside when I last tried HotWire is that it didn't feel as responsive as a normal terminal. There are also quite a few bugs to fix and polishing required to make it feel slicker and a more natural experience.

The other aspect of HotWire, the object orientated shell, was the one which garnered much more interest. Current UNIX shells pass simple byte streams between applications. Like Microsoft's PowerShell, the idea is that passing objects between commands could allow for much more powerful command lines and less error-prone text processing. Quite a few attendees at the session were interested in having a better object shell but still wanted to use it from within their existing terminals (which include the Linux terminal on machines without X, emacs and text editors or IDEs with shell plugins).

GNOME Online Desktop

Like Hotwire, there are several aspects to Gnome's online desktop, some more interesting than others. One aspect is re-engineering applications to sync with online services and make use of data from them out of the box with minimal effort on the part of the user. This is something which would probably be very valueble to many KDE users as well since they could use their favorite KDE applications for work and communication and still share the results easily with friends or get access to the information regardless of the PC or other device they are using. Another aspect is 'Big Board' which, from what I saw at the demo, provides a summary view of information of interest to the user across various local and online services. It also brings the concept of an online identity more prominently onto the desktop and provides facilities to sign into various online services without having to go to their website. Plasma has a few applets which do similar things with regards to providing status snippets and updates for online and local services so it would be possible, if Plasma was working as it should be, to create something that looked like Big Board. What 'Big Board' has in its favor is a much more cohesive design from the end user's perspective such that the various parts fit together out of the box in a way which is useful. The downside is that at the moment it does not appear to be all that flexible and is limited in the range of services that it can talk to. One of the attendees suggested that it should use Evolution Data Server to get its calendar, TODO, status updates and other data. In the KDE world, the equivalent would be Akonadi. Having a side-panel which displayed aggregated summary updates from my various mail sources, calendars and so on which are spread across multiple web sites, local and remote files would certainly be quite useful. With Qt 4 eye candy it could look very pretty. At one point during the demonstration the internet connection failed and 'Big Board' became a big white empty space at the side of the screen. Better off-line support is obviously a requirement.

Looking at the web-site there are parts of the system (such as the web sign in daemon) which seem like good candidates for cross-desktop collaboration.

The other major aspect of the OD project is the server which stores a subset of users' settings (including desktop setup and I guess personal information and passwords etc.) online.

There is lots to think about as far as KDE and online services are concerned. KDE's libraries (new and old) provide a good technical foundation on which some really neat applications could be built. The question is how to approach this from the user experience perspective, that is not something which I have seen a big discussion on yet.

Freedom for Web Services

Brett Smith of the Free Software Foundation lead a discussion on what 'free' means in the context of online services and how the advantages of online services might be provided in a way which preserves this freedom. Apparently the FSF's position is that no centralized online service can meet their definition of free because the users of such a service cannot modify the code which is run when the service is used, even if the service provider makes the code available (which most do not). In this view, even something like Wikipedia does not qualify as free and the problem becomes a technological rather than legal one to invent a new means of delivering such services.

There was some discussion around the distinction between freedom as it relates to software which an online service uses to process data and the freedoms users have over the data they create and store in the service. The need for an easy way to convey these data freedoms was raised. My personal view is that large centralized online services (as opposed to the FSF's theoretical alternatives) will be a reality for the foreseeable future and therefore companies need more incentives to provide users with freedom over their data. An example might be a simple labeling system. In the UK food now comes with 'traffic light' labels on the packaging to indicate in simple terms how good or bad it is for you (in terms of fats, salt, sugar, proteins etc.) which has had some success in encouraging sales of healthier food and discouraging sales of unhealthy food. Perhaps the same idea could work for online services. The idea being that if a user Mike has a choice of "Larry's Calendar Service" or "Sergey's Calendar Service" he would be able to see a simple 'freedom rating' for the service and factor that into his decision. The problem of course is that the choice might largely be determined by the service which Mike's friends use rather than the service's features.

KDE 4 Libraries and Technologies

This was quite a busy session lead by Troy with discussion of the new libraries in KDE 4 and how they relate to other parts of the Linux platform. The usual topics of Qt 4 and KDE's new libraries for multimedia, hardware, search and the semantic desktop were also discussed. Leo and Jeff from Amarok were on hand to discuss the implications of these libraries in real, working applications.

* WebKit was probably the topic which attracted the most interest as it is relevant for both Gnome and KDE developers. WebKit/KHTML's CSS 3 support was trumpeted by other developers present.
* The problem of the multitude of indexers available including Strigi,Tracker etc. attracted some attention. I mentioned XESAM as a specification which allows client applications to be indexer-independent for queries. Mark Shuttleworth noted that this left the problem of how applications can provide information to indexers. I didn't know this at the time, but according to the XESAM website the specification is being developed incrementally and that facilities to do this might form part of the second iteration.

One of the participants mentioned the need for a demo KDE 4 application (like Qt's qt-demo) which shows off KDE 4's new features and provides simple working code which new developers can make use of in their own applications. I agreed but pointed to the applications in kdegames and kdeedu as the best place to start until such an application is written.

I mentioned Akonadi briefly which generated some interest. Unfortunately at the moment it is difficult to demonstrate in a really meaningful way.

Education

This session became a demonstration of KDE 4's educational applications. Marble in particular attracted attention from the participants. One point that did come up in the discussion was the usefulness of being able to adjust an educational product to fit in with different cultures and environments. An example given was an educational authority which wanted to remove smoking-related items from KTuberling. In KDE 4 this should be much easier to do given the use of SVG objects which allows individual items in scenes to be adapted and removed. I attempted to given an impromptu demonstration with Inkscape, but it wasn't quite as easy as I hoped since I picked the wrong file to edit. More documentation for distributors on how to edit or create new resources for applications would be useful.

The importance of making educational applications and games which work well on thin client systems was also raised. Firefox was cited as a problematic application because of the memory used for X pixmaps. There was hope that a WebKit browser would help in this area. For KDE, it is not easy to judge the problems until someone actually attempts to use the applications in such an environment.

Upstream Patch Flow

This session was a debate and discussion on how we (upstream) can discover and manage patches produced by distributions. Ubuntu hackers pointed to a few resources such as Ubuntu Merges which can help upstreams keep track of patches. Unfortunately both upstream and downstream have the same problem in that they have a large number of suppliers and consumers respectively which all have different systems for managing and accepting patches. Something which Ubuntu can do in the short term is automated emails to upstream maintainers about patches which are added. A quick review of patches to kdebase/kdelibs showed that much of what is patched or added are changes to the build system which is less interesting than changes to the code itself.

KDE 4 Applications

This session took part on the second day which was considerably quieter. I demonstrated a wide range of KDE 4 applications from various KDE projects to a small audience of about 15. There was appreciation for many of the new features, although in order to really impress people the front-end needs to be much slicker. The colour scheme which ships with the Oxygen style does not work very well on projectors or lighter flat screens at the moment, adjustments are definitely required in this area. Leo and Jeff lead a demonstration of the new features which Amarok 2 will provide including more online services, a new playlist, a much more prominent canvas for displaying contextual information and better plug-and-play support for a variety of media devices.

I was also asked about PIM applications afterwards. As many readers will know, the PIM applications shipped with KDE 4.0 will be fairly similar to their KDE 3.5 counterparts. Akonadi should make much more exciting things possible.

Thursday, September 27, 2007

Kickoff redux

As Sebas' mentioned recently, I have been working on a new implementation of the Kickoff start menu/application launcher. It is currently functional, although I have not started work on some of the presentational aspects yet (such as the background and tab styling). Hence no screenshots in this post. If you are testing KDE 4 on a system with KDE 3 installed, then in the case of applications for which both KDE 3 and KDE 4 versions are available, only the KDE 4 version will be shown. The search view is currently limited to application searches, but I hope to have Strigi searching working soon. Ideally query handlers will be shared between the launcher and the run dialog.

The new Kickoff can be found in trunk/playground/base/kickoff-rewrite-kde4/ and it currently builds both as a standalone application ('kickoff') and a Plasma applet ('Application Launcher' in the 'Windows and Tasks' category). The Plasma applet is a simple KDE logo button which pops up the menu when clicked on.

Hopefully Kickoff will ship with Beta 3 next week.

This new implementation is being done from scratch using Qt 4 / KDE 4 frameworks. This is the first time I have made any real use of some of the new KDE 4 libraries; they are great to work with and a few little extras have been added as a result. For example, one minor detail I added compared to KDE 3's Kickoff is that in KDE 3, the 'My Computer' tab always has an icon of a tower desktop system. In the new KDE 4 Kickoff the icon will change to a laptop or a tower depending on what kind of system it is being run on - and that is done with a couple of lines of code.

Finally, feedback is always welcome. If you are an OpenSuSE/KDE user who uses the Kickoff menu on a regular basis, feel free to add your thoughts to this post's comments :)

Thursday, September 13, 2007

Funny languages in the terminal

When I look at Arabic, Chinese or Japanese text all I see are some odd squiggles. Some text that used to produce square-looking squiggles in KDE 3 now produces more curvy squiggles in KDE 4. Apparently this is a good thing. Most of this is down to Qt 4. But I still don't know whether it is readable to people who normally see something other than squiggles.

I had a stab at adding input method event support to Konsole in trunk recently, but I am very limited in my ability to test it. There is a bug report to file comments against.

If you can read and write in these languages, or even better, understand the mysterious world of Unicode - please help me to find bugs in Konsole's language support so that I can fix them.