Skip to content

Thursday, 14 August 2025

This post is somewhat an update for my older post: Kate and Python language server

There seems to be a lot of different Python language servers.. And I just want one that does all and stays out of the way.

So after moaning about that I was pointed towards basedpyright on Fedi.

Despite the silly name, it works really well, so I set it up for Kate editor as I do. Here's how.

Install basedpyright

You may want to use something like pipx for this, that's at least what I did.

pipx install basedpyright

pylsp_in_env.sh

Then add pylsp_in_env.sh to PATH (such as ~/.local/bin/) Kate can see:

#!/usr/bin/env bash

path="$1"
cd $path
if [ -d ./.venv ]; then
  source ./.venv/bin/activate
elif [ -d ./venv ]; then
  source ./venv/bin/activate
elif [ -f ./Pipfile ]; then
  exec pipenv run basedpyright-langserver --stdio
  exit 0
fi

exec basedpyright-langserver --stdio

As mentioned in the previous post, this is needed to get the proper virtual environment. I also updated the script to work with Pipfiles.

Kate lsp settings

Then add this to Kate LSP settings.

I have also kept the pylsp settings there. It doesn't harm anything to have them there, in case you want to change the language server back to python-lsp-server.

{
	"python": {
		"command": [
			"pylsp_in_env",
			"%{Project:NativePath}"
		],
		"root": ".",
		"url": "https://docs.basedpyright.com/latest/",
		"highlightingModeRegex": "^Python$",
		"settings": {
			"basedpyright": {
				"analysis": {
					"typeCheckingMode": "off"
				}
			},
			"pylsp": {
				"plugins": {
					"pycodestyle": {
						"enabled": false
					},
					"ruff": {
						"enabled": true
					}
				}
			}
		}
	}
}

You can change the typeCheckingMode to different values like basic and recommended if project demands it. I set it off because with recommended there's A LOT of diagnostics that I usually don't need, unless again, the project expects proper type checking.

Done!

And that's it. Restart Kate or the Language server inside Kate and as long as Kate can find the file, it should just start up basedpyright-langserver and work.

I like this language server a lot, but if there's other challengers in future, expect me to make a post about them too.

Until next time!

Wednesday, 13 August 2025

Qt Group is pleased to announce the latest Long Term Supported release of Qt for MCUs. The 2.11 release is concentrated on stability with fewer new features . 

This blog lists some of the standout highlights from the 2.11 release and provides a roadmap of 2.x release for the rest of the year. 

KStars v3.7.8 is released on 2025.08.13 for Windows & Linux. MacOS release is pending. It's a bi-monthly bug-fix release with a couple of exciting features.

Live Stacking

The moment many of you have been waiting for has arrived! John Evans has introduced the highly anticipated Live Stacking feature to Ekos, seamlessly integrated into the FITS Viewer. Once you configure your live stacking directory, any FITS images added will be automatically stacked in real-time.

This feature works independently of your existing sequences or scheduler sessions, allowing you to configure the live stacker to process captured images for an enhanced view of your final results. It's particularly valuable for public observatories and star parties, where real-time feedback can greatly enhance the viewing experience.

Since Live Stacking is still in beta, we welcome your feedback and suggestions for improvement. Check out the demonstration videos below to see the feature in action and learn about its capabilities.


Equipment Profile Editor

The Ekos Equipment Profile editor has received a complete redesign. We've eliminated the limitations of the previous editor—you can now add unlimited drivers to your equipment profiles without restrictions. Need three different mounts in a single profile? No problem!

Both driver and profile lists now include search functionality, making it quick and easy to locate specific drivers. This flexibility gives you unprecedented control over your equipment configurations.



Focus History Navigation

Wolfgang Reissenberger has added an invaluable Focus History navigation feature. When autofocus encounters issues, you can now navigate through your focus frame history to inspect images from all autofocus runs, making troubleshooting much more effective.

The Focus module now includes a dedicated navigation panel. To optimize screen real estate, we've moved the detected stars display and current HFR readings above the V-Curve rather than below it, freeing up valuable space.


To use this feature, simply configure the maximum number of stored frames in your Focus settings. The navigation controls are active only when autofocus sequences aren't running.



FITS Viewer Stretch Presets

