Skip to content

Thursday, 26 October 2023

KDE has a long and storied history of customisation, allowing people to express themselves freely through the desktop and truly

Reworking Recent Files search for Plasma 6

For Plasma 6, lots of KRunner plugins and framework functionalities were improved. I took quite a bit of time to work on the recent files search plugin used by KRunner and Plasmas application launchers like Kickoff. This included performance improvements, usability improvements and technical refactorings.

Let’s start off with the usability improvements: While the runner was named “Recent Files”, it still provided results for directories. In Dolphin on the other hand, “Recent Locations” are a separate location you may access next to “Recent Files”. Luckily, functionality for only querying files already exists in the KActivities-Stats framework :).
The search for files was also improved. Natalie Clarius added some time ago a patch to avoid false positives when the query is part of the file path. For example, when you type for “myfile” and “/home/user/myfiles/test” was a recent file, this file would be returned by the KActivities-Stats framework. With Natalie’s logic, those files would not be shown in KRunner, but still they fill out the limit of recent files we want to query. Of course, one could look for more files in case we discarded too many, but that can cause a performance penalty due to additional SQL queries.
Instead, I have added the ability to filter by the filename in KActivities-Stats. This means false positives are always avoided, and you will for sure get the results you are looking for!

Another useful, but not yet user-facing change is special handling for queries shorter than 3 characters. For those queries, a substring check would cause too many unintended results to be useful. Instead, the filename must start with your given query. Similar to how the Applications-runner handles it. There are plans to make this feature more easily accessible, but for now, it can only be done on the command line using krunner --runner=krunner_recentdocuments.

Example of single-plugin mode
Screenshot of KRunner in single-plugin mode with the recent files plugin

The final issue that everyone will benefit from being fixed is a memory leak. This means for each letter typed, the runner would allocate a bit more RAM for results from the query. This can add up over time in KRunner and Plasmashell. The KActivities-Stats that were “leaking” also caused CPU overhead, because they were notified about changes to the recent files list – even though they were never used again.
Luckily, you don’t have to worry about that at all from now on :).

Optimizations

Let us start with the small improvements: In my previous posts, I mentioned that constructing a QueryMatch object before being sure that the current item (application or systemsettings module) matches, causes a performance overhead. The same applied to the recent files plugin, because we discarded some files due to the false positive detection mentioned above.
Getting the filename was also optimized/simplified, because instead of using Qt API to get the filename from the URL, we can just use the resource title from KActivities-Stats.
String comparisons were speed up by reusing the results. For example, when checking if the filename contains the query, we can get the resulting index. If that index is 0, the query is contained and the filename also starts with it. Meaning we’d only do one string comparison for each recent file instead of up to 4.

Getting the appropriate icon is also way faster, because previously a method from KIO was used, which gets the file path, checks some extra cases, but usually gets the icon for the determined mime type. Because the extra cases were not relevant when only allowing files, we can directly get the icon for the respective mimetype. Luckily, we don’t even need to determine the mimetype, because the model already contains it.

Reusing previously fetched data

This is the most interesting part and was my original idea to improve performance: In KDE Frameworks 6, each runner lives in its own thread. Meaning, one may access member variables in a thread safe way. The data we want to reuse is the KActivities-Stats ResultsModel. This contains paths and additional metadata of recently used files. The number of files is limited to 20, which is the maximum number of entries is KRunner.
Implementing was straightforward: If one previously typed “firef” and after that “firefox”, the previous model can be reused as long as the limit of 20 did not exceed the previously found results. In addition to reusing the data, it is required to check the filenames again, because a file called “firef.test” should not match a query called “firefox”. Due to the preexisting logic to determine the match relevance, this is minimal additional work.
When measuring the real-world impact, it is important to note that fetching results from KActivities SQLite database is the most expensive part. Accessing the model is relatively cheap. Meaning the longer your queries are and if long as the number of results was not exceeded, your performance gains will be significant!

Unoptimized Profiling of the unoptimized version, loading the correct Icon takes a large porting of CPU cycles Optimized Optimized version, CPU cycles are significantly reduced and loading of icons is barely distinguishable from other, minor costs

In benchmarks, one is able to see that the CPU cycles with this patch are roundabout the same among the different measurements, whereas the CPU cycles before this patch correlated with the length of the query. The query was typed in letter by letter, keep in mind that the runner skips queries shorter than 3 characters unless the single runner mode is activated. For benchmarks, I decided against activating this mode, because it is not the normal usecase.

