FedoraQt / QGnomePlatform

QPlatformTheme for a better Qt application inclusion in GNOME
GNU Lesser General Public License v2.1
262 stars 38 forks source link

Feature request: Read color-scheme from org.x.apps.portal when possible #147

Open bobby285271 opened 1 year ago

bobby285271 commented 1 year ago

(I have a NixOS and a Fedora installation, both are running Cinnamon and I can reproduce these behaviors on both installations)


The background story is long and thanks for reading :joy:

I noticed that with the combination of below (which is the default in Fedora Cinnamon I think) ...

gsettings set org.cinnamon.desktop.interface gtk-theme 'Mint-Y-Dark-Aqua'
gsettings set org.gnome.desktop.interface color-scheme 'default'
unset QT_STYLE_OVERRIDE # well this is always not set

... The fcitx5-config-qt program (from the fcitx5-configtool package) looks unusable

This might or might not be a bug (sorry I did not investigate here), but I immediately figured out that doing this fixes the issue, and now the app looks good:

gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

However, it looks like org.gnome.desktop.interface color-scheme is not used in the newly introduced xdg-desktop-portal-xapp, which is now part of Cinnamon 5.8. Looking at how they get_color_scheme, they read color-scheme from org.x.apps.portal instead.

Looking at this cinnamon commit, cinnamon 5.8 has a simplified theme settings page that can update both GTK theme and color-scheme (org.x.apps.portal) with one mouse click, which will be a very good solution to the fcitx5-config-qt program if QGnomePlatform can watch the color-scheme from org.x.apps.portal as well.

Here is the output of gsettings reset org.gnome.desktop.interface color-scheme && gsettings set org.x.apps.portal color-scheme 'prefer-dark' && gsettings set org.cinnamon.desktop.interface gtk-theme 'Mint-Y-Dark-Aqua' && unset QT_STYLE_OVERRIDE && QT_LOGGING_RULES="qt.qpa.qgnomeplatform*=true" fcitx5-config-qt (on Cinnamon) for reference (this starts the "unusable" fcitx5-config-qt with some debug logs):

qt.qpa.qgnomeplatform: Using GSettings backend
qt.qpa.qgnomeplatform.hintprovider: Cursor blink time:  1200
qt.qpa.qgnomeplatform.hintprovider: Font name:  "Ubuntu"  (size  10 )
qt.qpa.qgnomeplatform.hintprovider: Monospace font name:  "Source Code Pro"  (size  10 )
qt.qpa.qgnomeplatform.hintprovider: TitleBar font name:  "Cantarell"  (size  11 )
qt.qpa.qgnomeplatform.hintprovider: Double click time:  400
qt.qpa.qgnomeplatform.hintprovider: Long press time:  500
qt.qpa.qgnomeplatform.hintprovider: Double click distance:  5
qt.qpa.qgnomeplatform.hintprovider: Dnd drag threshold:  8
qt.qpa.qgnomeplatform.hintprovider: Password hint timeout:  0
qt.qpa.qgnomeplatform.hintprovider: GTK theme:  "Mint-Y-Dark-Aqua"
qt.qpa.qgnomeplatform.hintprovider: Prefer dark theme:  no
qt.qpa.qgnomeplatform.hintprovider: Icon theme:  "Mint-Y-Sand"
qt.qpa.qgnomeplatform.hintprovider: Fallback icon theme:  "Adwaita"

(I am not sure if I should ask Cinnamon to keep org.gnome.desktop.interface color-scheme in sync instead, but I saw some Cinnamon support here and wonder if anyone can help here, anyway thanks for the help!)