Skip to content

Friday, 18 February 2022

In my last post I talked about why knowing the desktop file for a window is important for the task manager. I promised to talk about some cool stuff we did there in Plasma 5.24, so here we are.

While hacking on the task manager code I noticed that we show a “Open new instance” action in the context menu of every task manager entry, even for those where it doesn’t make sense. A lot of apps are inherently single-window or single-instace, i.e. launching the app a second time will not open a second window but rather focus the existing one. Also, not all windows actually belong to a user-facing or user-launchable application. For example the network integration might ask you for the WiFi password, but you can’t open a new window for that from the task manager. Another kind of app where this actions doesn’t make sense is helper applications like the wizard for connecting to a new bluetooth device.

After some initial refactoring the first thing I did was hide the action for apps that have NoDisplay=true in their desktop file. These usually correspond to the aforementioned background services and helper apps. With that in the situation was improved for a great deal of windows. However, the case of single-window application was still unsolved. After reading some older, related discussion, I found that our friends at GNOME had solved this problem for them already. Their equivalent part of the code, amongst other heuristics, reads the X-GNOME-SingleWindow key from the application’s desktop file. So I did the obvious thing and added reading X-GNOME-SingleWindow to Plasma’s task manager code. We also added that key to a bunch of relevant KDE apps. While this was a pragmatic and working solution, relying on a X-GNOME- key for what we want to be cross-desktop behavior is not ideal. It’s time for standardization!

Nate Graham (you may have heard of him) proposed to add the existing key minus the X-GNOME- prefix to the desktop entry spec. After a bit of discussion about names and semantics people settled on SingleMainWindow as the new name. Implementations for Plasma and GNOME soon followed. What’s missing is adding it for all the apps out there. Besides KDE apps I already did that for qBittorrent, Nextcloud, and Yubico Authenticator. This is an excellent way to contribute to your favorite open source app!

But wait, there is more. Some apps define their own “Open new window” action in their desktop file. To avoid having two redundant actions Plasma now hides its own action when there is already a semantically similar one.

Happy task managing!

Thursday, 17 February 2022

This Saturday (Feb 19th) from 12:00pm to ~4:00pm EST I’ll be livestreaming preliminary work on the Plasma 5.25 wallpaper, as well as a brainstorming session for possible directions the Plasma 6 wallpapers could go. Iconography might also be a thing.

Abstract KDE NeuralBlender Example

The Plasma 5.25 wallpaper work is mainly going to be sketching in Krita, and there may be 2 or 3 sketches that come out from that process. After that will be exploring ideas I’ll be proposing for Plasma 6, including KDE-prompted neurally generated images being used to find new and interesting design concepts.

Sunday, 13 February 2022

Perspective Ellipse Assistant in Krita

Hello, this is my second blogpost for SoK 2022.

In my previous blogpost, I wrote that I’ll be working on extending the Ellipse Assistant Tool to add support for Perspective Ellipse in Krita. However, last week my mentors and I decided that as of now, it makes more sense to add a new Assistant Tool for Perspective Ellipse instead of extending the Ellipse Assistant Tool.

My Progress so far

Adding a new Assistant Tool

Here’s the Tools Option Docker after the new Perspective Ellipse Assistant is selected!

Tools Option Docker

Creating an adjustable Four Cornered Convex Quadrilateral

Anyone familiar with Assistant Tools in Krita would have noticed that the current Perspective Assistant Tool draws an adjustable convex quadrilateral with grid lines. I decided to take advantage of that and reused the existing code, got rid off the grid lines, and voila! I’ve a four cornered mesh for my Perspective Ellipse Assistant.

Difference

For people who are familiar with Krita’s codebase:

I added PerspectiveEllipseAssistant.h and PerspectiveEllipseAssistant.cc to the ktita/plugins/assistants/Assistants directory which currently contanis files for all the other assistant tools in the form XAssistant.h/cc, where X is the Assistant name. Then, I registered my Assistant by including the following piece of code in the assistant_tool.cc file.

KisPaintingAssistantFactoryRegistry::instance()->add(new PerspectiveEllipseAssistantFactory);

And there, my four cornered mesh works exactly how it’s expected too! ;)

Animation

Next Steps

I would spend the next few weeks creating an inscribed ellipse inside my four cornered mesh. This, however, is going to take some time as I am not yet fully comfortable with the mathematics involved.