Hy Murveit has refined the FITS Viewer stretch sliders and added a convenient preset button that cycles through seven different stretch configurations, offering various combinations of background brightness and contrast levels.

When you display the histogram and zoom in, the sliders provide much finer resolution control—particularly useful for precise black point adjustments.

Flatpak Support

Thanks to extensive collaboration between the Ikarus Technologies team, KDE Infrastructure team, and the Flathub community, we now offer both Stable and Nightly Flatpak packages.

The KStars Flatpak includes all INDI drivers and runs securely within the flatpak sandbox environment. This allows you to install both Stable and Nightly versions simultaneously without conflicts; perfect for testing the latest features and bug fixes while maintaining access to the stable release.

For installation on a brand new system, you'll need to install INDI firmware files. We've prepared comprehensive instructions and a simple installation script for both stable and nightly versions to facilitate this process.

Polar Alignment Improvements

Hy Murveit improved the Polar Alignment algorithm, especially when it the mount is close to the meridian. Wolfgang Reissenberger improved the the size of the arrows indicating the direction of the necessary adjustments so they're more visible in the Polar Alignment Assistant.

Migration to Qt6

This release represents a significant technical milestone with our complete migration to Qt 6 and KDE Frameworks 6. KStars is still compatible with Qt 5 until all major distributions fully switch to Qt 6. While these changes happen behind the scenes, they provide a more robust foundation for future development.

The entire KStars development team contributed to this substantial effort. Special recognition goes to Eric Dejouhanet and Robert Lancaster, who invested countless hours reworking our complex CI/CD pipelines and macOS support builds in KDE's Craft system. This release wouldn't have been possible without their exceptional dedication.


Monday, 11 August 2025

Dark mode has been available in Plasma for quite a while now but the next release explores new areas where it can be taken one step further, beginning from some behind the scenes infrastructure to more user facing features such as dynamic wallpapers and automatic day/night global theme switching.

My journey to improving dark mode capabilities started at the recent Plasma Sprint. A while ago, I developed a wallpaper plugin that’s capable of synchronizing images to the position of the Sun, which I wanted to upstream but one of the biggest issues was the sheer size of the project. It supports a bunch of modes, it requires special tooling, and the wallpaper format is too cumbersome for upstream (although it’s amazing for 5K or 8K images!). So, I decided to make a pitch for adding one of the modes available in that plugin to other Plasma developers, which should be very easy to integrate with the existing infrastructure in Plasma. The idea was well-received and it led to a discussion about other related things, like better integration of geolocation services in Plasma, etc.

Plasma Sprint 2025

Day/night wallpapers

Some wallpaper packages can contain light and dark images. Currently, the light image will be used with a light color scheme, and the dark image will be used with a dark color scheme. The main idea behind the new day/night dynamic wallpapers was to exploit this design of the wallpaper packages: switch between light and dark images depending on the elevation of the Sun rather than the color scheme.

New day/night mode

The plasma5-wallpapers-dynamic served as the basis for the new dynamic wallpaper mode in Plasma. It works exactly like we want. If geolocation data is available, use it to compute the position of the Sun. The daylight duration varies depending on your location throughout the year; by taking the geolocation into account, the dynamic wallpapers can closely match the dark/light cycle. If the geolocation is unknown, fall back to some pre-configured morning and evening times.

From functional point of view, it doesn’t have any purpose, but it’s a lovely touch that helps you to personalize your computer.

While on this, we also looked into optimizing the wallpaper configuration dialog. Specifically, fixing GridView in QtQuick so it is possible to reuse wallpaper preview items for smoother scrolling and re-working the wallpaper preview generation process for better performance and to make it less error prone.

How to create a day/night wallpaper

A day/night wallpaper is a regular wallpaper package but with light and dark images, Plasma does the rest to figure out what images should be displayed.

For example, imagine that you want to create a wallpaper with a lake. Then the wallpaper would look something like this

Lake/
├── contents
│   ├── images
│   │   ├── 1080x1920.png
│   │   └── 5120x2880.png
│   └── images_dark
│       ├── 1080x1920.png
│       └── 5120x2880.png
└── metadata.json

The Lake folder contains two things: a contents folder with images and a metadata.json file. The metadata.json file provides extra information about the wallpaper, e.g. the author, etc.

