Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome doesn't detect light/dark theme change on Linux (KDE/Flatpak) #273

Open
dmig opened this issue Feb 19, 2024 · 10 comments
Open

Chrome doesn't detect light/dark theme change on Linux (KDE/Flatpak) #273

dmig opened this issue Feb 19, 2024 · 10 comments

Comments

@dmig
Copy link

dmig commented Feb 19, 2024

Bug Description

Chrome does not detect light/dark theme change in the system.

Steps To Reproduce

  • Install Chrome via Flatpak (Flathub repository)
  • Launch Chrome
  • Switch Gnome to light/dark mode:
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-dark'"
# or
dconf write /org/gnome/desktop/interface/color-scheme "'prefer-light'"

Expected Behavior

Chrome should follow system theme change.

Actual Behavior

Chrome theme doesn't change.

System Information

$ lsb_release -a
LSB Version:    n/a
Distributor ID: SteamOS
Description:    SteamOS Holo
Release:        rolling
Codename:       Holo

$  uname -a
Linux steamdeck 6.1.52-valve16-1-neptune-61 #1 SMP PREEMPT_DYNAMIC Tue, 06 Feb 2024 00:51:49 +0000 x86_64 GNU/Linux

$ flatpak info -m com.google.Chrome
[Application]
name=com.google.Chrome
runtime=org.freedesktop.Platform/x86_64/22.08
sdk=org.freedesktop.Sdk/x86_64/22.08
base=app/org.chromium.Chromium.BaseApp/x86_64/22.08
tags=proprietary;
command=chrome
required-flatpak=1.8.2

[Context]
shared=network;ipc;
sockets=x11;wayland;pulseaudio;pcsc;cups;
devices=all;
filesystems=host-etc;~/.config/kioslaverc;xdg-music;xdg-pictures;xdg-videos;/run/.heim_org.h5l.kcm-socket;~/.config/dconf:ro;xdg-download;xdg-run/dconf;xdg-documents;xdg-run/pipewire-0;

[Session Bus Policy]
org.freedesktop.Notifications=talk
org.freedesktop.FileManager1=talk
org.mpris.MediaPlayer2.chromium.*=own
org.kde.StatusNotifierWatcher=talk
org.freedesktop.ScreenSaver=talk
org.freedesktop.secrets=talk
ca.desrt.dconf=talk
org.gnome.SessionManager=talk

[System Bus Policy]
org.freedesktop.Avahi=talk
org.freedesktop.UPower=talk
org.bluez=talk

[Environment]
GSETTINGS_BACKEND=dconf
GIO_EXTRA_MODULES=/app/lib/gio/modules
GTK_PATH=/app/lib/gtkmodules
DCONF_USER_CONFIG_DIR=.config/dconf

[Extra Data]
name=chrome.deb
checksum=50380ed6c27b6e08054deec2dfa0a71d85e31bdaccf99a8508eccdc880e94346
size=106428268
uri=https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_121.0.6167.184-1_amd64.deb

[Extension com.google.Chrome.Debug]
directory=lib/debug
autodelete=true
no-autodownload=true

[Build]
built-extensions=com.google.Chrome.Debug;com.google.Chrome.Sources;

When natively installed from AUR, Chrome doesn't have this problem.

@evan-a-a
Copy link
Contributor

Interesting, the dark mode detection implementation in Chromium uses the portal system, so this should work. Relevant code:

https://github.com/chromium/chromium/blob/main/chrome/browser/ui/views/dark_mode_manager_linux.cc

Do you have any dbus binding errors in the logs at startup?

@dmig
Copy link
Author

dmig commented Feb 20, 2024

Yes, there is one, related to kwallet (not installed):

