rainerkeller.de

KDE does not Load Screen Settings

2018-06-05

On desktop computers the screen configuration for a previous session is not loaded on the next login. For me this happened using

In order to debug this issue you have to set some environment variables to the user session. This file will set the environment to enable debug output of KScreen.

~/.config/plasma-workspace/env/12-debug.sh

export QT_LOGGING_RULES="kscreen.*.debug=true"
export KSCREEN_LOGGING=1
This will produce a log file at ~/.local/share/kscreen/ksceen.log. The logs can also be viewed in the system log using journalctl.

With the enabled logging I found these line in the logfile:

kscreen.kded: Couldn't get if the device is a laptop:  "The name org.freedesktop.UPower was not provided by any .service files"
KScreen is trying to query the UPower API to detect if it runs on a laptop. After a quick look into the kscreen source code it seems it will skip loading any configuration if it can not detect if the computer is a laptop.

Quick solution

The quickest solution is to install the upower package from the distribution. Afterwards the message was gone for me and the display configuration loaded as expected.

Better Solution

I fixed the issue in KScreen itself by setting the device state to ready in case the upower interfaces are not installed, assuming the device is a not a laptop in that case.

diff --git a/kded/device.cpp b/kded/device.cpp
--- a/kded/device.cpp
+++ b/kded/device.cpp
@@ -132,6 +132,7 @@ void Device::isLaptopFetched(QDBusPendingCallWatcher* watcher)
     const QDBusPendingReply reply = *watcher;
     if (reply.isError()) {
         qCDebug(KSCREEN_KDED) << "Couldn't get if the device is a laptop: " << reply.error().message();
+        setReady();
         return;
     }

Location of Config Files

Many people wonder where the configuration files of KScreen are stored. It is in the same directory as the logfile mentioned before:

~/.local/share/kscreen/
The files are named after the hash of the display connection status they were created for. You can see this in the logfile when you save your display configuration change:
"kscreen.kded: Config saved on:  "/home/$USER/.local/share/kscreen/5fe6ce9cdff9d62015c7e37718a99a5a"

Links

KScreen debug documentation.


Anbieterkennzeichnung
Datenschutzhinweis

This work is licensed under a
Creative Commons Attribution-ShareAlike 4.0 International License.