Bug 413107 - kde-config-gtk improper theming; ~/.gtkrc-2.0 issue
Summary: kde-config-gtk improper theming; ~/.gtkrc-2.0 issue
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_gtk (show other bugs)
Version: unspecified
Platform: Slackware Linux
: NOR normal (vote)
Target Milestone: ---
Assignee: Mikhail Zolotukhin
Depends on:
Reported: 2019-10-17 18:15 UTC by sombragris
Modified: 2019-11-11 00:17 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.17.3


Note You need to log in before you can comment on or make changes to this bug.
Description sombragris 2019-10-17 18:15:12 UTC
I usually alternate between light and dark color schemes. All themes were set by using System Settings and of course, the kde-config-gtk module.

After upgrading to Plasma 5.17, I suddenly had problems switching to dark theming for GTK+2 applications. One of them (claws-mail) is critical to my workflow. Suddenly I got light areas among dark backgrounds, and light buttons with white letters (unreadable) among other artifacts.

I began to check config files and surely enough, the culprit was ~/.gtkrc-2.0. There, kde-config-gtk put its customizations, but somehow before it was an include line:

include "/usr/share/pathtogtk/somelighttheme...."

you got the idea.

Well, this somehow was there and it was never removed or commented out or corrected, so it caused all sorts of havoc. Removing that line fixed the problem.

1. Don't know exactly how to reproduce.

GTK-2 apps incorrectly themed

KGK-2 apps should be themed correctly.
That is, kde-config-gtk should ensure GTK-2 themes should be applied correctly, even neutering any "includes" in any .gtkrc-2.0.

Linux/KDE Plasma: 
(available in About System)
Operating System: Slackware64-current
KDE Plasma Version: 5.17.0
KDE Frameworks Version: 5.63.0
Qt Version: 5.13.1
Kernel Version: 4.19.79
OS Type: 64-bit
Processors: 8 × Intel® Core™ i7-8550U CPU @ 1.80GHz
Memory: 15,6 GiB of RAM

Comment 1 Robby Pedrica 2019-10-26 06:30:56 UTC
Confirming this issue - since Plasma 5.17, and using a light theme for GTK apps, these apps actually appear to be set to a dark theme. Eg. with Breeze (light) my GTK apps are dark themed.
Comment 2 Nate Graham 2019-11-07 17:56:28 UTC
Git commit 308342b16f0a1af0437e1a7d7049b59d30a81952 by Nate Graham, on behalf of Mikhail Zolotukhin.
Committed on 07/11/2019 at 17:55.
Pushed by ngraham into branch 'Plasma/5.17'.

Remove gtkrc-2.0 legacy settings

Previously GTK KCM wrote to gtkrc redundant settings lines:
# `include "path to chosen gtk2 theme"`
style "user-font"
font-name="whatever font was chosen"
widget_style "*" style "user-font"

Now GTK KCM does not write those lines to configuration file,
but ones that was kept from previous versions of KCM
are causing various glitches, when applying gtk2
configuration, for theme and font configs respectively.

This patch fixes these issues removing these lines from gtkrc
by force, after applying any configuration from GTK KCM.
Related: bug 413678

Test Plan:
 # Open ~/gtkrc-2.0 and add those lines (theme and font name are arbitrary):
include "/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc"
style "user-font"
    font_name="Noto Sans Regular"
widget_class "*" style "user-font"
# Open GTK KCM and apply any configuration
# Reopen ~/gtkrc-2.0 file and check, that those lines were removed

Reviewers: cblack, #plasma, apol, ngraham

Reviewed By: cblack, ngraham

Subscribers: ervin, ngraham, plasma-devel

Tags: #plasma

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

M  +22   -0    src/appearancegtk2.cpp
M  +1    -0    src/appearancegtk2.h

Comment 3 sombragris 2019-11-07 18:10:33 UTC
Thank you! That was fast! Way to go guys!
Comment 4 Nate Graham 2019-11-11 00:17:27 UTC
*** Bug 413296 has been marked as a duplicate of this bug. ***