Bug 417316

Summary: Strange behaviour when XDG_CURRENT_DESKTOP is not set to KDE
Product: [Applications] systemsettings Reporter: Juraj <jurajoravec>
Component: generalAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: kde, nate
Priority: NOR    
Version: 5.17.5   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Left: XDG_CURRENT_DESKTOP=KDE (works fine); Middle: XDG_CURRENT_DESKTOP=XFCE (breaks); Right: QT_QPA_PLATFORMTHEME=qt5ct (breaks)

Description Juraj 2020-02-08 19:11:39 UTC
Created attachment 125773 [details]
Left: XDG_CURRENT_DESKTOP=KDE (works fine); Middle: XDG_CURRENT_DESKTOP=XFCE (breaks); Right: QT_QPA_PLATFORMTHEME=qt5ct (breaks)

SUMMARY
First, I am not genuine plasma user.

When I change XDG_CURRENT_DESKTOP to something else then KDE the system settings will break (theming, style, more qml errors), maybe other kde/plasma things too.

I usually use qt5ct to manage qt theme which is managed I change by setting
> QT_QPA_PLATFORMTHEME=qt5ct
this also causes the same errors which I write about.
For the sake of my tests I disabled this change by setting this variable to nothing, which turns qt to some defaults.
With these default when I set XDG_CURRENT_DESKTOP=KDE everything works (well, there are still some warnings(?) in console from some modules) and looks as it should.
When I set it to something else (truly whatever, it can be valid DE name or your custom value, or empty) it breaks as described.
See attachment.

STEPS TO REPRODUCE
1. Set XDG_CURRENT_DESKTOP env variable to anything else apart from KDE
2. Start systemsettings5
3. Open e.g. Display & Monitor section

OBSERVED RESULT
Broken layout, missing parts, broken qml.

EXPECTED RESULT
Properly shown section, all parts present, no additional qml errors.

SOFTWARE/OS VERSIONS
Operating System: Artix Linux 
KDE Plasma Version: 5.17.5
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.1
Kernel Version: 4.19.98-1-lts
OS Type: 64-bit

ADDITIONAL INFORMATION
I get these logs when running these commands:


> QT_PLATFORM_PLUGIN= XDG_CURRENT_DESKTOP=GNOME QT_QPA_PLATFORMTHEME= systemsettings5 
org.kde.kcoreaddons: Error loading plugin "kcm_kscreen" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:50: TypeError: Value is null and could not be converted to an object
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:28: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:27: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:48: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:59: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:57: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:48: ReferenceError: units is not defined
org.kde.kcoreaddons: Error loading plugin "kcm_nightcolor" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:80: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:90: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:80: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:90: ReferenceError: units is not defined


> QT_PLATFORM_PLUGIN= XDG_CURRENT_DESKTOP=KDE QT_QPA_PLATFORMTHEME= systemsettings5 
org.kde.kcoreaddons: Error loading plugin "kcm_kscreen" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set
org.kde.kcoreaddons: Error loading plugin "kcm_nightcolor" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set


> QT_PLATFORM_PLUGIN= XDG_CURRENT_DESKTOP=KDE QT_QPA_PLATFORMTHEME=qt5ct systemsettings5 
qt5ct: using qt5ct plugin
qt5ct: D-Bus global menu: no
org.kde.kcoreaddons: Error loading plugin "kcm_kscreen" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:50: TypeError: Value is null and could not be converted to an object
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:28: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:27: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:48: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:59: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:57: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Screen.qml:48: ReferenceError: units is not defined
org.kde.kcoreaddons: Error loading plugin "kcm_nightcolor" "The shared library was not found." 
Plugin search paths are ("/usr/lib/qt/plugins", "/usr/bin") 
The environment variable QT_PLUGIN_PATH might be not correctly set
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/main.qml:116: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:80: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:90: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:80: ReferenceError: units is not defined
file:///usr/share/kpackage/kcms/kcm_kscreen/contents/ui/Output.qml:90: ReferenceError: units is not defined
Comment 1 David Edmundson 2020-02-16 18:56:01 UTC
Fixed this.

But it stems from an easy trap to fall into that doesn't exhibit itself on KDE, so please do open new reports if you see it elsewhere.
Comment 2 Juraj 2020-02-16 19:04:50 UTC
> Fixed this.
May I ask how was this fixed? (link to commit or something).

> But it stems from an easy trap to fall into that doesn't exhibit itself on KDE
I agree, this is KDE/Plasma system settings so if it does not work on other DEs it is probably fine.

> so please do open new reports if you see it elsewhere
Will do if I see it somewhere.
But it makes me think that something is rotting here.
If such a simple change can cripple some KDE programs, it sounds scary.

Thank you for reply.
Best regards.
Comment 3 David Edmundson 2020-02-16 19:28:32 UTC
https://phabricator.kde.org/D27442
Comment 4 David Edmundson 2020-02-16 19:30:50 UTC
and somewhat relevant: https://phabricator.kde.org/T12708
Comment 5 David Edmundson 2020-02-17 16:33:35 UTC
Git commit 357df7c5c48abd862fcd71e1d611f3f575c74be4 by David Edmundson.
Committed on 17/02/2020 at 16:33.
Pushed by davidedmundson into branch 'Plasma/5.18'.

fix(kcm): use explicit Kirigami.Units over singleton from a theme

Summary:
units lowercase is defined by

PlasmaCore as a singleton (which we generally shouldn't be using)
Kirigami's desktop theme plugin, as a singleton. This plugin is only
loaded on KDE

Kirigami.Units is the correct import that is always defined.

Test Plan: opened KCM normally and with forced QT_QPA_PLATFORM

Reviewers: #plasma, apol, romangg

Reviewed By: #plasma, apol, romangg

Subscribers: davidre, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27442

M  +3    -2    kcm/package/contents/ui/Output.qml
M  +3    -3    kcm/package/contents/ui/Screen.qml
M  +3    -3    kcm/package/contents/ui/main.qml

https://commits.kde.org/kscreen/357df7c5c48abd862fcd71e1d611f3f575c74be4