gnome-shell-extension-gsconnect icon indicating copy to clipboard operation
gnome-shell-extension-gsconnect copied to clipboard

Settings Window System Theme (Dark Mode) not recognized

Open bevsxyz opened this issue 1 year ago • 19 comments

Describe the bug

The GSConnect Mobile settings page does not follow the system dark theme. Additionally, there is no way to change the theme manually in the settings.

Steps to reproduce

  1. Go to settings.

Expected behavior

The settings window will follow the system theme. Having the option to change the theme in settings would be a plus.

GSConnect version

54

Installed from

Extension Manager

GNOME Shell version

43.3

Linux distribution/release

Fedora Linux 37.20230319.0 (Silverblue)

Paired device(s)

Realme X2

KDE Connect app version

1.22.2

Plugin(s)

No response

Support log

GSConnect: 54 (user)
GJS:       17401
Session:   wayland
OS:        Fedora Linux 37.20230319.0 (Silverblue)
--------------------------------------------------------------------------------
Mar 21 22:03:12 systemd[1]: flatpak-system-helper.service: Deactivated successfully.
Mar 21 22:03:12 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=flatpak-system-helper comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Mar 21 22:03:12 systemd[1]: flatpak-system-helper.service: Consumed 45.604s CPU time.
Mar 21 22:03:31 wpa_supplicant[1148]: wlo1: CTRL-EVENT-SIGNAL-CHANGE above=1 signal=-44 noise=9999 txrate=130000

Screenshots

Screenshot from 2023-03-21 21-42-11

Notes

I am uncertain if this is a Silverblue thing or a Gnome 43 issue.

bevsxyz avatar Mar 21 '23 16:03 bevsxyz

See, mine comes up in dark mode.

Screenshot from 2023-04-03 05-20-53

This seems to come down to how support has been implemented for so-called "dark mode". There are both "dark themes" that can be selected, and also dark variations of certain themes (most notably, the default Adwaita) that can be enabled... but then those won't work if you switch to a theme which doesn't offer a dark variation, or which offers it as a separate theme choice.

