Wayland untested but compiled.
(btw, serviceCache.contains and then serviceCache.value performs a double lookup, QHash value returns a default-constructed value for not found entries, so could probably be simplified to?
KService::Ptr service = serviceCache.value(window); if (service) { // ... }