Sat May 02, 2020 8:34 pm
I wonder how Plasma changes theme under the hood.
I see lookandfeeltool which changes theme "lookandfeeltool -a <themename>" yet I do not know how it does that. Oddly, I cannot seem to find the source code for it. It is probably inside somewhere of "plasma-desktop" repo.
One thing came to my mind was to check if it uses DBus. I did:
org.kde.lookandfeeltool and org.kde.kdecorations2 are not in session bus. org.kde.KLauncher is there but it does not have a method to change the theme.
So, I have multiple questions:
KDE is great and all but when it comes to program it yourself, it seriously lacks documentation.
Thanks in advance.
Tue May 05, 2020 6:51 pm
viewtopic.php?f=305&t=165711 might also be of help
Currently running Kubuntu 20.04, Plasma 5.18.5, Frameworks 5.68.0, Qt 5.12.8, kernel 5.4.0-34
FWIW: it is always useful to state the Plasma version and distribution when asking questions in this forum, makes it easier for us to help ...
Wed May 06, 2020 9:19 am
First, theming of Plasma isn't unified; it is splitted over several different theming elements, which are all handled differently. For an overview of theming elements, see my comment at https://www.reddit.com/r/kde/comments/b ... beginners/
If you are writing a KDE or Qt application, changes in theming (fonts, color scheme, widget style) are usually handled automatically via global Qt events (QEvent::ApplicationFontChange, QEvent::ApplicationPaletteChanged, QEvent::StyleChanged), so there is no pressure to document the process further.
Internally, these events are sent by Qt when Plasma's Qt platform integration plugin changes settings in each application. This plugin listens to D-Bus signals sent by the KCMs. The source is the documentation in this case; see https://cgit.kde.org/plasma-integration ... ttings.cpp and https://cgit.kde.org/plasma-integration ... gsdata.cpp
List of available fonts is handled by fontconfig library; available color schemes are in (/usr|~/.local)/share/color-schemes; available widget styles are handled internally by Qt reading the plugin folders, see https://www.reddit.com/r/kde/comments/g ... _location/
See also QStyleFactory::keys() documentation.
For theming elements that don't affect applications, but are private to Plasma (e.g. window decorations are handled by kwin, Desktop themes are handled by plasmashell) you would need to find the internals in the source of the relevant KCM pages.
For example, the desktoptheme KCM finds the list of available plasma themes in (/usr|~/.local)/share/plasma/desktoptheme, and notifies plasmashell via changes to its plasmarc config file, see https://cgit.kde.org/plasma-desktop.git ... smodel.cpp
If your application cannot use KConfig, because it doesn't use KDE's frameworks, you can use the kwriteconfig5 command, e.g.
Registered users: annyone, Baidu [Spider], Bing [Bot], claydoh, cmb, denispyr, Don B. Cilly, farid, Google [Bot], Ico_dY, ipwizard, Majestic-12 [Bot], ostroffjh, Section_8, shurato, Sogou [Bot], Steve R.