For this part, I want to transform a circle to an ellipse using a transformation matrix, given that the equation for the circle and the transformation matrix is given. I’m looking for a way to obtain the coefficients of the equation for the corresponding transformed ellipse.

Anyone having any leads on this can feel free to mail me here. Thanks in advance!

Saturday, 12 February 2022

You might have noticed that there have been a lot of KDE releases this week, like Plasma 5.24 and Plasma Mobile Gear. Keen to hop onto this train, those of us in the Kalendar team are happy to reveal Kalendar version 1.0. We are even happier to announce that this will be the final version … Continue reading "Kalendar 1.0 is out!"

Friday, 11 February 2022

Let’s go for my web review for the week 2022-06.


Mark Zuckerberg and team consider shutting down Facebook and Instagram in Europe if Meta can not process Europeans’ data on US servers

Tags: tech, facebook, surveillance

That sounds great to me. Could they do it already please?

https://www.cityam.com/mark-zuckerberg-and-team-consider-shutting-down-facebook-and-instagram-in-europe-if-meta-can-not-process-europeans-data-on-us-servers/


Thank you, Valve

Tags: tech, valve, linux, gaming

Thank you indeed. The amount of upstream contributions their efforts fostered is enormous at this point.

https://kinduff.com/2022/02/06/thank-you-valve/


KDE: A Nice Tiling Environment and a Surprisingly Awesome DE

Tags: tech, KDE

It is nice to hear from a happy user from time to time. And yes, KWin is a very nice tiling environment once you have the right extensions (I use Bismuth and dynamic virtual desktops nowadays). I’m fairly happy with those.

https://changelog.complete.org/archives/10338-kde-a-nice-tiling-envieonment-and-a-surprisingly-awesome-de


On finding the average of two unsigned integers without overflow

Tags: tech, c++, assembly, programming

You thought averaging two unsigned was trivial? Think again, here what needs to happen in all its glory.

https://devblogs.microsoft.com/oldnewthing/20220207-00/?p=106223


What’s in a Good Error Message?

Tags: tech, programming, logging

Excellent article about best practices for logging errors, most of it applies for other type of logs though.

https://www.morling.dev/blog/whats-in-a-good-error-message/


Exposing a web service with Cloudflare Tunnel

Tags: tech, cloudflare, networking, self-hosting

This looks like a nice way to somewhat safely expose self-hosted services to the outside.

https://erisa.dev/exposing-a-web-service-with-cloudflare-tunnel/


The Fall of Scrum?

Tags: tech, agile, scrum

This asks very valid questions. I’m a bit less optimistic than in the conclusion though… I suspect that if it truly falls, it will be replaced by another cargo cult.

https://ronjeffries.com/articles/-z022/01121/fall-of-scrum/


Interview Questions to Ask Your Interviewer

Tags: hr, interviews

As I keep saying to people I interview… it’s also about you interviewing us! I wish I had more questions from them. This list is a bit biased to some type of companies but that’s a good starting point.

https://daveceddia.com/interview-questions-to-ask-company/



Bye for now!

Thursday, 10 February 2022

Relationship between the input method server and applications under Fcitx5+KWin/Wayland

With the latest release of Plasma 5.24, the native wayland input method support in KWin is improved to support non-virtual keyboard input method like Fcitx 5. (There are lots of issues if you try to use zwp_input_method_v1 in 5.23).

This leads to a outcome that non-Gtk/Qt application using text-input-v3 can be used flawlessly under KWin Wayland. Though, there is some small step that you’ll need to follow.

First of all, I suggest you have most up-to-date Plasma 5.24 and Fcitx 5.0.14. I believe the distribution that picks up Plasma 5.24 should also have up-to-date Fcitx 5.

Next, you’ll need to make KWin Wayland to launch Fcitx 5. This is required because only the privileged client is allowed to talk to KWin on input method protocol. KWin will send a socket file descriptor to the input method and input method service need to use this socket to connect to KWin.

Thanks to a simple KCM, which is accessible from systemettings -> Virtual keyboard (Naming of the KCM is not so good, because it was designed for mobile phone to launch maliit initially.)

From there, just select Fcitx 5. This requires you to have up-to-date Fcitx 5 to make it show up in this KCM, because it requires a special new field in the Fcitx 5 desktop file.