{
   "KPlugin": {
       "Authors": [
           {
               "Email": "foobar@example.com",
               "Name": "Name of the author"
           }
       ],
       "Id": "Next",
       "License": "CC-BY-SA-4.0",
       "Name": "Lake"
   },
"X-KDE-CrossFade": true
}

The Id specifies the unique id of the wallpaper, the Name specifies the human readable name of the wallpaper. The metadata may also contain an X-KDE-CrossFade key, this is used to enable or disable long cross-fade. For example, if the transition from day to night lasts 30 minutes, then Plasma will slowly cross-fade from the light to the dark image for 30 minutes. Such a long cross-fade transition can be undesired if the images are too distinct.

images and images_dark folders contain light and dark images, respectively. Note that image file names must match the image resolution, i.e. 5120x2880.png instead of light.png, etc.

The wallpaper should be installed in /usr/share/wallpapers or ~/.local/share/wallpapers.

knighttime(d)

In addition to day/night wallpapers, it would also be nice if more things could be more dynamic. For example, switching the global theme at night. However, this creates a bit of a problem. If you want to configure the times when wallpapers or themes need to be changed, you will need to set settings for every feature individually, which is not great.

To solve that problem, a new desktop component was introduced that orchestrates when morning and evening transitions occurs – KNightTime. It’s a super duper tiny project with a client library and a daemon (knighttimed) that provides the schedule for day/night cycle transitions.

Since all features that synchronize to the day/night cycle subscribe to KNightTime, you only need to configure it to use specific morning and evening times. Night Light, day/night wallpapers and so on will be all synchronized.

knighttimed runs in background and it is started on demand, so in most cases, you don’t even need to worry about its existence.

Day/night themes

Besides the wallpaper, one can also switch between light and dark global themes depending on time of day.

Perhaps the hardest part about this was figuring out how to retrofit our system settings to accommodate for this new mode rather than actually implementing the logic that changes the active theme. Many thanks to Felix Ernst and Nate Graham for providing mock-ups and feedback about the UI.

Global theme options
Landing page

It is worth noting that Plasma will switch between the themes only if the computer has been idle for 5 seconds. The main reason behind this is to avoid interruptions while actively using the computer. In case you don’t like it, you can turn it off in system settings or increase the default idle interval if you think it’s too low for your needs.

With the automatic mode, the global theme switching code is going to be stress-tested quite a bit, so we’ve also started (and continue) looking into various paper cut issues regarding theme switching, e.g. some buttons not adapting to the new color scheme correctly, etc.

Future improvements

There are other things that can be synchronized to the day-night cycle, for example screen brightness. Although, there is nothing clear on the radar yet.

Conclusion

The next release is going to feature a few dark mode improvements. Some are pretty technical, some are very user facing. In either case, I hope that things like this will help to make Plasma users happier and make Plasma stand out more among other desktop environments.

Intro

Last week, I added canvas limitations to keep the Selection Action Bar within a user's view. This week, I focused on positioning the toolbar so it renders directly underneath the initial selection instead of a hard coded value on the canvas. This change improves the user experience by reducing mouse travel and making the toolbar feel more intentional and intuitive to use.

Side note: This week I also added 2 buttons: 'Fill with Color' and 'Crop to Selection'.

Obstacles to Implementation

The first step to render the Selection Action Bar under the selection was to find the selection's coordinates.

Mapping Coordinates

The difficulty and learning opportunity I found during this process was understanding the difference between the image space and the canvas space. To keep it simple, selections live in the image space and the Selection Action Bar lives in the canvas space. Due to zooming in and out, different resolutions, and resizing, coordinates in the image space are not always equal to the canvas space. So to translate/map the coordinates of the selection to match where the toolbar should render, we can use KisCoordinatesConverter to translate these coordinates from image space to canvas space.

// get current selection
KisSelectionSP selection = d->m_viewManager->selection();

// get coordinates of current selection
QRectF selectionBounds = selection->selectedRect();
int selectionBottom = selectionBounds.bottom();
QPointF selectionCenter = selectionBounds.center();
QPointF bottomCenter(selectionCenter.x(), selectionBottom);

// translate the selection coordinates to the canvas widget space
QPointF widgetBottomCenter = converter->imageToWidget(bottomCenter);