QueryCPU Cycles beforeCPU Cycles with changeReduction
mytextfile1.73E+103.592E+0979%
user8.291E+093.148E+0962%
firefox1.325E+103.601E+0973%

Monday, 23 October 2023

Tellico 3.5.2 is available, with a few new features and fixes.

Improvements and Bug Fixes

Friday, 20 October 2023

Let’s go for my web review for the week 2023-42.


F-Droid version of KDEConnect uninstalled by PlayProtect - Help - KDE Discuss

Tags: tech, android, google, trust

This will lower even more the trust we can have in those devices. The only way to really own them seems be to just blow the warranty and flash them…

https://discuss.kde.org/t/f-droid-version-of-kdeconnect-uninstalled-by-playprotect/5992


I’m banned for life from advertising on Meta. Because I teach Python. — Reuven Lerner

Tags: tech, facebook, ai, machine-learning, automation, criticism

The risks of too much automation… this is chilling to see what using machine learning based system all the way can lead to. It’s just a ridiculous situation and no way to get out of it.

https://lerner.co.il/2023/10/19/im-banned-for-life-from-advertising-on-meta-because-i-teach-python/


We Were Wrong About the GPLs — /dev/lawyer

Tags: tech, foss, licensing, law

Interesting line of argument regarding Free Software licenses. I wonder what the judges will conclude in the end… this could have important consequences.

https://writing.kemitchell.com/2023/10/13/Wrong-About-GPLs


Google-hosted malvertising leads to fake Keepass site that looks genuine | Ars Technica

Tags: tech, browser, google, attention-economy, security

This is a bad case of content moderation if it gets presented to users like this… but Google is not going to leave advertisement money on the table. The way browsers changed in recent years also make this kind of deceptions easier (harder to check certificates, hard to spot punycoding).

https://arstechnica.com/security/2023/10/google-hosted-malvertising-leads-to-fake-keepass-site-that-looks-genuine/


Atlas of Surveillance

Tags: tech, surveillance

US centric but a very welcome tool. Let’s hope we get similar initiatives for other countries as well.

https://atlasofsurveillance.org/


Encrypt. Now.

Tags: tech, privacy, surveillance, politics

Definitely very important as our privacy is attacked once more…

https://blog.tripu.info/encrypt/


Multi-modal prompt injection image attacks against GPT-4V

Tags: tech, ai, gpt, security

This is a hard problem to solve, and going multi-modal makes it harder in my opinion.

https://simonwillison.net/2023/Oct/14/multi-modal-prompt-injection/


Llemma: An Open Language Model For Mathematics | EleutherAI Blog

Tags: tech, mathematics, ai, machine-learning, gpt

On specialized and formalized domains like this it might lead to something interesting. That said there’s a tension with the fact that it doesn’t know when it doesn’t know which might be problematic. Also I wonder how it fares compared to computational models like WolframAlpha. In the end very formal domains like this have large knowledge bases already available.

https://blog.eleuther.ai/llemma/


LocalAI

Tags: tech, ai, machine-learning, gpt, foss

A good way to get some control back if you want to use a LLM. You can host it locally, it’s free software. Definitely a step in the right direction.

https://localai.io/


LocalSend

Tags: tech, tools, foss

Looks like a nice FOSS tool to share files between devices without going through the Internet.

https://localsend.org/


SSH server & client security auditing

Tags: tech, ssh, tools, security

Looks like a nice tool to check if your SSH config is secure. Works both for servers and clients.

https://github.com/jtesta/ssh-audit


Organizing multiple Git identities | Garrit’s Notes

Tags: tech, tools, git

This is pretty much exactly how I organize my projects. I highly recommend this approach, works very well.

https://garrit.xyz/posts/2023-10-13-organizing-multiple-git-identities


An Interactive Intro to CRDTs | jakelazaroff.com

Tags: tech, crdt, web, distributed

Long article in two parts (make sure to read the second one as well) showing how to build an interactive painter with CRDT. Nice way to understand how they work.

https://jakelazaroff.com/words/an-interactive-intro-to-crdts/


Surfacing request errors when using HTMX

Tags: tech, web, frontend, htmx

Nice explanation on how to handle request errors with HTMX. It’s in fact relatively simple even though there’s a couple of pitfalls.

https://xvello.net/blog/htmx-error-handling/


