Skip to content

Thursday, 6 January 2022

It took a few months, but there’s a new release of QCoro with some new cool features. This change contains a breaking change in CMake, wich requires QCoro users to adjust their CMakeLists.txt. I sincerely hope this is the last breaking change for a very long time.

Major highlights in this release:

  • Co-installability of Qt5 and Qt6 builds of QCoro
  • Complete re-work of CMake configuration
  • Support for compiling QCoro with Clang against libstdc++

Co-installability of Qt5 and Qt6 builds of QCoro

This change mostly affects packagers of QCoro. It is now possible to install both Qt5 and Qt6 versions of QCoro alongside each other without conflicting files. The shared libraries now contain the Qt version number in their name (e.g. libQCoro6Core.so) and header files are also located in dedicated subdirectories (e.g. /usr/include/qcoro6/{qcoro,QCoro}). User of QCoro should not need to do any changes to their codebase.

Complete re-work of CMake configuration

This change affects users of QCoro, as they will need to adjust CMakeLists.txt of their projects. First, depending on whether they want to use Qt5 or Qt6 version of QCoro, a different package must be used. Additionally, list of QCoro components to use must be specified:

find_package(QCoro5 REQUIRED COMPONENTS Core Network DBus)

Finally, the target names to use in target_link_libraries have changed as well:

  • QCoro::Core
  • QCoro::Network
  • QCoro::DBus

The version-less QCoro namespace can be used regardless of whether using Qt5 or Qt6 build of QCoro. QCoro5 and QCoro6 namespaces are available as well, in case users need to combine both Qt5 and Qt6 versions in their codebase.

This change brings QCoro CMake configuration system to the same style and behavior as Qt itself, so it should now be easier to use QCoro, especially when supporting both Qt5 and Qt6.

Support for compiling QCoro with Clang against libstdc++

Until now, when the Clang compiler was detected, QCoro forced usage of LLVM’s libc++ standard library. Coroutine support requires tight co-operation between the compiler and standard library. Because Clang still considers their coroutine support experimental it expects all coroutine-related types in standard library to be located in std::experimental namespace. In GNU’s libstdc++, coroutines are fully supported and thus implemented in the std namespace. This requires a little bit of extra glue, which is now in place.