// adjust/center/space how the toolbar renders under the selection
widgetBottomCenter.setX(widgetBottomCenter.x() - (d->actionBarWidth / 2)); 
widgetBottomCenter.setY(widgetBottomCenter.y() + d->bufferSpace);

// update the relative position of the toolbar
d->dragRectPosition = widgetBottomCenter.toPoint();

Conclusion

With these improvements, the UI now feels user friendly and intentional. For the next (and final) 2 weeks of GSoC, I plan to organize my documentation to build out a technical page on Krita's official documentation website and to refactor some code for better maintainability.

Contact

To anyone reading this, please feel free to reach out to me. I'm always open to suggestions and thoughts on how to improve as a developer and as a person. Email: ross.erosales@gmail.com Matrix: @rossr:matrix.org

Saturday, 9 August 2025

The Amarok Development Squad is happy to announce the immediate availability of Amarok 3.3.1, the first bugfix release for Amarok 3.3 "Far Above the Clouds"!

3.3.1 features a number of minor bugfixes and code and build system cleanups. Some occasional crashes related to the new audio backend have also been fixed, and the remaining non-theme icons in user interface have been replaced. The new release also features improvements to the scripting support. Although current scripting functionality is not yet on a par with that of 2.x series in the '10's, especially the script console improvements should help anyone willing to explore the current capabilities.

Changes since 3.3.0

FEATURES:
  • Enable saving and loading script console items, autocompletion in script console, and re-enable some more scripting functionality
CHANGES:
  • Convert the remaining main UI toolbuttons to use icons from theme
  • Clear out remnants of the now-discontinued MusicDNS service