Inside STL: The different types of shared pointer control blocks - The Old New Thing

Tags: tech, c++

This is a too little known fact in my opinion. Good thing someone sheds some light on it.

https://devblogs.microsoft.com/oldnewthing/20230821-00/?p=108626


Why async Rust? - Without boats, dreams dry up

Tags: tech, rust, asynchronous, community

Good exploration on how and why async Rust was designed. As usual it’s not purely for technical reasons, there’s a human and community factor to it.

https://without.boats/blog/why-async-rust/


Learn Wayland by writing a GUI from scratch

Tags: tech, graphics, wayland

Understanding the Wayland protocol by going all the way back to what’s going on with the domain socket. Can serve as a nice introduction.

https://gaultier.github.io/blog/wayland_from_scratch.html


What Every Developer Should Know About GPU Computing

Tags: tech, gpu, computation, architecture

Nice primer on how computation works on GPUs. Goes a bit into the architecture as well. Good starting point.

https://codeconfessions.substack.com/p/gpu-computing


Wrapping Meshes With Geodesic Walks - Casey Primozic’s Homepage

Tags: tech, 3d, web, geometry

Very interesting computational geometry tricks. You can make interesting shapes out of this.

https://cprimozic.net/blog/wrapping-meshes-with-geodesic-walks/


Fluid Simulation

Tags: tech, 3d, gpu, graphics, simulation

Nice notes breaking down how to simulate fluids. Easily translates to GPU computation too.

https://kyndinfo.notion.site/Fluid-Simulation-f0516d9d12e245a08ae5c7545ac822dd


API design principle: Reading a property or adding an event handler should not alter observable behavior - The Old New Thing

Tags: tech, programming, api, design

Definitely a good principle to follow when designing APIs. Otherwise you make them less obvious and more dangerous to use.

https://devblogs.microsoft.com/oldnewthing/20231016-00/?p=108895


Why Software Design Matters - by Kent Beck

Tags: tech, software, design, programming

Yes, definitely this. Plenty of reasons why it’s important.

https://tidyfirst.substack.com/p/why-software-design-matters


To Design or Not To Design? - by Kent Beck

Tags: tech, agile, tests, design, craftsmanship, business

There will always be some design and some testing. The intensity of both activities needs to be properly managed over time though.

https://tidyfirst.substack.com/p/to-design-or-not-to-design


Write more “useless” software | nicole@web

Tags: tech, learning, programming

Play is definitely needed for growth. It’s true for kids, it’s still true for so called grown ups.

https://ntietz.com/blog/write-more-useless-software/


Software engineering is about thinking, not typing | Organizing Chaos

Tags: tech, engineering, productivity

Definitely this. Also with experience you tend to type less and influence others more.

https://jordankaye.dev/posts/thinking-not-typing/


Manage Your Capacity, Not Your Time - The Engineering Manager

Tags: management, productivity, time, energy

Good advices. Keep some slack, have an idea of your energy level, that’s what impacts your capacity. Time is a given you can’t do much with it.

https://www.theengineeringmanager.com/management-101/manage-your-capacity-not-your-time/


Diving into Engineering Metrics - by Nicola Ballotta

Tags: tech, engineering, management, metrics

Good starting point before really exploring this field deeper. Especially important here is the last section on how to use them properly. Be cautious, keep people well-being in mind at all time.

https://hybridhacker.email/p/diving-into-engineering-metrics



Bye for now!

Thursday, 19 October 2023

This past weekend I attended the Google Summer of Code Mentor Summit 2023 as part of the KDE delegation.

 


 

I have been a mentor for GSOC almost every year since 2005 but this was my first time attending the mentor summit.

 

There were sessions about the typical things you'd expect: how to get more diverse folks as students, how to make sure we onboard them correctly, sustainability, funding, etc. All in all nothing groundbreaking and sadly no genius solution for the issues we face was given, but to a certain degree it helps to see that most of us have similar problems and it's not that we're doing things particularly wrong, it's just that running a Free Software project is though.


Carl Schwan and me ran a Desktop Linux session together with Jonathan Blandford of GNOME (check his Crosswords game, seems pretty nice) and basically asked folks "How happy are you with the Desktop Linux", you can find the notes about it at https://collaborate.kde.org/s/HKn6BoNCRNezn3K Nothing we don't know about really, Wayland and flatpak/snap are still a bit painful for some folks even if there's a general agreement they are good ideas.