Although kwin will launch input method in a pretty early stage, but there might still be some race condition if there is another mechanism (Like XDG autostart) to launch Fcitx 5. You can try to re-login to see if if works, if not, you may want to disable Fcitx 5’s own XDG autostart or what ever mechanism you’re using to launch Fcitx 5.

Theoretically you don’t need to re-login, KWin can reload it immediately after you apply the setting in systemsettings. I would just re-login to make sure everything it properly launched, then you should be good to go.

Hello world from Chinese Pinyin!

Should I keep setting GTK_IM_MODULE / QT_IM_MODULE / XMODIFIERS?

  1. QT_IM_MODULE
    Qt has text-input-v2 support which can be used if QT_IM_MODULE is empty, but it has some small issue regarding the preedit. Also, with current version of wayland input method protocol, there can be only one global input context for wayland. So right now it can be a problem if you want to use the “per-application” input state supported by Fcitx 5. But using Qt’s text-input protocol has one benefit, is that visually there won’t be blinking for input window.
  2. GTK_IM_MODULE
    Gtk has text-input-v3 support, but it’s preedit is poorly styled with bold font for highlight. Also, its surrounding text support is poorly implemented. So for now, using GTK_IM_MODULE=fcitx might still be good option if you want to have all Fcitx features.
  3. XMODIFIERS
    It’s required to support XWayland.

There was a blog post from Peter Hutterer about Flatpak portals posted few months back. Peter explained what are portals and how do they work. Portals are used mostly because of security and sandbox/Wayland restrictions. Many times your only way to get access outside (opening a file, sending a notification, sharing a screen, etc.) is to use a portal. For most use-cases applications or developers don’t need to care about them as their support is usually implemented in libraries they use. For example Qt and GTK use portals internally so apps can use still the same APIs as before and they don’t need to worry about their apps not working in sandboxed environments. BUT there are still scenarios where libraries have unsufficient or none portal support, or a different options are desired so what are the options in this case if you still need to use portals?

  1. Do everything yourself, which means you will implement all the DBus calls and handling yourself.
  2. Use a library. Most logic choice would be libportal, but there is also a project called ASHPD for Rust users.

What is libportal and libportal-qt?

The libportal library provides GIO-style async APIs for Flatpak portals. It hides all the DBus complexity users would face in case of using portals directly and provides a user-friendly library instead. You might think that the libportal-qt is the same thing, just with Qt-style APIs, but the idea behind it is that each toolkit (Gtk3, Gtk4, Qt5, Qt6) has a different way to get a window handle which is needed to associate portal dialogs with the app that invoked them. So libportal-qt just provides a way to get a XdpParent object from a QWindow. As a C++/Qt developer I don’t mind using C/Glib APIs and I used it many times, but there is still one speciality I fail to use everytime, my friend GVariant. Some of the portal APIs in libportal expects a GVariant for all the complex structures, for example to specify a filter option for OpenFile() call from the fillechooser portal, you have to build a very complex GVariant based on the DBus specification.

Remember I told you libportal-qt doesn’t offer Qt-style APIs? This is not necessarily true, because I implemented all the complex structures you will have to pass in most of the portals and implemented functions that will return them as GVariants so you don’t need to get in touch with GVariants at all.

How to use libportal-qt?

First of all, all libportal flavours have pkgconfig file installed so it’s easy to use them from any build system and you just need to search for libportal-qt5 (we don’t have -qt6 version yet).

And how does the code look like? For example let’s say you want to open an image:

// Creates a filter rule, this can be a Mimetype or Pattern.
XdpQt::FileChooserFilterRule rule;
rule.type = XdpQt::FileChooserFilterRuleType::Mimetype;
rule.rule = QStringLiteral("image/jpeg");

// Create a filter with our rules, we will then pass it to OpenFile() call as GVariant.
XdpQt::FileChooserFilter filter;
filter.label = QStringLiteral("Images");
filter.rules << rule;

// Create a GVariant from our filter. This will result into variant in form of:
// "[('Images', [(1, 'image/jpeg')])]"
g_autoptr(GVariant) filterVariant = XdpQt::filechooserFiltersToGVariant({filter});

// Get XdpParent to associate this call (portal dialog) with our window.
XdpParent *parent = xdp_parent_new_qt(m_mainWindow->windowHandle());

