+ // Create a QProcess to check if KDE is running.
+ QProcess *checkIfRunningKdeQProcessPointer = new QProcess();
+
+ // Create an argument string list that contains `ksmserver` (KDE Session Manager).
+ QStringList argument = QStringList(QLatin1String("ksmserver"));
+
+ // Run `pidof` to check for the presence of `ksmserver`.
+ checkIfRunningKdeQProcessPointer->start(QLatin1String("pidof"), argument);
+
+ // Monitor any standard output.
+ connect(checkIfRunningKdeQProcessPointer, &QProcess::readyReadStandardOutput, [this]
+ {
+ // If there is any standard output, `ksmserver` is running.
+ isRunningKde = true;
+ });
+