Venturing out

Plasma 5.18 LTS Beta has been released, which brings many exciting new features to a computer near you, especially if you’re upgrading from our previous LTS release, Plasma 5.12. Of course for us developers this now means that a stable git branch has been created and we can work on new stuff on master to eventually become Plasma 5.19, scheduled for an early June 2020 release. This blog post is less about KDE code, though.

Plasma notification popup with a chat message and a text field to send a reply from inside the popup
No need to rub your eyes: Quick reply with Telegram on Plasma 5.18!

One of the things I enjoy most about working in open source is venturing out into other projects, doing things that are unfamiliar, and the challenge of finding my way around foreign code bases. You know, sometimes you’ve just gotta do things yourself, no matter what part of the stack they’re in, if you want your overall vision to become a reality.

With Plasma 5.18 I finally implemented quick reply in notifications. Something I’ve been wanting to have for many years. But what’s a feature without an application using it? Since Telegram appears to be quite popular in our community and its Linux desktop client hosted on GitHub, I decided to give it a go.

Telegram’s notification implementation had recently been ported from libnotify to use plain DBus calls instead, which made adding support for quick reply really straightforward. I browsed their git repository and found the necessary infrastructure for handling notification replies was already in place for their other supported platforms. The patch itself took me basically a minute to write (which means there’s no excuse for you not adding this feature to your messenger!) and my pull request was merged after only minor tweaks.

Once released, I’m sure you’ll enjoy this added productivity when having to deal with lots of chat rooms and conversations! Many thanks ilya-fedin for helping me build and test my patch, which unfortunately turned out a lot more difficult than I had hoped.

(Update 29 Jan: The Telegram Snap, which was updated this morning, currently isn’t allowed to listen to the required DBus signal owing to AppArmor restrictions. I merged a patch for snapd just now to address this.)

OBS Do not disturb

Plasma features a “do not disturb” mode where notifications are suppressed so you can focus on your current task or keep others from seeing private messages. The upcoming Plasma 5.18 release also gained a configurable global shortcut for quickly enabling this mode any time. An idea I had a few weeks ago was to write a plug-in for Open Broadcaster Software Studio to automatically inhibit notifications while streaming or recording – so I did just that.

Plasma notification center stating "Do not disturb while OBS is active (recording in progress)"
Quiet please, recording in progress!

It uses the OBS Studio Frontend API for detecting streaming/recording start and stop events and then places a notification inhibition via DBus. This was a good exercise in build systems for me as I wrote the, admittedly tiny, CMakeLists.txt from scratch without any of the ECM convenience you normally get when working on a KDE project. Moreover, to keep dependencies super minimal by using libdbus as opposed to Qt’s powerful DBus wrapper was quite interesting. I tried to save myself from any tedious C memory management by wrapping the objects in smart pointers with custom deleters, of course.

Some more notification things

Now that quick reply API found its first user, I made some minor tweaks to how it behaved: if the only visible action in the notification would by a lonely “Reply” button, the text field is shown right away instead. This also provides a visual cue that a reply is possible from within the popup.

An application can already provide a “default” action which is invoked when the notification bubble itself is clicked. For applications that don’t, for instance Thunderbird, there is now a fallback mechanism in place which, when clicked, at least brings the application window to the front and dismisses the notification. There’s also a new “Other Applications” category in settings so you can again have shell scripts spawn notifications that remain in history.

On my computer I have applications I daily need for work, such as web browser, web radio, IRC client, IDE, etc in my autostart. With all the startup performance work we did in the past months, my session starts so fast that Chrome is launched before Plasma’s notification service is fully up and running. This causes Chrome to fall back to its custom notification implementation until restarted. To fix this I submitted a patch to have it also check for DBus-activatable services before assuming there’s no notification service available.

I did some icons!

Finally, over the holidays I toyed around with the Inkscape vector graphics editor to create some Breeze icons I was sorely missing. I’m a huge fan of KDE Itinerary, our digital travel assistant. One of the many things it supports for managing boarding passes, train tickets, and exhibition passes is Apple’s .pkpass file format. While you typically get them in your Email client and import them directly, I still felt a proper file icon was missing.

Four file icons, different colored paper sheets with an icon in the middle: Apple Wallet (skyblue with a stylized wallet), Audacity (dark blue with audacity logo (headphones with lightning between them)), Windows link (LNK) file (dark gray with stylized chainlink), XHTML (purple with a globe)
Four new Breeze mime type icons

Another set of files I regularly encountered without an icon were Audacity projects. Thanks to Carson Black / jan Pontaoski for finalizing a draft icon I created for that purpose. I also noticed that XHTML files looked more like XML than HTML. While generally icons that differ only in color are bad for accessibility, in this case I changed it to a purple HTML icon to keep the XML connection (Breeze XML icon is purple) but put the main emphasis on the globe, i.e. it’s basically still a website. I also changed the file icon for Windows .lnk files to follow Breeze’s general paradigm for links.

To conclude, why not start the new year doing something you’ve never done before? Go start something from scratch, go make some artwork, go fix a bug in an application you use all the time but never contributed to! :-)

4 thoughts on “Venturing out”

  1. Great work, you guys rock!
    On an unrelated note, since I just read that you’re always looking for cool new features to implement in Plasma Integration: what about taking screenshots of *whole websites* with Spectacle?
    Should be very straight-forward to implement as at least Firefox has a built-in screenshot feature and on top of getting whole website screenshots one would also be reliefed from the need to hide tabs and bookmarks before taking a browser screenshot.
    What dou you think?

    1. Interesting idea!

      The question is how to present that in the UI. I find having to open Spectacle and then asking it to take a browser screenshot is a bit cumbersome, isn’t it?
      Adding a “take screenshot” button to the browser extension popup on the other hand should be easy but when Firefox already supports this, I don’t really see a need, other than for Chrome.

  2. Well, I wouldn’t mind at all having a fifth entry in Spectacle’s pull-down menu called “Browser”. This would IMO still be far more comfortable than taking the screenshot with Firefox and copying it from the download folder to the screenshot folder, let alone that the latter methed could not be triggered by the prtscr key.
    Actually though, I was thinking about presenting another option in spectacle that would say something like “capture whole site if window is a browser”. The workflow would then look like this:

    1. User hits prtscr while “active window” is chosen
    2. Spectacle checks if the window belongs to a browser
    2. Spectacle calls the browser extension for the screenshot
    3. The extension takes the screenshot by the browsers’ own means including whole site
    4. The extension sends the screenshot back to Spectacle.

    This way we would have a nice all-in-one solution for screenshots including browser screenshots.

Leave a Reply

Your email address will not be published. Required fields are marked *