// Finally open a file. XdpQt::globalPortalObject() is another convenient function 
// that creates a global instance of XdpPortal object so you don't need to take care
// of creating it yourself. For some of the arguments we just pass a nullptr to don't 
// specify them.
xdp_portal_open_file(XdpQt::globalPortalObject() /*XdpPortal object*/,
                                  parent /*XdpParent object*/, "Title", filterVariant /*filters*/,
                                  nullptr /*current_filter*/, nullptr /*choices*/, 
                                  XDP_OPEN_FILE_FLAG_NONE /*flags*/, nullptr /*cancellable*/, 
                                  openedFile /*callback*/, this /*data*/);
xdp_parent_free(parent);

// Then the callback would look like this, eg.
static void openedFile(GObject *object, GAsyncResult *result, gpointer data) {
    g_autoptr(GError) error;
    g_autoptr(GVariant) ret = 
        xdp_portal_open_file_finish(XdpQt::globalPortalObject(), result, &error);

    if (ret) {
        // Another convenient function that will get you uris and choices from 
        // GVariant returned by xdp_portal_open_file() call.
        XdpQt::FileChooserResult result = filechooserResultFromGVariant(ret);
        
        // Do whatever you want to do with the result. Here we just print opened selected files.
        qDebug() << result.uris;
    }
}

As you can see, no GVariant got hurt and you can easily open a file without any GVariant knowledge. Besides FileChooser portal helpers, we also have Notification portal helpers, because serializing icons and buttons is also something that is not trivial. For the rest of the portals you either don’t need to use complex GVariants so you can use them easily without helper functions same way as shown above, or some portals like ScreenCast or RemoteDesktop are not used that often and we don’t have helper functions for those just yet.

I hope you can find this helpful in case you want to join this world. The libportal project is hosted on GitHub in case you want to try it just now, because this is still not part of any stable release (will be in libportal 0.6), or report a bug or just look at my GVariant helpers to see what I spare you of.

Wednesday, 9 February 2022

Yesterday, KDE released version 5.24 of the Plasma desktop with the usual long list of updates and improvements. This release will be considered a LTS release. And Plasma 5.24 is now available for all Debian releases. (And don’t forget KDE Gears/Apps 21.12!)

As usual, I am providing packages via my OBS builds. If you have used my packages till now, then you only need to change the plasma5XX line to read plasma524. To give full details, I repeat (and update) instructions for all here: First of all, you need to add my OBS key say in /etc/apt/trusted.gpg.d/obs-npreining.asc and add a file /etc/apt/sources.list.d/obs-npreining-kde.list, containing the following lines, replacing the DISTRIBUTION part with one of Debian_11 (for Bullseye), Debian_Testing, or Debian_Unstable:

deb https://download.opensuse.org/repositories/home:/npreining:/debian-kde:/other-deps/DISTRIBUTION/ ./
deb https://download.opensuse.org/repositories/home:/npreining:/debian-kde:/frameworks/DISTRIBUTION/ ./
deb https://download.opensuse.org/repositories/home:/npreining:/debian-kde:/plasma524/DISTRIBUTION/ ./
deb https://download.opensuse.org/repositories/home:/npreining:/debian-kde:/apps2112/DISTRIBUTION/ ./
deb https://download.opensuse.org/repositories/home:/npreining:/debian-kde:/other/DISTRIBUTION/ ./

The sharp eye might have detected also the apps2112 line, yes the KDE Gear suite of packages has been updated to 21.12 some time ago and is also available in my OBS builds (and in Debian/experimental).

Just one warning, but I guess most people using these repos already know it: Since I am not using Debian (lovely politics!) for my main machine anymore (only for my laptop for now), I haven’t tested these packages as solidly as the one up to now. Still, I got already one positive installation feedback.

Enjoy the new Plasma!

Sunday, 6 February 2022

Hey!

This is my second post for SoK 2022. Its going to be lot more technical than my last one. Lets dive into all that we did in past few days.

Learning packaging

As I had mentioned in my last post, I already knew the basics of packaging. Flatpak is certainly new for me though. I have used Flatpaks, but never published them.

It was easy to learn packaging and writing manifests. I submitted a couple of easy applications to Flathub before the contribution period started, so as to get a good idea of what I'll be doing during the coming weeks.