Full changelog

  • QCoro can now be built with Clang against libstdc++ (#38, #22)
  • Qt5 and Qt6 builds of QCoro are now co-installable (#36, #37)
  • Fixed early co_return not resuming the caller (#24, #35)
  • Fixed QProcess example (#34)
  • Test suite has been improved and extended (#29, #31)
  • Task move assignment operator checks for self-assignment (#27)
  • QCoro can now be built as a subdirectory inside another CMake project (#25)
  • Fixed QCoroCore/qcorocore.h header (#23)
  • DBus is disabled by default on Windows, Mac and Android (#21)

Thanks to everyone who contributed to QCoro!


Download

You can download QCoro 0.4.0 here or check the latest sources on QCoro GitHub.

More About QCoro

If you are interested in learning more about QCoro, go read the documentation, look at the first release announcement, which contains a nice explanation and example or watch recording of my talk about C++20 coroutines and QCoro this years’ Akademy.

Monday, 3 January 2022

Intro

KDE Plasma is my preferred desktop and I am a heavy user of its Activities1 – I tend to have one to two dozen Activities on each computer (see below for examples).

Any project2 that would take me more that a day or so to complete, typically gets its own Activity.

Original problem

With such a frequency of spinning them up and winding them down, I developed a preference on what a new Activity should consist of, to be as quick as possible as useful as it gets. And this blog post is my first step towards trying to create a Plasma template for when a new Activity gets created, to optimise this process.

So what I would like to achieve is that whenever I start a new Activity, it has the following settings/functionality:

  • the desktop has Desktop view (instead of current default Folder view)3
  • a Folder view Plasmoid is put on the desktop
  • that plasmoid is set, so it shows all files and folders associated with that Activity (i.e. activities:/current)
  • (bonus: the desktop gets a random image assigned for background)

Documentation gathering & early try

The kind people on Plasma’s Matrix channel helped me a lot with gathering documentation. But in the end I still got stuck.

Global theme

First I tried the Creating a Global Theme Package (in connection with the Unity theme for Plasma example).

The two resources are pretty good for theming, but when I saved my theme using the Plasma Global Theme Explorer (lookandfeelexplorer) and later re-applied it as my Global Theme (incl. layout) in System Settings, two unfortunate things happened:

  • it overrode all my existing Activities
  • it did not apply to a new Activity

So that falls short of what I need.

Plasma desktop scripting

Next I tried the Desktop Shell Scripting Console (plasma-interactiveconsole).

This ended up in a mess, and I needed to pull ~/.config/plasma-org.kde.plasma.desktop-appletsrc from a backup.

To try it out I simply copy-pasted the Unity theme example and applied it. So I blame mostly myself. But it would be much more user-friendly if the tool would have an “Undo” button or a way to switch between the state that is stored in the settings and the script in the console.

I admit, I did not find the time to go through all of the Plasma scripting documentation yet, but I am at the stage of getting lost a bit in all the information.

One thing that makes me scratch my head is that the Plasma scripting: Configuration keys page is full of headings that say “BUG”, which I am not sure what to make of.

Call for help

Since I am not much of a coder, let alone a KDE dev, at this stage I feel a bit stuck. Any guidance would be warmly welcome.

If you would like to help, I opened a topic on KDE forums.

Example activities and reasoning

For example on my home laptop I have the following right now:

  • Communication – e-mail, IRC, IM, web browser’s default profile4, often music
  • Organise yourself – calendar, ToDo list, web browser with GitLab, GitHub etc. issue trackers
  • Quick documents – when I just need to concentrate on a simple document, that does not need its own Activity
  • Gaming – also mainly to have special Battery and power settings
  • Blog – text editor session with all blog post drafts, web browser with blog and article-relevant pages
  • System – terminal emulator(s), web browser with documentation, loads of system view desktop widgets
  • Finances – finance software, bank statements, invoices, etc.
  • and then about a dozen specific Activities for projects that are spun up when they pop up and get deleted when the project is completed (e.g. complex analysis document on topic A; same for topic B; slovenian ergonomic keyboard layout; activity-aware firefox; FOSS licensing presentation at faculty, restore your old disks; …)

The trick is to try to stay as little as possible in the Communications Activity. As that is most often not pro-active, but re-active work.

Keeping projects in separate Activities has several benefits for me:

  • it is easier to concentrate on a task, if all the others are hidden away – I try to stop Activities I do not currently use
  • when you need to come back to a task, having a familiar wallpaper and all the documents, web pages and sessions present when you re-start its Activity helps a lot to get back into the groove
  • a stopped Activity does not consume any processing power or memory

hook out → I recently tried Georgian tea. Cool stuff!


  1. As an aside, Activities really deserve, and frankly need, a more up-to-date and user-friendly explanation on a more prominent page. 

  2. With a project I mean any complex task that consist of either a long-term committment or several sub-tasks, especially if they demand research and use of more than one tool/window. 

  3. Although this might be due to a bug that is being worked on? 

  4. For how I set up and use Firefox to play nicely with Plasma Activities, see my Introducing Activity-aware Firefox blog post. 

Sunday, 2 January 2022

I am not about to start a flamewar, but how pointless is it we fret about what a couple of YouTubers and their sidekicks have to say about Linux desktops?

Saturday, 1 January 2022

Hullo! On Monday January 3rd 5:00pm GMT (12:00pm EST) I’m going to try livestreaming work on a potential Plasma wallpaper, possibly some icon work, and other potential tangential work. I’ll also be answering questions, giving advice and tips for software like Krita and Inkscape, and if there’s time I may also show some terrible unreleased design work from the bowels of my storage drive. The stream will be of indeterminate length; at least a couple hours but it might run long.

The stream will be on Youtube for sure, please comment requesting another video service (click here) if Youtube/Google skeeves interested people out (assuming I can get them to work); here’s the Youtube link for those who may want to set a reminder.

Friday, 31 December 2021

Let us start 2022 with a cool little tool that I recently found out about1.

Man page

And it really is little. So little, I will quote its man page in full:

Name

sponge - soak up standard input and write to a file

Synopsis

sed '...' file | grep '...' | sponge [-a] file

Description

sponge reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before writing the output file. This allows constructing pipelines that read from and write to the same file.

sponge preserves the permissions of the output file if it already exists.

When possible, sponge creates or updates the output file atomically by renaming a temp file into place. (This cannot be done if TMPDIR is not in the same filesystem.)

If the output file is a special file or symlink, the data will be written to it, non-atomically.

If no file is specified, sponge outputs to stdout.

Options

  • -a – Replace the file with a new file that contains the file's original content, with the standard input appended to it. This is done atomically when possible.

Examples

Where it most used in practice though is when you are piping information that will come in a stream (even a short one).

A typical example would be appending one file to another:

At a first glance you would think that this would produce the results:

cat foo bar > foo

… but, in fact, what would happen is that foo would now contain only the same as bar. From what I understand, what happens is that first foo gets overwritten by foo itself, and then again overwritten by bar.

But when you introduce sponge in between to soak it all up, it works fine:

cat foo bar | sponge foo

… now first the contents of foo gets soaked up by sponge and after that also the content of bar. And once the data stream has ended, sponge releases it all into foo.

Similarly when you want to filter the contents of a file (e.g. to only include lines that have “yes” at the end), you could use:

grep 'yes$' answers.txt | sponge answers.txt

Final words

sponge is part of the MoreUtils package, which neatly expands the standard GNU CoreUtils package, while preserving the UNIX philosophy.

This year I intend to write more shorter blog posts about little tools, like this one. During the years, there have been quite a few that gathered up.

hook out → waiting to first soak it all up seems quite fitting after the challenging last two years


  1. Hat-tip to Sebastian “seabass-labrax” Crane

There is one thing that annoys me a bit and that’s inconsistent font rendering in Qt and GTK applications.

kate (Qt)
gedit (GTK)

The most distinctive characteristic of font rendering in Qt applications is that glyphs look thicker. Some people may argue that macOS-style font rendering is the worst one but after using Plasma for a long time, I’m used to that style of font rendering and would like fonts to look the same regardless of the underlying toolkit.

After digging though some code, I’ve discovered that Qt enables stem darkening by default in its freetype font engine. With stem darkening, glyphs are embolden to improve readability. And, indeed, after putting export FREETYPE_PROPERTIES="cff:no-stem-darkening=0" in my profile scripts, the glyphs look a bit thicker in non-Qt applications.

Note that fonts can still look differently regardless of whether stem darkening is enabled. For example, text must be rendered with linear alpha blending and gamma correction and not all toolkits do that properly.

To wrap this up, I ran Visual Studio Code with and without stem darkening to see if it makes any difference.

Visual Studio Code (Skia) w/o stem darkening
Visual Studio Code (Skia) w/ stem darkening

At quick glance, both screenshots look the same. However, after taking a closer look, you can notice that glyphs in the second screenshot are more brighter and thicker than in the first screenshot (just like how it would look in a Qt application).

Conclusion

The fact that Qt enables stem darkening regardless of user preferences caught me by surprise. Relying fully on system and user preferences would minimize inconsistencies and give the user more control over their machine. Either way, if you happen to use regularly applications that are built using Qt and GTK or any other toolkit, enabling stem darkening by setting the FREETYPE_PROPERTIES="cff:no-stem-darkening=0" environment variable is a good way to achieve slightly more consistent font rendering. Note that there can be inconsistencies even if all applications use the same freetype options because it still matters how toolkits perform alpha blending, etc.

Let’s go for my web review for the week 2021-52. This is the last one of the year and clearly much shorter than usual. Things are less buzzing during this week apparently, everyone is busy eating food I guess. Funnily there seems to be a common theme in this week (short) review.


The Future is in Interoperability Not Big Tech: 2021 in Review

Tags: tech, internet, interoperability

Let’s hope this is indeed setting a trend… more interoperability is most welcome.

https://www.eff.org/deeplinks/2021/12/future-interoperability-not-big-tech-2021-review


Please don’t use Discord for FOSS projects

Tags: tech, foss

Good reminder on why you don’t want to depend on proprietary systems to support FOSS projects.

https://drewdevault.com/2021/12/28/Dont-use-Discord-for-FOSS.html


Chris’s Wiki :: blog/tech/EmailCriticalInfrastructure

Tags: tech, email, internet

Despite all its flaws and the regular claims of its death, email keeps being a central part of our collective infrastructure indeed. Clearly it’s still here to stay.

https://utcc.utoronto.ca/~cks/space/blog/tech/EmailCriticalInfrastructure



Bye for now! See you in 2022!

Thursday, 30 December 2021

Since the weather was not very inviting for much activities during the x-mas to new-year’s vacation, I used the time to tie together a new tech preview update of kjournald. Apart from a very few changes in the library part of kjournald, i.e. the model/view filter logic that provides simplified access to journald databases, the main focus was on providing a better user experience for the kjournald-browser application.

kjournald-browser is a reference implementation of the library API and is supposed to show what is possible with the library and also to help in iron-out problems in the API itself. The most visual new changes are:

  • A complete rewrite if the filter-logic via selecting systemd-units and processes. Actually, both now can be applied at the same time and (in my opinion) provide a much more consistent look and feel.
  • In kjournald-browser several components and the theme are updated to incorporate breeze look-and-feel and to used Kirigami components. The gain of this is that the UI is more compact and also more consistent within a KDE Plasma desktop than before. Please note that this technically only means new dependencies for the browser but not for the library.
  • The missing bits for localization support were fixed.
  • Several small corner-case problems in text selection and handling of empty log sets were fixed.
  • And finally, the application looks also nicely with a dark scheme 🙂

I hope you enjoy it and looking forward for feedback.

The good thing about this quiet holidays is that there is time to work on projects. I had a few nice changes of PDF Quirk laying around, and now finalized them to a new version. Please welcome PDF Quirk version 0.95!

What is PDF Quirk?

PDF Quirk is a little desktop utility to create PDF files from images, targeted to non nerdy desktop users.

Sending PDFs is (still) often a requirement in offices where people are asked to transfer PDF files via email, or better by pushing them through their private ownCloud.

The source images can either be loaded from file, or directly scanned with an hardware scanner. For that, PDF Quirk utilizes the tool scanimage from the SANE Projekt, to avoid reinventing the wheel. Configured once, that works like a charm.

Having scanned or picked the source images, they can be deskewed, turned and rearranged, and finally converted to a good quality PDF file with reasonable file size.

New Version 0.95

The new version brings a few features and some fixes:

  • Images can deskewed now
  • Basic PDF options like margin, paper size and orientation can be set
  • The UI got a little cleanup
  • Translations were added, first new language is German
  • Dependencies were reduced, new Qt based PDF generator was implemented
  • Builds with Qt5 and Qt6

Interested?

Check out PDF Quirks Website for more information.

PDF Quirk is free software. Please contribute through the Github repository.

Wednesday, 29 December 2021

Introduction

Initially I wanted to make this series to reflect:

  • the first few days;
  • the first few weeks;
  • the first few months;
  • after maybe a year or so.

… as you can see it did not work out. That is by no means Fish’s fault though, but with the lack of time on my end.

In any case, it has been quite some time – 5 years! – since I picked up Fish as my primary shell and so high time I share my experience so far.

Past issues resolved

In my previous blog post I listed some issues that I ran into.

I am happy to report that in these years basically all of them (and any new ones I encountered) have been fixed.

One big thing issue I had previously was Fish requires a web browser for both its help (through help) and its settings (through fish_config).

For help files Lynx (or any other text-only browser) is perfectly enough.

And fish_config has since been expanded, so you can use it from the command line. Check fish_config --help to see settings are supported.

In 3.3.0 the following can be already done in the CLI, so you can now do everything in CLI that you could in the web UI:

  • change and preview prompts with fish_config prompt;
  • (changing and preview of themes with fish_config theme is already merged for 3.4.0);
  • search and modify history with history;
  • modify functions with funced;
  • change abbreviations with abbr, bindings with bind, and set variables with set.

(In)compatibility with Bash/POSIX

A well known drawback of Fish is that it is not 100% POSIX compliant. But apart from all my previous serious gripes going away already by simply updating Fish (currently 3.3.1) – apart from that globbing issue mentioned below – I have not run into any issues in a long long time.

And where you need compatibility with Bash, there is always Bass. Luckily the only time I had to rely on Bass at all was at work when I had to mess with NVM.

What I did notice in the past few years is that Fish became much more popular and many tools recognise it as a valid shell and take its quirks into account (as they did before with Bash and Zsh).

Tweaks and dotfiles

In my previous blog post I also mentioned Oh My Fish! and that my preference is to manually maintain all my tweaks in dotfiles.

This remains to be true and you can check them in my dotfiles repository.

For those who prefer using a shell-specific package manager for such tweaks, Oh My Fish! has grown tremendously and seems like a great resource and tool.

The biggest tweaks I made were:

  • set BobTheFish as my theme;
  • use LSD instead of ls --color if it is installed;
  • made tree by default go only 2 levels deep (and use lsd if exists);
  • implemented Peco to search through the shell history and processes to kill;
  • brought some colour to man.

There are also some (even) smaller tweaks – but what is important is that even someone like me, who had no formal programming training, is able to tweak and script his way around Fish.

Which neatly brings us to …

Scripting

Fish is the first shell I am actually fairly comfortable scripting in.

Apart from the dotiles I have nothing truly complex to show, but at least nowadays I feel confident enough in the interactive shell that I do not fear to if and pipe my way around problems I encounter.

My only gripe now

Which brings me to the only gripe I currently have with Fish – some pattern matching that I would expect to work is currently missing.

Namely, I would expect the following to remove all files that start from a to f, but instead it just throws an error:

rm [a-f]*

There are some more examples, but the above one is the one that I care for the most ;).

Issues are open for this of course, if anyone wants to help out:

Conclusion

After five years, I have grown quite fond of Fish, and it is great to see it used and supported more widely.

At this stage I do not see any reason to try out any other shell. You can never know what the future may bring, so far it seems it is here to stay. At the very least on my computers …

hook <3 <><

_hook out → so long 2021 and _