BUGFIXES:
  • Fix example permission grant command in database settings (BR 386004)
  • Fix equalizer gains not updating when selecting some presets (BR 463908)
  • Fix continuing playback after timecoded tracks (cue files etc, (BR 270003)
  • Fix MusicBrainz search
  • Properly start CD playback if Amarok is not already running (BR 503310)
  • Also transmit embedded cover art through MPRIS (BR 357620)
  • Don't show transcoding dialog after canceling download (BR 275840)
  • Load network information earlier to avoid crashes on startup (BR 507497)
  • Try to export as-compatible-as-possible playlist files (BR 507329)
  • Fix some random crashes during playback

Getting Amarok

In addition to source code, Amarok is available for installation from many distributions' package repositories, which are likely to get updated to 3.3.1 soon, as well as the flatpak available on flathub.

Packager section

You can find the tarball package on download.kde.org and it has been signed with Tuomas Nurmi's GPG key. One should also observe that Amarok 3.3.1 drops the previous optional build-time dependency to ffmpeg.

Welcome to a new issue of This Week in Plasma!

Every week we cover the highlights of what’s happening in the world of KDE Plasma and its associated apps like Discover, System Monitor, and more.

This week some cool features and UI improvements landed. We’re in the middle of the Plasma 6.5 development cycle, so now’s the time to get your features merged, folks!

Notable New Features

Plasma 6.5.0

Pages in System Settings have gained the ability to communicate with the parent app a little bit. Now they can mark themselves as “not relevant”, for example when you don’t have the necessary hardware to use them. They can also export actions that will appear in the sidebar, allowing quick toggles for things like Bluetooth and Wi-Fi. This has already been implemented for Bluetooth, and expect pages to start adopting these features soon where it makes sense! (Kai Uwe Broulik, link 1, link 2, and link 3)

System Settings showing quick toggle for Bluetooth in sidebar

Discover has gained support for flatpak+https:// URLs, which allows the Install buttons on Flathub to automatically open Discover. (Timothée Ravier)

Notable UI Improvements

Plasma 6.5.0

Muting microphones with a dedicated "Mute Microphone" button/shortcut or else using the very cool secret Meta+Mute Microphone shortcut now mutes all microphones, rather than just the active one. This matches the behavior of muting speakers and other sound output devices. (Arnav Rawat, link)

Made a whole bunch of improvements to the cross-app window raising system throughout Plasma. You can read more about it in Kai Uwe’s blog post on the topic. (Kai Uwe Broulik and Xaver Hugl, link 1, link 2, link 3, link 4, link 5, link 6, link 7)

The Plasma Browser Integration plugin for Firefox now blocks the system from going to sleep while a file is downloading, since Firefox doesn’t provide this feature itself. (Kai Uwe Broulik, link)

Detected wireless networks are now shown on the relevant System Settings page, not just the System Tray applet anymore. You can connect to them there, too. (Arnav Rawat, link)

Almost all KRunner plugins now start to provide results after the first character typed. (Nate Graham, link)

Shortcuts for moving a window directly to another virtual desktop are now shown in the window titlebar context menu for that window. (Kai Uwe Broulik, link)

It’s now easier to see which screens are replicas of which other ones, because their serial numbers and connector names are now shown visibly. (Evgeniy Harchenko, link)

Notable Bug Fixes

Plasma 6.4.4

System Settings’ Tablet page is now scrollable so you can see everything if you have a fancy pen with a lot of features. (Joshua Goins, link)

Fixed a visual glitch affecting Kicker Application Menu widget’ search field. (Christopher Wolk, link)

Plasma 6.4.5

Fixed the top crash in Plasma right now that could sometimes cause it to crash when you opened the Notifications history with any notifications in it. We thought we had fixed this before, but it came back, and now we have a better fix. (Arjen Hiemstra, link)

Fixed a really bad bug that would cause the .desktop file for a Flatpak app installed in your home folder to get moved when you dragged it from the Kickoff Application Launcher or Task Manager to somewhere else. (Marco Martin, link)

Fixed another bug related to dragging Flatpak apps to the desktop; now selecting “Copy” no longer produces a broken copy of the app’s .desktop file. (Marco Martin, link)

Fixed some more bugs that could cause desktop icons to shift around especially with multiple screens, and also for newly created files close to a vertical panel to be mis-positioned. (Akseli Lahtinen, link)

Task Manager theme previews now use the correct color scheme. (Nicolas Fella, link)

Frameworks 6.18

Fixed a bug that caused System Monitor Sensor widgets to be sized incorrectly on fit-content panels and make them resize themselves. (Leia Uwu, link)

Other bug information of note:

Notable in Performance & Technical

Plasma 6.5.0

Made Discover’s firmware updating (“Fwupd”) backend much faster, after it was discovered to be a bottleneck in launching Discover. (Aleix Pol Gonzalez, link)

Frameworks 6.18

You can now use the dumb Copilot key on the keyboards of many modern laptops as the trigger for launching apps or any other action in places where you can set up keyboard shortcuts. We don’t yet have a way for you to re-bind it to emulate another key (like the Ctrl key you probably wanted all along), but hopefully that will eventually happen as well. (Kai Uwe Broulik, link)

Improved the speed of thumbnail generation throughout KDE apps and Plasma. (Akseli Lahtinen, link 1 and link 2)

How You Can Help

KDE has become important in the world, and your time and contributions have helped us get there. As we grow, we need your support to keep KDE sustainable.

You can help KDE by becoming an active community member and getting involved somehow. Each contributor makes a huge difference in KDE — you are not a number or a cog in a machine! You don’t have to be a programmer, either; many other opportunities exist!

You can also help us by making a donation! A monetary contribution of any size will help us cover operational costs, salaries, travel expenses for contributors, and in general just keep KDE bringing Free Software to the world.

To get a new Plasma feature or a bugfix mentioned here, feel free to push a commit to the relevant merge request on invent.kde.org.

Friday, 8 August 2025

As of a couple days ago Filelight on Windows is performing its search many times faster than before. Go check it out!

https://apps.kde.org/filelight/

It’s shocking that it was slow to begin with… A few years ago I rewrote the Filelight file walking logic to use native API for Linux and Windows. I thought I did a pretty good job of it and speed wasn’t too shabby. You can imagine my surprise when a friend recently pointed out that a similar piece of software performed maybe even better. Obviously this couldn’t stand. I immediately went to profile the situation and indeed Filelight wasn’t as fast as expected.

It turns out there are multiple competing APIs for querying file information on Windows and depending on which gets used performance may not be what you would expect. There’s a good write-up at https://www.cppstories.com/2024/cpp-query-file-attribs-faster/ in case you care to read more.

Long story short: by not calling slow API, Filelight is now heaps faster than before. Scans that took multiple seconds before now finish in the blink of an eye.

In case you are wondering just how much faster it is:

New

Old

Enjoy!

Let’s go for my web review for the week 2025-32.


Big Tech’s “Sovereign Cloud” promises just collapsed — in their own words

Tags: tech, cloud, privacy, law

Indeed, you can’t trust claims of the big cloud players. If asked by they will hand out your data, wherever it is hosted.

https://nextcloud.com/blog/big-techs-sovereign-cloud-promises-just-collapsed-in-their-own-words/


Does Free Software Restore Dignity?

Tags: tech, foss, education, ethics

This is an old one, but I think that even without DVDs in the mix the core of the stories are still valid.

https://www.pcworld.com/article/491934/does_free_software_restory_dignity.html


New Method Is the Fastest Way To Find the Best Routes

Tags: tech, algorithm, graph, routing

Looks like we’ll be able to leave Dijkstra’s algorithm behind at some point.

https://www.quantamagazine.org/new-method-is-the-fastest-way-to-find-the-best-routes-20250806/


Digital hygiene: Emails

Tags: tech, email

This is a good way to deal with email. My approach is fairly similar and I confirm it works nicely for me.

https://herman.bearblog.dev/digital-hygiene-emails/


When Flatpak’s Sandbox Cracks: Real‑Life Security Issues Beyond the Ideal

Tags: tech, flatpak, security

Still some work to have proper confinement in practice for apps in the Flatpak ecosystem.

https://www.linuxjournal.com/content/when-flatpaks-sandbox-cracks-real-life-security-issues-beyond-ideal


Everything you wanted to know about SQL injection (but were afraid to ask)

Tags: tech, databases, sql, security

An oldie but a goodie about SQL injection. Does a good job getting the overall picture of this particular security plague.

https://www.troyhunt.com/everything-you-wanted-to-know-about-sql/


Python performance myths and fairy tales

Tags: tech, python, performance

It’s just hard to make Python fast. It can be improved yes, but it’ll stay cache un-friendly without a redesign. Nobody wants a Python 4. :-)