Challenges faced

Incomplete Appdata info

Many upstream packages did not have a complete appdata.xml file. Most noticeably, the OARS data was missing. However, I did not get to know about it until I submitted my first package, and it failed CI test.

Logs made it clear the appdata was at fault. Poking around, I fixed the appdata, but I needed a quick way to verify appdata for future packages. I made an alias in my shell, which would do the job for me.

alias ad="flatpak run --env=G_DEBUG=fatal-criticals org.freedesktop.appstream-glib validate \$(find . -name \"*appdata.xml\")"

You need to first cd into your build directory. And then simply run ad. It will find all appdata files, and validate them.

Using right sources

My first three submissions used a git source rather than release tarballs. While using a git source doesn't pose major issues, release tarballs are easier to work with.

Using right permissions

Back when I started, I did not know which permissions I had to use for different packages. All it required was to read the documentation on Flatpak website. Running an app with missing permissions usually printed errors in the console, which could be used to verify permissions. Nearly every GUI application requires --socket=fallback-x11, --socket=ipc, --socket=wayland, and for applications using OpenGL, --device=dri. If application required network access, add --share=network.

For filesystem access, you can use --filesystem=host, but most of the times, you don't need such a broad permission. You have options like --filesystem=home, --filesystem=/path/to/dir and --filesystem=xdg-name, where name is one of the XDG directories. These can be used to limit filesystem access, and be more closer to the idea of sandboxing applications.

Other minor issues

There were a couple of other minor issues with my initial few manifests. Reviewers suggested changes, and I gradually understood them and avoided them.

Portal exists

So, I had zero idea about Portals, which allow a Flatpak application to access files on the user filesystem, without requiring explicit permissions in manifest. I only got to know about it during reviews.

Submissions list

I'm listing only the accepted submissions here.

Submissions to Flathub

  1. KFind
  2. KRuler
  3. Cantor
  4. KDiff3
  5. KColorChooser
  6. KAlgebra
  7. KPhotoAlbum
  8. Falkon
  9. KGeoTag

Upstream code patches

Thanks to help from Albert Cid, I was able to push some minor updates to KDF.

KDF has option to open disk with a custom command from the user. By default, this opens disk in Dolphin file manager. However, this fails when Dolphin is not installed on system. The issue arose when packaging KDF for Flathub required including Dolphin in the manifest, which was not ideal. As a result, KDF was put on hold, and I was suggested to add a feature that would open drives in system default file manager. Thanks to Aleix Pol, I already had an idea about the changes to make in source code. My first pull request was closed because I removed the feature for using custom file manager command.

In my second pull request, I added the feature to open disk in system default file manager, and retained the option to specify a custom file manager command. User can easily switch them in settings. Albert suggested I send a patch to disable option to specify custom command, as they aren't supported in Flatpak environment.

Updates pushed

  1. Falkon update to 3.2 : https://github.com/flathub/org.kde.falkon/pull/2
  2. Exiv2 update for Koko : https://github.com/flathub/org.kde.koko/pull/2
  3. Exiv2 update for Kdenlive : https://github.com/flathub/org.kde.kdenlive/pull/165
  4. Exiv2 update for Krita : https://github.com/flathub/org.kde.krita/pull/51
  5. Exiv2 update for GwenView : https://github.com/flathub/org.kde.gwenview/pull/22
  6. Exiv2 update for KPhotoAlbum : https://github.com/flathub/org.kde.kphotoalbum/pull/1
  7. Exiv2 update to Flatpak master repo : https://invent.kde.org/packaging/flatpak-kde-applications/-/merge_requests/74
  8. Eigen update to Flatpak master repo: https://invent.kde.org/packaging/flatpak-kde-applications/-/merge_requests/72
  9. Boost update to Flatpak master repo : https://invent.kde.org/packaging/flatpak-kde-applications/-/merge_requests/71