I also organized a little session for all the attendees from Barcelona (it was about 6 of us or so) to sell them talk about Barcelona Free Software


One thing that always pops up in your mind when going to events is "How useful was it for me to attend this" since traveling to California from Europe is not easy, it is not cheap and it means investing quite some time (which in my case included taking vacation from work). 

 

Honestly, I think it's quite useful and we should attend more similar events. We get to know key people from other projects and we make sure other projects know about us. One of the most funny interactions was me sitting in a table, someone joining and saying "Woah KDE, you guys are super famous, love your work" and literally seconds after another person joining us and saying "Uh, KDE what is that?"

 

There's not much pictures because Google forbids taking pictures inside their buildings, the few exceptions include the chocolate table, it's quite a large quantity of chocolate we got to try, thanks Robert from Musicbrainz for pushing people to bring it :)


I'd like to thank Google and KDE e.V. for sponsoring my trip to the Summit, please donate at https://kde.org/fundraisers/plasma6member/

Wednesday, 18 October 2023

The next release for the big three in KDE land (KDE Frameworks, KDE Plasma and KDE Gear) is going to happen at the same time.


This is because we are switching to Qt6[*] and it helps if we can release all the products  at the same time.


If you want to help us with the effort, make sure to donate at https://kde.org/fundraisers/plasma6member/


The agreed schedule is:


8 November 2023: Alpha

KDE Gear 24.01.75 / KDE Plasma 5.80.0 / KDE Frameworks 5.245.0

29 November 2023: Beta 1

KDE Gear 24.01.80 / KDE Plasma 5.90.0 / KDE Frameworks 5.246.0

20 December 2023: Beta 2

KDE Gear 24.01.85 / KDE Plasma 5.91.0 / KDE Frameworks 5.247.0

10 January 2024: Release Candidate 1

KDE Gear 24.01.90 / KDE Plasma 5.92.0 / KDE Frameworks 5.248.0

For KDE Gear that want to ship with Qt6 for this release they need to be switched to Qt6 (and obviously stable) *BEFORE* this date.

31 January 2024: Release Candidate 2

KDE Gear 24.01.95 / KDE Plasma 5.93.0 / KDE Frameworks 5.249.0

21 February 2024: Private Tarball Release

KDE Gear 24.02.0 / KDE Plasma 6.0 / KDE Frameworks 6.0

28 February 2024: Public Release

KDE Gear 24.02.0 / KDE Plasma 6.0 / KDE Frameworks 6.0 

 

You can see that Alpha is less than 3 weeks away! Interesting times ahead!

 

[*]  some KDE Gear apps may remain in Qt5 if we have not had time to port them

Monday, 16 October 2023

Do you know isocpp.org's blog? As an open-minded C++ programmer, I am a fond reader and have been inspired multiple times. I always enjoyed the blog posts from Andrey Karpov. He has deep knowledge with static code analysis and is a co-founder of PVS-Studio, a commercial static code analyzer for C++, C#, C, and Java. To advertise new releases of their product, Andrey and his co-workers scan popular open source projects with their tool. They explain the numerous results and showcase by these real-world examples how beneficial static code analysis is even for mature and healthy code bases. I found these posts both entertaining and instructive. If you are not aware of them, you might find them an interesting read: Clang 11, LLVM 15, Qt 6, GCC 13. I find this topic intriguing; nevertheless, for a long time I did not manage to dive deeper into this topic.

I am a satisfied user of Kile, KDE's user-friendly TeX/LaTeX editor. In the span of almost 20 years (Is Kile really that old? When have I gotten this old?), I have typeset dozens of documents with hundreds of pages using Kile. To check Kile's status, I visited its project page. One thing is, that it has not seen a release for a long time. The other thing that caught my eye is the result of cppcheck, visible in every open merge request. Cppcheck is an open-source static code analyzer for C and C++. It tries to find undefined behavior, dangerous code patterns, and bad coding style. GitLab showed a staggering 300+ cppcheck findings for Kile's open merge requests.

Gitab shows for every Kile merge request cppcheck's code quality scan results
 

This does not mean Kile having 300 bugs! Most findings are harmless, but some real issues might hide between all these findings. Since June I reduced the number of cppcheck findings by almost 200. Thereby, we improved some bad code style and even found real bugs.

Unused variables or unused assigned values