https://lwn.net/SubscriberLink/1031707/73cb0cf917307a93/


Litestar is worth a look

Tags: tech, python, django, fastapi, framework, web, backend

Looks like an interesting alternative to the bigger Django and FastAPI which get all the attention.

https://www.b-list.org/weblog/2025/aug/06/litestar/


How we made JSON.stringify more than twice as fast

Tags: tech, javascript, performance, optimization

Interesting tricks to optimize this function in V8.

https://v8.dev/blog/json-stringify


The Generativity Pattern in Rust

Tags: tech, rust, type-systems, language

Very interesting pattern. The article is really in-depth and gets all the way to language lawyer level. It’s not for everyone I guess.

https://arhan.sh/blog/the-generativity-pattern-in-rust/


Single Responsibility Principle: Why Does it Matter?

Tags: tech, programming, design

The example is maybe a bit on the simplistic side. Still it helps understand why you need to pay attention to the SRP.

https://8thlight.com/insights/single-responsibility-principle-why-does-it-matter


Domain-Oriented Observability

Tags: tech, architecture, observability, logging

Observability is indeed not necessarily easy to fit into a code base. Here is a potential approach to make it easier. I wouldn’t use it on a project where we’re only logging, but once you add metrics to the mix, this kind of probes can be worthwhile.

https://martinfowler.com/articles/domain-oriented-observability.html


New project, new tech stack?

Tags: tech, architecture, motivation

Or why you should know why you’re picking a new tech stack… or not. Don’t just blindly follow fashions.

https://avdi.codes/new-project-new-tech-stack/


The Twelve-Factor App

Tags: tech, web, services, architecture, devops, developer-experience

This is a good list of guidelines to produce a service which is less of a pain to test locally, deploy and operate. Of course, don’t take everything at face value (not all of it aged well) but it’s a good source for inspiration.

https://12factor.net/


Microservice Premium

Tags: tech, architecture, microservices, complexity

Or why the microservice cargo cult which has been going on for a while now infuriates me. It totally ignores the complexity it brings.

https://martinfowler.com/bliki/MicroservicePremium.html


What Is Quality?

Tags: tech, quality, agile

The question is always valid. I like this particular answer.

https://www.mountaingoatsoftware.com/blog/what-is-quality


