Be Free to Have Multiple Clocks
Back in ye olde days there was a running gag that Plasma was all about clocks. With its then-new widget system you could add as many as you wanted, after all. Plasma included not only an analog and a digital clock, there was a binary clock, too, and my all-time favorite fuzzy clock that shows the current time in a colloquial textual way, such as “Quarter to seven”.

For Plasma Mobile, however, we needed not only a simple clock display but also an alarm clock that could schedule proper system wake ups. Additionally, for travelers a world clock would be nice, and why not have a simple timer and stopwatch as well. That’s KClock, a sexy little Kirigami-based clock app.
While the app that has been a part of KDE Gear since 2023 worked well on any form factor thanks to Kirigami, our convergent UI framework, there were a few desktop-specific features that I was missing and that I now added.
First of all, I created Desktop Actions for the relevant pages in the app. Just right-click its entry in Kickoff or the task bar and select Timer, Stopwatch, or Alarm. You can also type that into KRunner. For this purpose KClock was turned into a “unique application” which means it can only be launched once. This was easy by using KDBusService. It registers a DBus service for the application and when it is launched again, it will just raise the existing instance. By setting SingleMainWindow in its desktop file it tells the shell that it shouldn’t offer to “Open New Window”.

Alarms and timers are handled by a separate kclockd background process. It uses DBus activation to automatically launch whenever someone calls it. This made it the perfect candidate for a DBus KRunner plug-in. Once registered, typing into KRunner will call the daemon, thereby launching it, and ask for results for a given query. It lets you search for both timers and alarms, and start, stop, and reset them, without opening the main app.
The next logical step of improving the task bar experience is to show a progress bar. Using the Unity Launcher API it gradually fills its task bar entry as a timer progresses. Plasma has always allowed an application to set a number badge on another one. The use case: Akonadi’s mail fetcher agent should be able to set the unread mail count on KMail’s icon even if KMail wasn’t running. Starting from Plasma 6.4 this is now also allowed for progress indications. This way, KClock Daemon can set timer progress on a pinned KClock entry (should you have one), even when its window isn’t open or on a different virtual desktop.
If that wasn’t enough, it will also show a Plasma notification when a timer is running. Using the “resident” notification feature, KClock can keep the notification alive indefinitely and update it every second. The notification allows to pause, resume, reset the timer, or to add another minute. Clicking the popup launches KClock again, to allow further adjustments. From Plasma 6.4 it will be possible to minimize such persistent notifications, just as you can do with a file copy job. By default, this notification appears only when KClock isn’t running, for example when a timer was started through KRunner. However, there’s an option to always or never show the notification.

Speaking of options, I wired up the standard shortcut for preferences. In case you didn’t know, in most KDE applications you can press Ctrl+Shift+Comma to open its settings window. The search in the “Add New Location” dialog finally searches not only for timezone ID but also country and city name. Type “Canada” and get all the time zones it knows for Canada. The dialog also now indicates which items have already been added to the world clock. Its underlying model has further been optimized to merely update the indicator when adding/removing locations rather than reloading the entire timezone list.
The list of improvements goes on and on. Here’s a few miscellaneous items:
- Buttons on the stop watch page no longer have a fixed size. This accomodates different translations. They also no longer move when the lap view appears.
- Spin boxes in edit fields select all text when focused to facilitate typing a new value
- Many controls gained tooltips or accessibility descriptions, and either get elided or wrap when there isn’t enough room
- In addition to space for start/stop and return to add a lap, delete and backspace now reset the stopwatch, thereby allowing to fully control it with the keyboard alone
- It’s now possible to edit a timer after it has been created
- Restored the analog clock by fixing the Frameworks 6 port to KSvg

Last but not least, Qt is not just a fantastic graphical user interface toolkit, it is also handy for writing a daemon. It has an easy to use network stack, can talk virtually any IPC protocol, can play audio, and much more. However, because of its UI focus, it loads the platform integration by default. This includes KDE’s integration plug-in, styling, icon themes, etc. KClock Daemon on the other hand doesn’t show any user interface, it merely runs some timers, issues system notifications, and provides KRunner results. It was therefore possible to significantly reduce its RAM consumption by disabling “desktop settings awareness”.
KClock startup time was further reduced by cleaning up DBus communication and loading its pages on demand. On top of that, it now makes use of QML declarative type registration. Rather than registering types manually by calling qmlRegisterType you annotate the relevant classes with QML_ELEMENT. This allows it to introspect the types ahead of time and enables the use of qmlcachegen. This pre-compiles the QML files to byte code, speeding up the application. It also sets up the QML Linter (qmllint) which gave me a bunch of suggestions, of which I implemented many. Finally, I slightly optimized rendering by avoiding overdraw: rather than painting the default gray window color and then drawing the white view rectangle on top, the rectangle was removed and window color changed to white.
I hope you will enjoy having a fantastic clock app for your Plasma desktop now!