Unused variables are variables that are in the code but are not used. Closely related are cases of assigned values, that are never used after the assignment. This should not happen, often it is a result of code changes with no longer variables or assignments left. I removed 17 such cases, and it makes the code clearer to understand.

Case closed? Not so fast. In one instance, it revealed a tiny bug.

01 QString icon;
02 if (ext == "application-x-bzdvi" ) {
03     icon = ext;
04 }
05 else if( ext == "htm" || ext == "html" ) {
06     icon = "text-html";
07 }
08 else if(ext == "pdf" ) {
09     icon = "application-pdf";
10 }
11 else if( ext == "txt") {
12     ext = "text-plain";
13 }
[..]
22 else {
23     icon = "text-plain";
24 }
25 return icon;

Cppcheck complained that in line 12 the variable ext gets assigned a value that is never used. Well, yes, because the value should be assigned to icon like in the other if branches. After fixing, text files gained an icon in Kile's documentation browser.

Document browser has now icons for text files, too. The light gray color is a new feature independent of the issue at hand.


Another bug went unnoticed by me, but Kile's maintainer Michel spotted it.

01 //both exist, take most recent
02 if(read1 && read2) {
03     read1 = file1.lastModified() > file2.lastModified();
04     read2 = !read1;
05 }
06
07 if(read1) {
08     dir = S();
09     trg = "index.html";
10
11    translate(dir);
12    setRelativeBaseDir(dir);
13    translate(trg);
14     setTarget(trg);
15 }

Cppchechk warned that in line 4 the value assigned to read2 is never used. I removed the line, but the actual fix was adding an else(read2) branch. This case was forgotten and spotted with a careful review of cppcheck's findings.

C-style pointer castings

C-style castings are tricky, as they are sometimes a promise from the programmer that the types are compatible and the compiler has no way of checking. With C++ there are five (!) different type of casts, many are not dangerous as the compiler can check the compatibility of what the programming is asking for. For more details, see a blog post from Anteru explaining more details.

Six cases of C-style pointer castings were not necessary and could be dropped. Twelve more could be replaced by C++'s static_casts, ensuring all safety checks from C++ are applied.

Other improvements

Many other improvements made the code more beautiful, like having variable scopes reduced as much as possible. This leads to variables that are only known inside a loop, and that variable declaration and its use stay closer together.

In one case cppcheck found a potential memory leak as a variable was created with new whenever the surrounding method was called, but the object was never deleted.

Two for loops with iterators could be slightly simplified by range-based for loops. The latter prevents off-by-one errors and expresses the intend more direct.

That is all?

I fixed only some of the most obvious findings. I spared the complicated ones, as my understand of Kile's code base is still limited. Further, I did not want to introduce new bugs to not endanger the hopefully upcoming release.

In the remaining cppcheck findings are some more potential bugs, their description looks promising.

 

Have a look at cppcheck findings yourself!

I can recommend to examine cppcheck findings for your project's, too. At first, it might look like a cumbersome task. I am sure it is worth the effort.

Fixing cppcheck findings is also a good junior job to get in touch with the development of your pet part of KDE. Start with some, not too many at once, trivial fixes and follow the feedback from the maintainer. My experience with Kile was pleasant, thanks Michel!

Saturday, 14 October 2023

A new release of Doxyqml is out. Doxyqml is the tool which we use to transform our QML code in non working C++ code, but good enough for Doxyqml to understand it. This power the documentation of Kirigami, Kirigami Addons, Plasma Framework and more on api.kde.org.

This release mainly fix various compatibility bugs with more recent QML versions.

Thanks to Frederik Gladhorn, Joshua Goins, Libor Tomsik, Matej Starc and Nikolai R Kristiansen for their contributions to this release.

Here is the full release log:

  • Add support for single quote strings(Carl Schwan)
  • Ignore private functions in generated api (Carl Schwan)
  • Add support for typed functions (Carl Schwan)
  • qmlclass.py::add_import: dynamically get import qualifier (Matej Starc)
  • Allow arbitrary default arguments (Frederik Gladhorn)
  • Fix wasteful newline if there was no meaningful comment (Joshua Goins)
  • Change expected test data to account for the new comments (Joshua Goins)
  • Simplify header comments, add version/import at the very last minute (Joshua Goins)
  • Don’t parse internal module types (Joshua Goins)
  • Use @version instead of @since command (Joshua Goins)
  • Add import statements for QML components (Joshua Goins)
  • Support array literals as function args (Nikolai R Kristiansen)
  • Fixed parsing curly brackets in JS function (Libor Tomsik)