Common Code Smells

Tags: tech, craftsmanship, quality, smells

A short list of common code smells that people need to know.

https://8thlight.com/insights/common-code-smells


The Domain Discontinuity

Tags: tech, tdd, design, architecture, ux

When you realize TDD is about units of behavior… then you can see what can be iterative and what can’t in your process. In other word, what is dictated by the problem domain is iterative, what is dictated by system architecture is not. Luckily, the latter is often related to the user experience you’re aiming for.

https://blog.cleancoder.com/uncle-bob/2014/01/27/TheChickenOrTheRoad.html


Unit Testing Principles

Tags: tech, tests, tdd

The design proposed is a bit too clear cut for my case. Other than that it’s fairly aligned with what I preach.

https://olano.dev/blog/unit-testing-principles/


Test Coverage

Tags: tech, tests, coverage

Or why meeting targets is not what you want. It’s still a good guide though.

https://martinfowler.com/bliki/TestCoverage.html


It’s Not Just Standing Up: Patterns for Daily Standup Meetings

Tags: tech, agile, organization, team, project-management

A good reminder that there’s a lot of things going on in something as mundane as a stand up meeting. It needs to be organized properly for the needs of the teams.

https://martinfowler.com/articles/itsNotJustStandingUp.html


Anti-Management? No, Different Management

Tags: tech, agile, product-management, project-management, management

There’s often confusion as to where the management responsibilities are in agile teams. This little rambling does a good job pointing it out and giving an idea of how management happens inside and around teams.

https://ronjeffries.com/articles/019-01ff/management/


A user manual for me

Tags: organization, communication, management

Interesting idea. Didn’t make one but maybe I should sit and take some time to do that.

https://cassierobinson.medium.com/a-user-manual-for-me-d3a851fbc694


If you’re remote, ramble

Tags: tech, remote-working, communication

Interesting trick for remote teams. There are many ways to try to get back the “water cooler talk” in your organization, it’s the first I encounter structured like this.

https://stephango.com/ramblings


Filling a Team Position

Tags: hr, hiring, management

It’s indeed not only about skills but also about roles… and the natural tendencies to cover them.

https://estherderby.com/filling-a-team-position/


Hiring Isn’t Enough by Catt Small

Tags: tech, management, diversity, culture

Indeed, it’s not just about hiring people it’s also about having a safe culture in the workplace.

https://modelviewculture.com/pieces/hiring-isn-t-enough


Yes, you can speak at a conference

Tags: tech, conference, talk

Please go ahead and share what you know! This article gives good tips on how to get started and why you can do it.

https://8thlight.com/insights/yes-you-can-speak-at-a-conference



Bye for now!

Using the Qt Logger in Rust with CXX-Qt

For projects incorporating Rust and Qt, a minor but important problem can arise: too many sources of log messages. In the usual case, one of these is from Rust (and crate dependencies) and another is from Qt. Our Rust and Qt solution, CXX-Qt, exposes a new API to help with this in the upcoming 0.8.0 release.

There are several benefits to ensuring your log messages go through one logger. It makes it easier to redirect said messages into a file, there's less configuration required for end users, and it makes consistent formatting easier.

Qt has its own logging infrastructure, and their suggested way to print messages in Qt applications. It has a category system, rules for filtering which messages you want to see, custom formatting and so on. Applications like GammaRay can also display messages from Qt, and configure which categories are emitted.

One of the more popular logging libraries in Rust is called tracing, and we're going to show how you can redirect messages from it to the Qt logger. The integration can work for any other logging crate too, including your own custom solution.

Getting started

Before we start splicing the two log streams, let's quickly go over sending a Qt log message in Rust. Assuming you already have a CXX-Qt application (and if you don't, you can follow our book, construct a message log context with QMessageLogContext:

let file = CString::new("main.rs").unwrap();  
let function = CString::new("main").unwrap();  
let category = CString::new("lib").unwrap();  
  
let context = QMessageLogContext::new(&file, 0, &function, &category);

You can specify the filename, the line number, the function name and even a category. We have to use CString here because QMessageLogContext in C++ uses const char*, not QString.

Note that there isn't a way to get the name of the currently calling function out of the box in Rust, but there are alternative solutions if you want that information.