On my system, Adwaita is selected as the system theme (it's the value set — well, left defaulted — in org.gnome.desktop.interface.gtk-theme), and its dark variation is selected by org.gnome.desktop.inteface.color-scheme being set to prefer-dark (which I think is what the Control Center switch now controls, that color-scheme value.)

If your Gtk or Gtk4 apps have a different theme enabled, or aren't configured for "dark mode", they might not respect those values. I know that there's a trigger in the inspector for both Gtk and Gtk4, and that they separately do something... but I don't know WHERE the setting that switch controls even lives.

Try this, though:

  1. Open GSConnect's preferences window
  2. Type Ctrl+Shift+d into the window
  3. The GTK inspector window should (hopefully) pop open
  4. Switch to the Visual panel
  5. Look for a "Dark Variant" switch
  6. If it's not turned on, flip it

If, as I suspect, it's not enabled, that should fix it and turn your GSConnect settings window Dark. Whether it will be permanent, or how/if you can make it permanent... ¯\_(ツ)_/¯

image

ferdnyc avatar Apr 03 '23 09:04 ferdnyc

@ferdnyc The keyboard shortcut is unresponsive in my case.

bevsxyz avatar Apr 06 '23 14:04 bevsxyz

@bevsxyz Hm, that's strange! It wouldn't surprise me with a Gtk3 app, since it requires a settings change to enable, but for Gtk4 I was under the impression that the inspector keybindings defaulted to enabled. Perhaps that's not true with Silverblue, for some reason.

(The GSettings key is org.gtk.gtk4.Settings.Debug.enable-inspector-keybinding, if you want to check it.)

ferdnyc avatar Apr 06 '23 14:04 ferdnyc

$ gsettings get org.gnome.desktop.interface gtk-theme
'Adwaita'
$ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'
$ gsettings get org.gtk.gtk4.Settings.Debug enable-inspector-keybinding
true

@ferdnyc These are the values of the keys you had mentioned. Did I check the right place?

bevsxyz avatar Apr 07 '23 09:04 bevsxyz

@bevsxyz Yup, looks like it!

I don't know why the inspector wouldn't come up for you, that's strange. I wonder if there's a package that needs to be installed?

...Though, come to think of it, it is possible to launch the preferences manually, so you don't really need the keybinding. This should work just as well:

GTK_DEBUG=interactive \
~/.local/share/gnome-shell/extensions/[email protected]/gsconnect-preferences

(Make sure it's not already open, before you do that.)

That should bring up the preferences window, with the debugger behind it (annoyingly). Or if it doesn't, then there's definitely some dependency it requires that you must be missing.

On my Fedora 37 (Workstation) system, even with gnome-control-center configured for dark mode, if I go in with the inspector and turn off Dark Variant, it will turn the Preferences window (only) to light mode, so clearly there's some sort of control other than what's in org.gnome.destkop.interface (though, as I said, I have no idea where...)

(Edit: If you are missing a package, it's most likely just gtk4-devel.)

ferdnyc avatar Apr 07 '23 10:04 ferdnyc

with the debugger behind it (annoyingly).

Huh, actually not always. They seem to race a bit. ...That's even more annoying!

ferdnyc avatar Apr 07 '23 10:04 ferdnyc

The other thing you'd be looking for, in the inspector, is in the Resources view. On my system, the interface has both light and dark CSS files available to it as resources. (Those are automatic, they come from Gtk4.)

image

ferdnyc avatar Apr 07 '23 10:04 ferdnyc

@ferdnyc Flipping the Dark Variant switch under Visual did the job. Both the dark and light CSS files are available for Adwaita too.

However, the change is temporary and only for the settings window. I think we both have the opposite issue. For you dark mode is default and changing to light mode is an issue.

bevsxyz avatar Apr 07 '23 11:04 bevsxyz

Screenshot from 2023-04-07 16-56-21

Reopening the window, it switches back to light mode.

bevsxyz avatar Apr 07 '23 11:04 bevsxyz

@bevsxyz Yup, that's pretty much exactly what I expected.

In a way, this is good news! It means that everything is working... well, I'm not going to say "normally", but "in the manner we've come to expect". You haven't uncovered any Additional Weirdness, so the only thing you have to face is the Usual Weirdness. Could be worse!

Now we just need to figure out what bit in what location the "Dark Variant" inspector switch controls, why it would be different from the color-scheme preference selected in gnome-control-center, and how it can be flipped to default in the other direction (or, even better, to just follow the g-c-c setting).

I'd take that (those) question(s) to https://discourse.gnome.org/; you have a focused, specific scenario now, with concrete data points about what's going on... hopefully someone there will be able to point to whatever obscure value or config file governs this, and explain how to sort it out.

That'd be my next step, anyway.

ferdnyc avatar Apr 07 '23 11:04 ferdnyc

@ferdnyc I have created a new topic there.

https://discourse.gnome.org/t/system-theme-not-recognized-for-gsconnect-setting-window-dark-mode/14865

bevsxyz avatar Apr 08 '23 12:04 bevsxyz

So, I installed Fedora 38 myself (in a VM), hit this same issue, and tracked down what was going on.

The core issue is that GSConnect is using Gtk 3.0 (explicitly:)

https://github.com/GSConnect/gnome-shell-extension-gsconnect/blob/182fbe98b3aa6072d8cd6282faacb2d875cdb522/src/gsconnect-preferences#L16

...and the GNOME 44 dark-mode settings don't affect Gtk3.0. (As I expected, all Gtk3 apps are affected — yelp, the help browser, is another easy pick to confirm that this doesn't only happen with GSConnect.)

A quick & dirty fix is to install gnome-tweaks, and then in its Appearance tab, set the "Legacy Applications" theme to "Adwaita-dark". That will dark-mode-style all Gtk3.0 apps.

But we should probably also stop forcing Gtk3, at least in brand-new GNOME releases.

ferdnyc avatar Apr 29 '23 18:04 ferdnyc

But we should probably also stop forcing Gtk3, at least in brand-new GNOME releases.

Turns out, there's quite a bit of work involved in moving to Gtk4, because the code uses a lot of interfaces from Gtk3 that were removed in Gtk4. (Mostly virtual functions for signal handling, things like vfunc_delete(), vfunc_key_press_event(), etc... that Gtk4 doesn't give us access to anymore.)

ferdnyc avatar Apr 29 '23 20:04 ferdnyc

...Though, come to think of it, it is possible to launch the preferences manually, so you don't really need the keybinding. This should work just as well:

GTK_DEBUG=interactive \
~/.local/share/gnome-shell/extensions/[email protected]/gsconnect-preferences

I get the following error on Fedora 38:

-bash: /home/user/.local/share/gnome-shell/extensions/[email protected]/gsconnect-preferences: No such file or directory

EDIT

A quick & dirty fix is to install gnome-tweaks, and then in its Appearance tab, set the "Legacy Applications" theme to "Adwaita-dark". That will dark-mode-style all Gtk3.0 apps.

...resolved the issue.

ghost avatar May 21 '23 05:05 ghost

I get the following error on Fedora 38:

-bash: /home/user/.local/share/gnome-shell/extensions/[email protected]/gsconnect-preferences: No such file or directory

You may have the extension installed systemwide, in which case the equivalent command would be:

GTK_DEBUG=interactive \
/usr/share/gnome-shell/extensions/[email protected]/gsconnect-preferences

...But there's no real need, as setting the legacy theme via gnome-tweaks is the only permanent fix, anyway.

ferdnyc avatar May 23 '23 03:05 ferdnyc

I have resolved the issue with the gnome extension legacy-gtk3-theme-scheme-auto-switcher. It is a permanent fix.

gnome-tweaks is not packaged as a flatpak. Since I use Fedora Silverblue, I did not want to overlay it with ostree either.

bevsxyz avatar May 30 '23 18:05 bevsxyz

Okay, so still the same issue with Fedora 40 / GNOME 46. And GSConnect 57.

grafik

So what is the TL;DR here?

In GNOME Tweaks, I only have "Adwaita" selectable in the list (for "legacy applications"), but not anything like "dark" (just high contrast themes):

grafik

Software information (German because copied from GNOME Control Center sorry)

  • Name des Betriebssystems: Fedora Linux 40.20240514.0 (Silverblue)
  • Betriebssystem-Build: (null)
  • Betriebssystem-Typ: 64-bit
  • GNOME-Version: 46
  • Fenstermanager: Wayland
  • Kernel-Version: Linux 6.8.9-300.fc40.x86_64

Aka also Fedora Silverblue here, though I doubt that is relevant.

$ rpm-ostree status -b                                     
State: idle
AutomaticUpdates: stage; rpm-ostreed-automatic.timer: last run 1 day 2h ago
BootedDeployment:
● fedora:fedora/40/x86_64/silverblue
                  Version: 40.20240514.0 (2024-05-14T00:39:14Z)
               BaseCommit: 63be678888a00a9fe13f49c2ecb38545513f4d2d4ede292437ed23094d0aab23
             GPGSignature: Valid signature by 115DF9AEF857853EE8445D0A0727707EA15B79CC

Edit: I've also, as other's apparently did before, asked in the GNOME forum.

$ gsettings get org.gnome.desktop.interface gtk-theme
'Adwaita-dark'
$ gsettings get org.gnome.desktop.interface color-scheme
'prefer-dark'
$ gsettings get org.gtk.gtk4.Settings.Debug enable-inspector-keybinding
true

rugk avatar May 15 '24 22:05 rugk