The release can be found on PyPi.org.

Friday, 13 October 2023

Let’s go for my web review for the week 2023-41.


Six Months Ago NPR Left Twitter. The Effects Have Been Negligible - Nieman Reports

Tags: tech, twitter, information, social-media, criticism, fediverse

The first signs of journalism finding some independence from social media? That would be very welcome.

https://niemanreports.org/articles/npr-twitter-musk/


WordPress.com blogs can now be followed on Mastodon and other federated platforms | TechCrunch

Tags: tech, fediverse, blog, social-media

This is a huge thing for the ferdiverse. Let’s see where this leads.

https://techcrunch.com/2023/10/11/wordpress-com-blogs-can-now-be-followed-on-mastodon-and-other-federated-platforms/?guccounter=1


Engage a Wider Audience With ActivityPub on WordPress.com – WordPress.com News

Tags: tech, fediverse, blog, social-media

This is nice to see how easy it is to make sure a WordPress blog appears on the Fediverse. Hopefully will bring lots of activity.

https://wordpress.com/blog/2023/10/11/activitypub/


How AMD May Get Across the CUDA Moat

Tags: tech, cpu, gpu, performance, amd, nvidia

Will AMD really turn this around? Wait and see.

https://www.hpcwire.com/2023/10/05/how-amd-may-get-across-the-cuda-moat/


The midwit home - DYNOMIGHT INTERNET NEWSLETTER

Tags: tech, smarthome

Definitely this, I think people are very much overdoing the smart home thing. I far prefer something not too “smart” in this space.

https://dynomight.substack.com/p/midwit-home


“We’ll call it AI to Sell it, Machine Learning to Build it”

Tags: tech, ai, machine-learning

I agree with this, be precise about what you’re using. Blanket terms won’t lead you anywhere to creating proper systems.

https://theaiunderwriter.substack.com/p/well-call-it-ai-to-sell-it-machine


HTTP/2 Rapid Reset: deconstructing the record-breaking attack

Tags: tech, security, http

Interesting deep dive into the latest massive DDoS attack seen in the wild.

https://blog.cloudflare.com/technical-breakdown-http2-rapid-reset-ddos-attack/


Coordinated Disclosure: 1-Click RCE on GNOME (CVE-2023-43641) - The GitHub Blog

Tags: tech, gnome, security

If you’re using a GNOME base environment be responsible and make sure you install your security patches.

https://github.blog/2023-10-09-coordinated-disclosure-1-click-rce-on-gnome-cve-2023-43641/


Where does my computer get the time from? – Tony Finch

Tags: tech, computers, time

Very good exploration about how to get time on computers. As usual it’s way less straightforward than what you might think.

https://dotat.at/@/2023-05-26-whence-time.html


Postgres: the next generation. Investing in the next generation of committers. – James Governor’s Monkchips

Tags: tech, databases, postgresql, community, hr

This is a very important point. Communities should make sure that new blood gets in. Companies should also avoid just recruiting top talent and groom juniors to contribute.

https://redmonk.com/jgovernor/2023/10/10/postgres-the-next-generation-investing-in-the-next-generation-of-committers/


Fury - A blazing fast multi-language serialization framework powered by jit and zero-copy

Tags: tech, data, performance, serialization

Looks like an interesting serialization framework. If it holds true to its claims it could be very useful in some place.

https://www.furyio.org/blog/fury_blazing_fast_multiple_language_serialization_framework


QBinDiff: A modular diffing toolkit

Tags: tech, tools, command-line

Looks like an interesting tool for diffing binary data.

https://blog.quarkslab.com/qbindiff-a-modular-diffing-toolkit.html


Unit-testing shell scripts and tools with shtk - Julio Merino (jmmv.dev)

Tags: tech, tests, command-line, shell

This can come in handy for automated tests which need to be ran from within a shell.

https://jmmv.dev/2023/10/unit-testing-with-shtk.html


Simulation Islands :: Box2D

Tags: tech, simulation, physics

This one is a lot. This is a very interesting exploration in rigid body simulation though. Shows well the trade-offs in term of performance and how to keep it usable for third party developers.

https://box2d.org/posts/2023/10/simulation-islands/


Scrollbars are becoming a problem

Tags: tech, ux, accessibility, gui

Some things we tend to not notice… the scroll bars need a way to be brought back and to be large for better accessibility.