$ flatpak run com.google.Chrome 
Gtk-Message: 18:11:58.704: Failed to load module "canberra-gtk-module"
[0220/181158.786010:WARNING:chrome_main_linux.cc(80)] Read channel stable from /app/extra/CHROME_VERSION_EXTRA
[0220/181158.967293:WARNING:chrome_main_linux.cc(80)] Read channel stable from /app/extra/CHROME_VERSION_EXTRA
Gtk-Message: 18:11:59.018: Failed to load module "canberra-gtk-module"
Gtk-Message: 18:11:59.065: Failed to load module "colorreload-gtk-module"
Gtk-Message: 18:11:59.066: Failed to load module "window-decorations-gtk-module"
[2:2:0220/181159.100915:ERROR:atom_cache.cc(224)] Add _ICC_PROFILE_1 to kAtomsToCache
[2:2:0220/181159.114903:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KWallet.isEnabled: object_path= /modules/kwalletd5: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown
[2:2:0220/181159.114962:ERROR:kwallet_dbus.cc(112)] Error contacting kwalletd5 (isEnabled)
[2:2:0220/181159.117763:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KLauncher.start_service_by_desktop_name: object_path= /KLauncher: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown
[2:2:0220/181159.117801:ERROR:kwallet_dbus.cc(81)] Error contacting klauncher to start kwalletd5
[2:2:0220/181159.118298:ERROR:object_proxy.cc(576)] Failed to call method: org.kde.KWallet.close: object_path= /modules/kwalletd5: org.freedesktop.DBus.Error.ServiceUnknown: org.freedesktop.DBus.Error.ServiceUnknown
[2:2:0220/181159.118319:ERROR:kwallet_dbus.cc(503)] Error contacting kwalletd5 (close)
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Fontconfig error: Cannot load default config file: No such file: (null)
Fontconfig error: Cannot load default config file: No such file: (null)

but nothing else

@evan-a-a
Copy link
Contributor

I can't reproduce this on GNOME 46 Beta (Fedora 40 branched). Can you confirm the DE and version you are using?

@dmig
Copy link
Author

dmig commented Feb 20, 2024

It is:

Operating System: SteamOS 3.5.15
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.107.0
Qt Version: 5.15.9

running Xorg

@evan-a-a
Copy link
Contributor

Unless you've set up your environment differently, KDE doesn't use dconf for configuration and thus won't reflect those changes to Gnome settings that the dconf commands modify. You'll need to change things the KDE-way, which most easily is done through the settings utility.

@dmig
Copy link
Author

dmig commented Feb 21, 2024

KDE way is unrelated here.
I actually use 2 commands to change theme:

plasma-apply-colorscheme BreezeDark
gsettings set org.gnome.desktop.interface color-scheme prefer-dark

@evan-a-a
Copy link
Contributor

I've verified that this works as intended on KDE 6 RC2 (Fedora 40), so this is either a KDE 5.27 bug or an environment issue.

Can you verify that xdg-desktop-portal and xdg-desktop-portal-kde are running in your environment? Both are necessary to emit the signal that notifies Chrome of the theme change.

ps aux | grep xdg-desktop-portal

or the systemd way

systemctl --user status xdg-desktop-portal.service
systemctl --user status xdg-desktop-portal-kde.service

@dmig
Copy link
Author

dmig commented Feb 21, 2024

I verified that both processes are running:

deck        3489  0.0  0.6 1225912 95072 ?       Ssl  Feb16   0:26 /usr/lib/xdg-desktop-portal-kde
deck      287148  0.0  0.1 593832 19764 ?        Ssl  00:12   0:00 /usr/lib/xdg-desktop-portal

Likely it's the environment issue, but I don't trust flatpak because had to fix several old known bugs manually.

There is another thing that differs from native package: under 'Appearance' menu there is a dark mode selector (light/dark/system), which is missing in flatpak Chrome. I wonder if it's shown depending on the environment or enabled using flags?

@evan-a-a
Copy link
Contributor

I don't have those options either and dark mode still follows the system, as expected.

Would you mind waiting for KDE 6 to release (it's due next week) and seeing if the issue persists?

@dmig
Copy link
Author

dmig commented Feb 21, 2024

I don't think KDE 6 is coming to steam deck any soon. Will continue investigating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants