Thanks so much for this script, I’ve been using it for years now.

In KDE6 the kwriteconfig line doesn’t do anything so I’ve just commented it out but the xdg-settings and xdg-mime lines cause quite a delay each time the activity changes. If I run those lines in a new process the delay will go away but the logging will be lost. Is there a way to keep the logging but fix the activity switch delay?