Upstream appdata patches

  1. KFloppy : https://invent.kde.org/utilities/kfloppy/-/merge_requests/1
  2. KRuler : https://invent.kde.org/graphics/kruler/-/merge_requests/5
  3. Cantor : https://invent.kde.org/education/cantor/-/merge_requests/37
  4. KFind : https://invent.kde.org/utilities/kfind/-/merge_requests/8
  5. KDiff3 : https://invent.kde.org/sdk/kdiff3/-/merge_requests/37
  6. KAlgebra : https://invent.kde.org/education/kalgebra/-/merge_requests/22
  7. Akregator : https://invent.kde.org/pim/akregator/-/merge_requests/22
  8. KPhotoAlbum : https://invent.kde.org/graphics/kphotoalbum/-/merge_requests/18
  9. KGeoTag : https://invent.kde.org/graphics/kgeotag/-/merge_requests/13
  10. KDF : https://invent.kde.org/utilities/kdf/-/merge_requests/3
  11. Dolphin : https://invent.kde.org/system/dolphin/-/merge_requests/325
  12. Falkon : https://invent.kde.org/network/falkon/-/merge_requests/27

Thanks to the KDE team for being patient with reviews and helping me in the roadblocks I faced!

Friday, 4 February 2022

Let’s go for my web review for the week 2022-05.


Facebook loses users for first time in history - The Washington Post

Tags: tech, facebook, gafam, attention-economy, surveillance

The beginning of the end for this one? Too early to tell and so big it can limp along for a long time. As one could suspect the moves toward VR are to try to counterbalance their current situation which was clearly to come… still can it be their new cash cow? Hard to tell. If only it means that the war for attention and the accompanying surveillance is likely to rage on even more.

https://www.washingtonpost.com/technology/2022/02/02/facebook-earnings-meta/


Adblocking People and Non-adblocking People Experience a Totally Different Web – I’m Left Handed

Tags: tech, web, advertisement

I think we’re doomed to never get rid of our adblocking extensions…

https://imlefthanded.com/2022/adblocking-people-and-non-adblocking-people-experience-a-totally-different-web/


Tags: tech, gdpr, privacy, surveillance

You don’t like consent popups? Luckily you’re not the only one.

https://www.iccl.ie/news/gdpr-enforcer-rules-that-iab-europes-consent-popups-are-unlawful/


In Defence of the Boring Web

Tags: tech, web, low-tech

I obviously agree quite a lot with this.

https://bastian.rieck.me/blog/posts/2022/boring/


Kate Editor Set to Become KDE’s Answer to Microsoft’s Visual Studio Code - It’s FOSS News

Tags: tech, kde, programming

If you didn’t try Kate for a while… the next release in the spring will be a good time to try it again.

https://news.itsfoss.com/kate/


There’s No Such Thing as Clean Code

Tags: tech, craftsmanship, programming

Good reminder that the words we use matter. Fuzzy terms like “clean” indeed hide various dimensions to look at the code and the tradeoffs we make.

https://www.steveonstuff.com/2022/01/27/no-such-thing-as-clean-code


Extreme (Programming) Thoughts

Tags: tech, xp, agile, craftsmanship, tests, refactoring, mob-programming

Interesting musing on the skills required, why it’s actually hard to apply them… clearly it’s because you never find a real place to learn them so that ends up being on the job.

https://ronjeffries.com/articles/-z022/01121/extreme-thoughts/


How Prime Video updates its app for more than 8,000 device types - Amazon Science

Tags: tech, webassembly, rust, amazon, performance, javascript

Interesting use of WebAssembly for fast and very portable code. Also especially interesting is the care in the move to the new software architecture.

https://www.amazon.science/blog/how-prime-video-updates-its-app-for-more-than-8-000-device-types


Settings are not a design failure

Tags: tech, design, settings

I like this position. There’s been too much of a move to “kill all the settings!” in some products. Some of them definitely make sense, and the “on boarding” point of view mentioned here makes sense.

https://linear.app/blog/settings-are-not-a-design-failure


the new hire who showed up is not the same person we interviewed — Ask a Manager

Tags: hr, interviews, hiring, bizarre

Now this is truly bizarre… but apparently this happens.

https://www.askamanager.org/2022/01/the-new-hire-who-showed-up-is-not-the-same-person-we-interviewed.html


Reading on a smartphone affects sigh generation, brain activity, and comprehension | Scientific Reports

Tags: science, reading, cognition

Unsurprising following previous findings with ebooks. It’s interesting to see the potential reasons of why this happens though… the link with respiration is fascinating. Now it’s early days and a small study so usual disclaimers apply.

https://www.nature.com/articles/s41598-022-05605-0



Bye for now!