ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.8k stars 822 forks source link

Detect GTK dark theme #17288

Open evilpie opened 4 months ago

evilpie commented 4 months ago

The approach implemented in #17179 for detecting dark mode doesn't work great for me out of the box. I actually thought I had dark mode turned on, but it's actually in default mode. However because my GTK theme is dark, basically everything I use is dark as well.

I imagine we could run gsettings get org.gnome.desktop.interface gtk-theme? Alternatively we could maybe just add an overwrite setting? @kjarosh

torokati44 commented 4 months ago

I imagine we could run gsettings get org.gnome.desktop.interface gtk-theme?

And what would we do with the result? :no_mouth: Is there some sort of schema or requirement for theme names to signify whether they are "dark" or "light"?

torokati44 commented 4 months ago

Oof, okay...: https://github.com/frewsxcv/rust-dark-light/blob/77ae4349f11a556cef9c683803a832f171253479/src/freedesktop.rs#L38-L43

kjarosh commented 4 months ago

@evilpie what OS and DE do you have? (with versions) In modern GNOME, libadwaita is used and detecting GTK theme doesn't make sense.

Unfortunately, as @torokati44 mentioned, detecting non-standard themes is only heuristic. We would basically have to add conditions for every possible DE and somehow guess, similarly to what is done in rust-dark-light. IMO it's better to just add a setting to override the theme in case the user uses non-freedesktop-compatible dark mode.

evilpie commented 4 months ago

Linux Mint 21.3 Cinnamon

torokati44 commented 4 months ago

At any rate, much like with #17179, I'd much prefer accessing whatever mechanism is used for retrieving this setting directly (gsettings, dconf, what have you), instead of spawning another process for it.

torokati44 commented 4 months ago

Referencing: https://github.com/rust-windowing/winit/issues/3837, https://github.com/rust-windowing/winit/issues/3838