Now that we have a context, we can send a message to the Qt logger. We can do this using the unfortunately undocumented qt_message_output function. This sends a message to the currently installed message handler.

Note that CXX-Qt currently doesn't have Rust bindings to install a custom one.

The default message handler goes to the standard output and error streams. This function takes a QtMsgType, the context we just created, and a QString message:

qt_message_output(  
    QtMsgType::QtInfoMsg,  
    &context,  
    &QString::from("This is an informational message..."),  
);

And voilà:

lib: This is an informational message...

But that looks pretty plain, and we can't see any of our context! Most information available in the Qt logger isn't shown by default, but we can modify it by using the QT_MESSAGE_PATTERN environment variable.

I used the comprehensive example given in the linked documentation, but it's useful for showcasing the context:

export QT_MESSAGE_PATTERN="[%{time yyyyMMdd h:mm:ss.zzz ttt} %{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}] %{file}:%{line} - %{message}"
[20250314 8:56:45.033 EDT I] main.rs:0 - This is an informational message...

Now that we have sent our first Qt log message from Rust, let's up the ante and integrate the tracing crate.

Integrating with Tracing

To redirect events from tracing, we have to add a subscriber that forwards events to Qt. This basically means anything that uses tracing (e.g. your application, another crate) will be picked up.

As a side effect of tracing's flexibility, we also have to create our own Visitor. This is necessary because tracing records structured data, and we need to flatten said data to a string.

use std::fmt::Write; // needed for write_fmt

struct StringVisitor<'a> {
    string: &'a mut String,
}

impl tracing::field::Visit for StringVisitor<'_> {
    fn record_debug(&mut self, field: &tracing::field::Field, value: &dyn std::fmt::Debug) {
        write!(self.string, "{} = {:?} ", field.name(), value).unwrap();
    }
}

And now for the custom layer that will catch the events, and send them to Qt:

pub struct QtSubscriber {}

impl<S> tracing_subscriber::Layer<S> for QtSubscriber
    where
        S: tracing::Subscriber,
{
    fn on_event(
        &self,
        event: &tracing::Event<'_>,
        _ctx: tracing_subscriber::layer::Context<'_, S>,
    ) {
        let mut buffer: String = String::new();
        let mut visitor = StringVisitor {
            string: &mut buffer
        };
        event.record(&mut visitor);

        let msg_type = match *event.metadata().level() {
            tracing::Level::ERROR => QtMsgType::QtCriticalMsg,
            tracing::Level::WARN => QtMsgType::QtWarningMsg,
            tracing::Level::INFO => QtMsgType::QtInfoMsg,
            tracing::Level::DEBUG => QtMsgType::QtDebugMsg,
            tracing::Level::TRACE => QtMsgType::QtDebugMsg
        };

        let file = if let Some(file) = event.metadata().file() {
            CString::new(file).unwrap()
        } else {
            CString::default()
        };

        let line = if let Some(line) = event.metadata().line() {
            line as i32
        } else {
            0
        };
        
        let function = CString::default();  
        let category = CString::new("lib").unwrap();  

        let context = QMessageLogContext::new(&file, line, &function, &category);  

        qt_message_output(msg_type, &context, &QString::from(buffer));
    }
}

And finally, we have to register our new layer with the registry:

use tracing_subscriber::layer::SubscriberExt; // needed for with
use tracing_subscriber::util::SubscriberInitExt; // needed for init

tracing_subscriber::registry().with(QtSubscriber{}).init();

Afterwards, try sending a message using tracing::info! and see if it works:

tracing::info!("This is an informational message... from tracing!")

Using a more comprehensive QT_MESSAGE_PATTERN, you should get a log message from Qt. Note that "message" is written here, as that's the default field in tracing:

[20250320 10:41:40.617 EDT I] examples/cargo_without_cmake/src/main.rs:104 - message = This is an informational message...

These new bindings in CXX-Qt should be useful to application developers who want to adopt the best logging crates in Rust, while ensuring their messages are forwarded to Qt. If you want to redirect Qt log messages to Rust, CXX-Qt doesn't have a way to install custom message handlers yet.

See our KDABLabs repository for complete examples of the snippets shown here.

The post Using the Qt Logger in Rust with CXX-Qt appeared first on KDAB.