https://artemis.sh/2023/10/12/scrollbars.html


On Importance of Naming in Programming | Wasp

Tags: tech, programming, craftsmanship

It’s one of the two hardest problems of programming after all. Needs to be thought through.

https://wasp-lang.dev/blog/2023/10/12/on-importance-of-naming-in-programming


API Best Practices: Foundations of Robust and Efficient APIs

Tags: tech, http, rest, web, services

A bit basic and obvious, still a good list of things to keep in mind when designing REST APIs.

https://medium.com/@atakanserbes/api-best-practices-d27876b1a1bd


McKinsey Developer Productivity Review - Dan North & Associates Ltd

Tags: tech, management, business, productivity

Very good review of the McKinsey paper about developer productivity. It not only highlights all the problems with it, it also makes suggestions to make a better paper next time.

https://dannorth.net/mckinsey-review/


Creativity faucet: Increase your creativity

Tags: creativity, writing

Interesting advices about creativity. The metaphors used help a bit as well.

https://www.julian.com/blog/creativity-faucet


VA hospital’s IT snafu blamed on cat’s keyboard surfing • The Register

Tags: tech, data, vandalism, funny

This is why cats cannot be trusted around computers!

https://www.theregister.com/2023/10/05/hospital_cat_incident/



Bye for now!

F10 for the Main Menu!

We now have a new KStandardShortcut. With https://commits.kde.org/kconfig/782e43f8076e5f4a10111a6b4d2cc6b1741c9798 the F10 key is now assigned to “Open Main Menu”. This is in my opinion a big win for accessibility because up until now for blind people there was no consistent way in our software to open the main menu.

You can see the problem for yourself if you try to get to the menu bar in your favourite KDE application. Notice how you can't get there using the Tab key? You actually need to hold down the Alt key and then use mnemonics i.e. the underlined letter to jump right there. Now blind people obviously can't see those underlined letters or there might not even be a menu bar in the first place so there actually was no reliable way for them to explore all the actions our software had to offer.

So now we decided (or rather I suggested and everyone seems to agree) to have F10 as the key to open the main menu. Why F10 you ask? Well, mostly because everyone else is already using it: Gnome, Microsoft, Chrome/ium, and Firefox (but Alt also works here). We don't want users to have to care which toolkit they use when they just want to open the main menu, so F10 was the logical choice.

However, only deciding on a standard shortcut obviously isn't enough. The opening of the main menu also needs to be implemented. My goal was to implement this for many applications for free. The other goal was to not disrupt those applications too much by taking away their F10 key. Unfortunately, a little bit of disruption is still necessary and this blog is here to announce this.

So considering that we have applications that use the menu bar as their main menu and others that use a hamburger menu and others that might have neither of those or some custom main menu, the best I did for now is to implement F10 to open a main menu in KHamburgerMenu. This is handled as a normal keyboard shortcut that is assigned to KHamburgerMenu by default and which will open either the menu bar or the hamburger menu depending on what the application currently uses. Even if the application currently has both the main menu and a hamburger menu button completely hidden my implementation makes sure that a menu still opens so no blind person ever has to wonder why nothing happened.

All of this means that after upgrading to KF6, pressing F10 in your KHamburgerMenu-using application might have a keyboard shortcut conflict. This won't/shouldn't lead to a crash or anything, just to an annoying popup. This can be avoided by assigning one of the conflicting actions to something else either in application code or by the user.

If an application does not use KHamburgerMenu, there will be no change at all. I would however encourage everyone to make F10 open the main menu for every application. That's typically very easy to implement. QMenuBar for example has a method for this. But honestly, if we are talking about an application that could be using KHamburgerMenu, it might be about as much work to implement a very minimal KHamburgerMenu. In kdenlive they only had to add 20 lines for this: https://invent.kde.org/multimedia/kdenlive/-/commit/cb38d57691cfba311c0e59fd748d88a5b8690ba8 This implementation will allow users to re-assign the keyboard shortcut.

I haven't really checked how to best do this in Kirigami-based applications.

Anyways, with F10 by itself partially dealt with, there is one more F10 related accessibility feature I need to talk about:

Shift+F10 to Open Context Menus!

