Bug 375272

Summary: Use Xsettings instead of edititing the config files
Product: [Applications] systemsettings Reporter: HJ <punx665>
Component: kcm_gtkAssignee: Aleix Pol <aleixpol>
Status: RESOLVED FIXED    
Severity: wishlist CC: aleixpol, bugs, peter.eszlari, rdieter, supgesu
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.18.0
Sentry Crash Report:

Description HJ 2017-01-19 04:18:39 UTC
the current way of editing the gtk config files directly is not really useful since it breaks besides installed desktop environments and overwrites theme internal settings like fonts eg for GTK2:

style"customelementfont"{
xthickness=0
ythickness=0
font_name="Sans 6"}
widget_class"*GtkButton.GtkLabel"style"customelementfont"

or for GTK3

button,
button:backdrop{
font-weight:bold;
font-size:0.8em;}

when i now choose a font and a size in KCM gtk it will override both examples.

the better way would be to run a simple xsettings client like all the other desktops do:

https://github.com/derat/xsettingsd or https://github.com/KDE/xsettings-kde

Also i give this a grave severity because as I said it breaks other desktops by overwriting their settings which makes it unusable on multiuser systems
Comment 1 Rex Dieter 2019-11-04 16:50:16 UTC
triaging as wishlist, as this would be a new feature (that I would welcome)
Comment 2 Nate Graham 2019-11-04 19:30:03 UTC
*** Bug 387091 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2019-11-04 20:51:37 UTC
*** Bug 384588 has been marked as a duplicate of this bug. ***
Comment 4 Peter Eszlari 2019-11-09 18:54:34 UTC
This is also needed to fix flatpak theming.
Comment 5 Nate Graham 2019-11-14 19:29:45 UTC
Git commit 94732eb8d6ee54573a4476e7b036808ac9907ba0 by Nate Graham, on behalf of Mikhail Zolotukhin.
Committed on 14/11/2019 at 19:29.
Pushed by ngraham into branch 'master'.

Update GTK settings according to Plasma settings

Summary:
To increase usability,

- fonts
- icon theme
- cursor theme
- toolbar style (icons-only, text below buttons etc)
- icons visibility in menus
- icons visibility on buttons

settings for gtk applications are now set in respective kcms, instead of separate gtk kcm.

Various kcms are sending signals (dbus or Qt ones) about the configuration change. Then the gtkconfig kded daemon connects to these signals and changes gtk config files to match new settings, that were set in those kcms.

D24701 is needed to notify about cursor change on Wayland.

Live reloading (on a fly) is not going to work for some settings on X11. This applies to cursor theme, it's changed by partially. To illustrate that open Nautilus File Manager, change cursor theme and try to double click folders. You will see, that "loading" cursor changed its theme, but "idle" one did not.

What is not tested:
- Toolbar style for gtk3 apps other that Geany (absence of live reloading may be a Geany bug)
- Toolbar style and icons visibility on Wayland

Depends on D24701
Related: bug 401507, bug 411097

FIXED-IN: 5.18.0

Test Plan:
# To test gtk3 applications live reloading on X11, install xsettingsd.
# Restart kded5.
# Open gtk2 app, gtk3 app
# Change above mentioned settings in respective KCMs
# Check if gtk applications are changing their settings before (sometimes) and after their restart.

Rare cases:
- To test icons on buttons use Inkscape about window.
- To test toolbar style use Geany (gtk3, live reloading does not work) and BleachBit (gtk2)

Reviewers: #plasma, #vdg, broulik, cblack

Reviewed By: #plasma, broulik

Subscribers: ervin, ngraham, broulik, nicolasfella, plasma-devel

Tags: #plasma, #vdg

Maniphest Tasks: T10611

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

M  +2    -1    CMakeLists.txt
A  +31   -0    kded/CMakeLists.txt
A  +179  -0    kded/configeditor.cpp     [License: GPL (v2/3)]
A  +33   -0    kded/configeditor.h     [License: GPL (v2/3)]
A  +136  -0    kded/configvalueprovider.cpp     [License: GPL (v2/3)]
A  +51   -0    kded/configvalueprovider.h     [License: GPL (v2/3)]
A  +134  -0    kded/gtkconfig.cpp     [License: GPL (v2/3)]
A  +73   -0    kded/gtkconfig.h     [License: GPL (v2/3)]
A  +15   -0    kded/gtkconfig.json

https://commits.kde.org/kde-gtk-config/94732eb8d6ee54573a4476e7b036808ac9907ba0