I saw this question on KDE forum about how to limit memory usage of a specific application in KDE, using systemd specifically. I did some research on that.
Resource control in systemd
man systemd.resource-control lists plenty of options that we can set to a cgroup. E.g., to limit the memory usage of a service, we can add:
MemoryAccounting=yesMemoryHigh=2G
under the [Service] section of its .service file.
The difference between this and ulimit is that ulimit is per process, while systemd resource control is per cgroup. I.e., the MemoryHigh is accounted to the sum of both the service process, and all sub-processes it spawns, and even detached processes, i.e., daemons.
(That's actually the main point of cgroup: a process tree that a process can't escape via double-forking / daemonizing.)
Apps as systemd services
KDE Plasma launches apps as systemd services. (See this doc and this blog for more details.)
We can find the name of the systemd service of an app like this:
The part of the name after @ is a random string, changes every time the app is launched.
The service is generated dynamically:
$ systemctl --user cat app-org.kde.konsole@0d82cb37fcd64fe4a8b7cf925d86842f.service
# /run/user/1000/systemd/transient/app-org.kde.konsole@0d82cb37fcd64fe4a8b7cf925d86842f.service# This is a transient unit file, created programmatically via the systemd API. Do not edit.[Service]Type=simple
...
So if we want to limit the memory usage of Konsole, there's no persistent .service file on disk that we can edit.
Luckily, systemd allows us to create drop-in files to partially modify a service. Also, systemd considers app-org.kde.konsole@0d82cb37fcd64fe4a8b7cf925d86842f.service to be instances of a template named app-org.kde.konsole@.service. (This is how things like getty@tty3.service work.) So we can create a drop-in file named ~/.config/systemd/user/app-org.kde.konsole@.service.d/override.conf with the content:
[Service]MemoryAccounting=yesMemoryHigh=2G
and it will apply to all instances of app-org.kde.konsole@.service, even if there's no service file with that name.
(The file doesn't have to be named "override.conf". Any name with .conf works.)
Then we need to reload the systemd user manager: systemctl --user daemon-reload.
Now we can launch Konsole, and check if the memory limit works:
$ systemctl --user show 'app-org.kde.konsole@*.service'|grep MemoryHigh=EffectiveMemoryHigh=2147483648MemoryHigh=2147483648StartupMemoryHigh=infinity
Note: as explained above, the limit applies to the sum of Konsole and all processes it spawns. E.g., if we run kwrite in Konsole, the memory usage of kwrite will be accounted to the limit of Konsole, and the limit we set to KWrite won't apply.
Set defaults for all apps
We can put defaults in ~/.config/systemd/user/app-.service.d/override.conf, and it will match all services whose name starts with app-.
Alternatively, if we run systemd-cgls, we can see that all apps are under a node named app.slice. So we can also put defaults in ~/.config/systemd/user/app.slice.d/override.conf, and all apps will inherit the settings. However, this is different from the previous method, as user services are also under app.slice by default, so they will also inherit the settings.
A new Craft cache has just been published. The update is already available for KDE's CD, CI (Windows/Android) will follow in the next days.
Please note that this only applies to the Qt6 cache. The Qt5 cache is in LTS mode since April 2024 and does not recieve major updates anymore.
Changes (highlights)
Craft Core
Drop Python2 support
Require at least Python 3.9
Blueprints
Qt 6.8.0
FFmpeg 7.1
Kirigami Addons 1.5.0
KDE Frameworks 6.7.0
KDE Plasma 6.2.0
Removed snoregrowl
Removed ctemplate
About KDE Craft
KDE Craft is an open source meta-build system and package manager. It manages dependencies and builds libraries and applications from source on Windows, macOS, Linux, FreeBSD and Android.
Looks like we properly live by the “simple by default, powerful when needed” tagline. Now there are also challenges, this article gives a nice balanced view.
It’s Not Easy Being Green: On the Energy Efficiency of Programming Languages
Tags: tech, programming, performance, energy
Nice paper which debunks the choice of the language as an important factor for energy efficiency. The previous papers had a too simple model, this one puts forth a more complete causal model. There are many factors at play regarding energy efficiency, the programming language itself is not really one of them.
Excellent point, we made the web too complex for regular users. This is actually an issue in term of access and democracy for people to write content there.
Yes, the governance of Open Source projects can be tricky. This is part of the job though, and properly embraced we all go further. An example from the Wayland space.
Nice post, and indeed it’s not about Python if you read until the end. It shows that it’s important to be able to make informed choices and not just pick your tech stack based on knee-jerk reactions.
Put business logic in the application, not the database
Tags: tech, databases, design, performance
I’m not sure I’m sold on this one. Interesting food for thought but I’ll have to mull it over for a while I think. I’m concerned about the performance implications of querying like this.
Understanding and effectively mitigating code review anxiety
Tags: tech, codereview, psychology, cognition, anxiety, research
Still very early days on this topic, clearly more studies are required. Still this one is interesting and indicates are clear link between code review anxiety and code review avoidance. If you’re often procrastinating or rubber stamping code reviews, a workshop to reduce biases and showing you can manage your anxiety could improve things greatly.
The latest Nobel prizes indeed say something about the presence of computer scientists in other fields. Do we risk to delve too much on theoretical model? For sure using computers helps a lot, we have to be careful about not loosing empirical validation in the process.
We have just switched on the upgrade for KDE neon to rebase on Ubuntu 24.04 LTS.
We do this every two years and the 22.04 LTS base was getting increasingly crusty with old Pipewire causing problems and packages like Krita not compiling at all.
The Kubuntu Team is happy to announce that Kubuntu 24.10 has been released, featuring the new and beautiful KDE Plasma 6.1 simple by default, powerful when needed.
Codenamed “Oracular Oriole”, Kubuntu 24.10 continues our tradition of giving you Friendly Computing by integrating the latest and greatest open source technologies into a high-quality, easy-to-use Linux distribution.
Under the hood, there have been updates to many core packages, including a new 6.11 based kernel, KDE Frameworks 5.116 and 6.6.0, KDE Plasma 6.1 and many updated KDE gear applications.
Kubuntu 24.10 with Plasma 6.1
Kubuntu has seen many updates for other applications, both in our default install, and installable from the Ubuntu archive.
Applications for core day-to-day usage are included and updated, such as Firefox, and LibreOffice.
For a list of other application updates, and known bugs be sure to read our release notes.
Wayland as default Plasma session.
The Plasma wayland session is now the default option in sddm (display manager login screen). An X11 session can be selected instead if desired. The last used session type will be remembered, so you do not have to switch type on each login.
Note: For upgrades from 24.04, there may a delay of a few hours to days between the official release announcements and the Ubuntu Release Team enabling upgrades.
Kirigami Addons is out. This releases contains mostly code cleanup and minor
improvements. There is netherless a few relevant changes. Thanks to everyone
who contributed some code.
New KAppTemplate’s template
A new KAppTemplate is available as a good starting point for application that
manage multimedia libraries. It is based on shared design of
Peruse,
Arianna and the WIP Calligra Launcher.
Hopefully it helps people who want to develop game launchers and other type of
specialized multimedia applications.
More templates are planned (e.g. for chat applications), so stay tunned!
FormCard
FormCard is the part of Kirigami Addons that received the most changes in this
release. First of all, FormCard now use more consistent spacing and padding,
which slighly less horizontal padding. Descriptions for radio and checkbox
delegates are also put underneath the delegate’s main text and checkbox, in an
effort to make FormCard a bit more compact.
Before
After
Additionally FormComboBoxDelegate now lets you display an inline status
similar to that is available in other FormCard’s delegates.
Finally FormCard.AboutKDE was renamed to FormCard.AboutKDEPage. This improve
the naming consistency with other page compoenents. A compatibility wrapper on
top of AboutKDEPage named AboutKDE is still available to not break any
existing applications.
Deprecations
The Banner component is now deprecated. Kirigami.InlineMessage now has a
position parameter which can be set to Header or Footer. Additionally
with KDE Frameworks 6.8 Kirigami.InlineMessage will look exactly the same as
Banner! So there is no more reasons for this component to exists
in Kirigami Addons.
Other
Kirigami Addons supports static builds with a recent enough version of extra-cmake-modules.
I've been fixing cursor problems on and off in the last few months. Here's a recap of what I've done, explanation of some cursor size problems you might encounter, and how new developments like Wayland cursor shape protocol and SVG cursors might improve the situation.
(I'm by no means an expert on cursors, X11 or Wayland, so please correct me if I'm wrong.)
Why don't we have cursors in the same size anymore?
My involvement with cursors started back in the end of 2023, when KDE Plasma 6.0 was about to be released. A major change in 6.0 was enabling Wayland by default. And if you enabled global scaling in Wayland, especially with a fractional scale like 2.5x, cursor sizes would be a mess across various apps (the upper row: Breeze cursors in Plasma 6.0 Beta 1, Wayland, 2.5x global scale, the lower row: Same cursors in Plasma 6.0):
So I dug into the code of my favorite terminal emulator, Kitty, which at the time drew the cursor in a slightly smaller size than it should be (similar to vscode in the above image). I gained some understanding of the problem, and eventually fixed it. Let me explain.
How to draw cursors in the same size in different apps?
In X11, there used to be a standard set of cursors, but nowadays most apps use the XCursor lib to load a (user-specified) cursor theme and draw the cursor themselves. So in order to have cursors in the same theme and size across apps, we need to make sure that:
Apps get the same cursor theme and size from the system.
Apps draw the cursor in the same way.
The transition to Wayland created difficulties in both points:
1. Get the same cursor theme and size from the system
It used to be simple in X11: we have Xcursor.size and Xcursor.theme in xrdb, also XCURSOR_SIZE and XCURSOR_THEME in environment variables. Setting them to the same value would make sure that all apps get the same cursor theme and size.
But Wayland apps don't use xrdb, and they interpret XCURSOR_SIZE differently: in X11, the size is in physical pixels, but in Wayland it's in logical pixels. E.g., if you have a cursor size 24 and global scale 2x, then in X11, XCURSOR_SIZE should be 48, but in Wayland it should be 24.
The Wayland way is necessary. Imagine you have two monitors with different DPI, e.g. they are both 24" but monitor A is 1920x1080, while monitor B is 3840x2160. You set scale=1 for A and scale=2 for B, so UI elements would be the same size on both monitors. Then you would also want the cursor to be of the same size on both monitors, which requires it to have 2x more physical pixels on B than on A, but it would be the same logical pixels.
So Plasma 6.0 no longer sets the two environment variables, because XCURSOR_SIZE can't be simultaneously correct for both X11 and Wayland apps. But without them and xrdb, Wayland apps no longer have a standard way to get the cursor theme and size. Instead, different frameworks / toolkits have their own ways. In Plasma, KDE / Qt apps get them from the Qt platform integration plugin provided by Plasma, GTK4 apps from ~/.config/gtk-4.0/settings.ini (also set by Plasma), Flatpak GTK apps from the GTK-specific configs in XDG Settings Portal.
The last one is particularly weird, as you need to install xdg-desktop-portal-gtk in order fix Flatpak apps in Plasma, which surprised many. It might seem like a hack, but it's not. Plasma officially recommends installing xdg-desktop-portal-gtk, and this was suggested by GNOME developers.
But what for 3rd-party Wayland apps besides GTK and Qt? The best hope is to read settings in either the GTK or the Qt way, piggy-backing the two major toolkits, assuming that the DE would at least take care of the two.
(IMHO either Wayland or the XDG Settings Portal should provide a standard way for apps to get the cursor theme and size.)
That was part of the problem in Kitty. It used to read settings from the GTK portal, but only under a GNOME session. I changed it to always try to read from the portal, even if under Plasma. But that's not the end of the story...
2. Draw the cursor in the same way
It's practically a non-issue in X11, as the user usually sets a size that the cursor theme provides, and the app just draws the cursor images as-is. But if you do set a cursor size not available in the theme (you can't do that in the cursor theme settings UI, but you can manually set XCURSOR_SIZE), you'll open a can of worms: various toolkits / apps deal with it differently:
Some just use the closest size available (Electron and Kitty at the time), so it can be a bit smaller.
Some use the XCursor default size 24, so it's a lot smaller.
Some scale the cursor to the desired size, and the scaling algorithm might be different, resulting in pixelated or blurry cursors; Also they might scale from either the default size or the closest size available, resulting in very blurry (GTK) or slightly blurry (Qt) cursors.
The situation becomes worse with Wayland, as the user now specifies the size in logical pixels, then apps need to multiply it by the global scale to get the size in physical pixels, and try to load a cursor in that size. (If the app load the cursor in the logical size, then either the app or the compositor needs to scale it, resulting in a blurry / pixelated cursor.) With fractional scaling, it's even more likely that the required physical size is not available in the theme (which typically has only 2~5 sizes), and you see the result in the picture above.
One way to fix it (and why I didn't do)
It can be fixed by moving the "when we can't load cursors in the size we need, load a different size and scale it" logic from apps / toolkits to the XCursor lib. When the app requests cursors in a size, instead of returning the closest size available, the lib could scale the image to the requested size. So apps would always get the cursor in the size they ask for, and their own different scaling algorithms won't get a chance to run.
Either the default behavior can be changed, or it can be hidden behind a new option. But I didn't do that, because I felt at the time that it would be difficult to either convince XCursor lib maintainers to make a (potentially breaking) change to the default behavior, or to go around convincing all apps / toolkits to use a new option.
My fix (or shall we say workaround)
Then it came to me that although I can't fix all these toolkits / apps, they seem to all work the same way if the required physical size is available in the theme - then they just draw the cursor as-is. So I added a lot of sizes to the Breeze theme. It only has size 24, 36 and 48 at the time, but I added physical sizes corresponding to a logical size 24 and all global scales that Plasma allows, from 0.5x to 3x, So it's 12, 18, 24 ... all the way to 72.
It was easy. The source code of the Breeze theme is SVG (so are most other themes). Then a build script renders it into images using Inkscape, and packages them to XCursor format. The script has a list of the sizes it renders in, so I added a lot more.
And it worked! If you choose Breeze and size 24, then (as in the bottom row in the picture above) various apps draw the cursor in the same size at any global scale available in Plasma.
But this method has its limitations:
We can't do that to 3rd-party themes, as we don't have their source SVG.
It only works if you choose the default size 24. If you choose a different size, e.g. 36, and a global scale 3x, then the physical size 36x3=108 is not available in the theme, and you see the mess again. But we can't add sizes infinitely, as explained in Vlad's blog, the XCursor format stores cursor images uncompressed, so the binary size grows very fast when adding larger sizes.
Both limitations can be lifted with SVG cursors. But before getting to that, let's talk about the "right" way to fix the cursor size problem:
The "right" fix: Wayland cursor shape protocol
The simple and reliable way to get consistent cursors across apps is to not let apps draw the cursor at all. Instead, they only specify the name of the cursor shape, and the compositor draws the cursor for them. This is how Wayland cursor shape protocol works. Apps no longer need to care about the cursor theme and size (well, they might still need the size, if they want to draw custom cursors in the same size as standard shapes), and since the compositor is the only program drawing the cursor, it's guaranteed to be consistent for all apps using the protocol.
(It's quite interesting that we seem to went a full circle back to the original server-defined cursor font way in X11.)
Support for this protocol leaves a lot to improve, though. Not all compositors support it. On the client side, both Qt and Electron have the support, but GTK doesn't.
There are merge requests for GTK and Mutter, but GNOME devs request some modifications in the Wayland protocol before merging them, and the request seems to be stuck for some months. I hope the recent Wayland "things" could move it out of this seemingly deadlock.
Anyway, with this protocol, only the compositor has to be modified to support a new way to draw cursors. This makes it much easier to change how cursors work. So we come to:
SVG cursors
Immediately after the fix in Breeze, I proposed this idea of shipping the source SVG files of the Breeze cursor theme to the end user, and re-generate the XCursor files whenever the user changes the cursor size or global scale. This way, the theme will always be able to provide the exact size requested by apps. (Similar to the "modify XCursor lib" idea, but in a different way.) It would remove the limitation 2 above (and also limitation 1 if 3rd-party themes ship their source SVGs too).
With SVG cursors support in KWin and Breeze, I plan to implement this idea. It would also allow the user to set arbitrary cursor size, instead of limited to a predefined list.
Problems you might still encounter today
Huge cursors in GTK4 apps
It's a new problem in GTK 4.16. If you use the Breeze cursor theme and a large global scale like 2x or 3x, you get huge cursors:
It has not limited to Plasma. Using Breeze in GNOME would result in the same problem. To explain it, let me first introduce the concept of "nominal size" and "image size" in XCursor.
Here is GNOME's default cursor theme, Adwaita:
"Nominal size" is the "cursor size" we are talking about above. It makes the list of sizes you choose from in the cursor theme settings UI. It's also the size you set in XCURSOR_SIZE. "Image size" is the actual size of the cursor image. "Hot spot" is the point in the image where the cursor is pointing at.
Things are a bit different in the Plasma default cursor theme, Breeze:
Unlike Adwaita, the image size is larger than the nominal size. That, combined with a global scale, triggers the bug in GTK4. Explanation of the bug.
XCursor allows the image size to be different from the nominal size. I don't know why it was designed this way, but my guess is so you can crop the empty part of the image. This both reduces file size, and reduces flicking when the cursor changes (with software cursors under X11). But the image size can also be larger than the nominal size, and Breeze (and a lot of other themes) uses this feature.
You can see in the above images that the "arrow" of nominal size 24 in Breeze is actually similar in size to the same nominal size in Adwaita. But the "badge" in Breeze is further apart, so it can't fit into a 24x24 image. That's why Breeze is built this way. In a sense, "nominal size" is similar to how "font size" works, where it resembles the "main part" of a character in the font, but some characters can have "extra parts" that go through the ceiling or floor.
This problem is already fixed in the main branch of GTK 4, but it's not backported to 4.16 yet, probably because the fix uses a Wayland feature that Mutter doesn't support yet. So at the moment, your only option is to use a different cursor theme whose "nominal size" and "image size" are equal.
Smaller cursors in GTK3 apps (most notably, Firefox)
The cursor code in GTK3 is different from GTK4, with its own limitations. You might find the cursor to be smaller than in other apps, and if you run the app in a terminal, you might see warnings like:
cursor image size (64x64) not an integer multiple of scale (3)
GTK3 doesn't support fractional scales in cursors. So if you have cursor size 24 and global scale 2.5x or 3x, it will use a scale 3x and try to load a cursor with a nominal size 24x3=72. And it requires the image size to be an integer multiple of the scale. So if your theme doesn't have a size 72, or it does but the image size is not multiple of 3, GTK3 fallbacks to a smaller unscaled cursor.
End words
OK, this is a long post. Hope I can bring you more cursor goodies in Plasma 6.3 and beyond.
After almost a year, we’re very pleased to announce a new release of KPhotoAlbum, the Linux/KDE photo management software!
There are two new features/changes:
The “time ago”/birthday/age calculation has been reworked. Timespans should now be displayed in a nicer (more natural) way. Also, the age of people born on February 29 is now calculated correctly.
The ‘--db’ command line argument now rejects any file name that is not either an existing directory or an index.xml file within an existing directory (cf. Bug #418647).
One additional change that should be mostly interesting for the distributors is: The key used for signing the release has been updated. All PGP keys used to sign KDE software releases can be found in the sysadmin/release-keyring repo. My currently used key that I used to sign the tarball can also be found there, cf. tleupold@key2.asc.
… and what about Qt 6?!
Fear not! Of course, there will be a Qt6/KF6 release of KPhotoAlbum. We currently have a working Qt6/KF6 branch, so most of the porting is already done. Last thing that’s missing is a Qt6/KF6 release of Marble, which we use to display maps for geographic coordinates in photos (preferrably stored there using KGeoTag ;-). It seems like there will be such a release towards the end of the year. We will get KPhotoAlbum ready for Qt6/KF6 shortly afterwards. Stay tuned!
According to git log, the following individuals contributed commits since the last release:
I had the privilege of attending LAS this year. True to my role as a designer, I brought my camera and volunteered during the event to be a photographer. The venue and university of Monterrey were beautiful.
The main hall is a wall-to-wall glass building placed in the middle of campus. The pictures we got from there were so nice!
The day began with a review of OnlyOffice features and capabilities. We then reviewed the progress that Mexico has seen in advancing Open Source initiatives.
The sessions showcased a myriad of topics. They focused on how open source applications can make a difference in many areas. Other sessions focused on design guidelines, application-building logic, publication and efforts to promote Linux in education.
The work done by the organization was great. Internet access at the venue was strong, and allowed the team onsite to broadcast the sessions online. We were in a university setting. A team managed the broadcasting and sound for the venue and online audiences.
The city was beautiful and filled with great food.
During the conference I contributed with images that I will make available to the organizers soon.
The Google Summer of Code Mentor Summit is an annual
unconference that every project participating in Google Summer of Code
2024 is invited to attend. This year it was the 20th year celebration of the program!
I was too late to take a picture of the full cake!
We attended many sessions ranging from how to try to avoid falling into the "xz problem" to collecting donations or shaping the governance of open source projects.
We met lots of people that knew what KDE was and were happy to congratulate us on the job done and also a few that did not know KDE and were happy to learn about what we do.
We also did a quick lightning talk about the GSOC projects KDE mentored this year and led two sessions: one centered around the problems some open source application developers are having publishing to the Google Play Store and another session about Desktop Linux together with our Gnome friends.
All in all a very productive unconference. We encourage KDE mentors to take the opportunity to attend the Google Summer of Code Mentor Summit next year, it's a great experience!
[1] me and Albert Vaca, people were moderately amused that both of us had the same name, contribute to the same community and are from the same city.