You see, people who can't use a mouse pointer or other pointing device rely on the keyboard to open context menus. However, many keyboards these days do not have a Menu key. Therefore there is no way to open context menus by only using a keyboard! Well, at least not in KDE applications. Actually, this is again a situation where everyone else has already decided that context menus should be triggered by Shift+F10. This is already recommended by the Web Accessibility Initiative, Microsoft, and implemented in Chrome/ium and Firefox. We are, however, behind on this.

So on to the implementation. Skip to the end of this section if you only want to know what I will be doing and how this might affect your application.

How can I make every application also listen for Shift+F10? It would be really nice if, from one day to the other, all of our software would open context menus on Shift+F10. This can be accomplished by binding Shift+F10 to the Menu key which is surprisingly easy to do even as an end user. If you want to have this functionality today, do the following (not sure if it works on Wayland):

  1. Create an .Xmodmap file in your home directory (https://linux.die.net/man/1/xmodmap):

    cd 
    xmodmap -pke > .Xmodmap 
    

    This file will be used to re-assign keys or keyboard shortcuts.

  2. Open that file and change the line that looks somewhat like this

    keycode 76 = F10 F10 F10 F10 F10 F10 XF86Switch_VT_10
    

    to this

    keycode 76 = F10 Menu F10 F10 F10 F10 XF86Switch_VT_10
    

    Replacing this second occurrence of F10 in this line with Menu will tell the software Xmodmap that from now on, pressing the key with the keycode 76 simultaneously with Shift should be translated to a Menu key press.

Delete this file later if you don't want key re-assignment anymore.

Now obviously this means that no software anywhere will be able to use Shift+F10 for anything. Or rather: It will always be interpreted as a Menu key, so the Menu key and Shift+F10 would always do the same.

Honestly, it might be a bit rude to take away Shift+F10 from all software, but I am not sure if this would even be a problem. I kind of doubt that there are many applications that have any crucial functionality on Shift+F10 and do not allow to re-assign this. If this was the only downside to this approach, I might have tried to convince the wider KDE community that this or something similar was the best way forward. However, the thing is that this only solves the problem in situations in which we/Plasma have control over the system. This won't fix any of our software when it is used in a system in which one can't interpret Shift+F10 as Menu.

A different idea I had, which is a bit more targeted, would have been to instead implement the above as part of the KDE platform. Qt software adapts itself to the platform it runs on, so we have some control there which we can force upon software by implementing a platform plugin (see https://doc.qt.io/qt-6/qpa.html or https://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbkeyboard.cpp#n903). This would then only affect Qt software instead of affecting the whole system, but once again: This only works as long as our software runs on a platform that we control.

So this needs to be implemented on a non-system layer. Frameworks perhaps? What about interpreting Shift+F10 as Menu through an EventFilter on top of the QApplication?

This works and is portable but I would still take away softwares' autonomy to use Shift+F10 as they please (or at least require them to opt out). It is also not nice for performance reasons because such an EventFilter will slightly slow down every user interaction with the application.

Okay, let's try to be even more cautious and choose a different implementation. Let's simply override QMainWindow::keyPressEvent(). Unfortunately this means that only key press events on children of QMainWindow can be handled. Key presses on secondary windows the application might have won't be within our grasp. However, on the plus side, key presses will only arrive at this method if they hadn't be handled by the application already. So we wouldn't be taking away Shift+F10 from the application! Good news!

So this is what I am going to do: I will override the QMainWindow::keyPressEvent() in the KXmlGui framework so that we post our own context menu events whenever a Shift+F10 key press comes in. This works pretty well so far from my testing. It doesn't always work unfortunately because the context menu opening was, in some cases, implemented in a way that expects either right-clicks or Menu key presses in a hard-coded way. They don't react to QContextMenuEvents as they should. So in those cases I might adapt some widgets so they behave nicely.

This will result in applications using the KXmlGui framework reacting to Shift+F10 by opening context menus if the applications don't already handle or use Shift+F10 themselves. If applications really absolutely do not want anything to happen when Shift+F10 is pressed, they can filter these events out beforehand.

Shout-out and Thanks

This work is being supported by the NLnet foundation and the European Commission! The project I am being funded for isn't really specifically about accessibility, but the people at NLnet are so nice and forward-thinking that I am allowed to do a good amount of work on improving accessibility in Dolphin as part of my grant. As is the nature of open source, in this case many KDE applications will benefit from this work.

I also want to mention Fushan Wen here even though he had nothing to do with any of the work mentioned in this blog post simply because he has been doing outstanding work for accessibility in KDE for many month now.