Open rukai opened 2 years ago
This library does not set dark mode. It only reads the setting so you can make use of it in your application.
I realize that, I'm after a quick note in the readme on how to configure my system such that rust-dark-light will pick up either dark or light mode. And I wouldnt fault you for closing this issue as out of scope, but I suspect I'm not the only one who will encounter this.
The problem from my perspective is I have an egui app that uses rust-dark-light under the hood which is causing it to show up as light-mode. This is great and a fantastic use of this library. The only problem is I have no idea how to change the preference to dark mode on my linux machine. This is partially a problem of linux's fragmented configuration but I think at least documenting how a user could configure the configuration system with the highest priority (XDG Desktop Portal dbus) would go a long way.
The only problem is I have no idea how to change the preference to dark mode on my linux machine.
In Ubuntu 20.04 LTS, Open the "Settings" tool. In the Appearance tab, Window colors have the options "LIght", "Standard", and "Dark". This affects most things on screen.
Unfortunately, rust-dark-light returns "Mode::Light" even for "Dark" mode.
Unfortunately, rust-dark-light returns "Mode::Light" even for "Dark" mode.
Does anyone know if Ubuntu use a different system property than whatever we're reading from?
For anyone stumbling here looking how to set dark mode without a GUI settings app:
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
Does anyone know if Ubuntu use a different system property than whatever we're reading from?
Looks like it. The command gsettings get org.gnome.desktop.interface color-scheme
prints 'prefer-dark'
or 'prefer-light'
depending on what has been set in the Settings app.
Edit: There's some weirdness going on here. The gsettings
command works successfully when run from within the Terminal app but not when run from Visual Studio Code's integrated terminal.
For the record: The problem is that https://github.com/demurgos/detect-desktop-environment does not work correctly.
Ubuntu sets the XDG_CURRENT_DESKTOP
to ubuntu:GNOME
and detect-desktop-environment checks if the variable equals "GNOME".
I opened an issue about that here: https://github.com/demurgos/detect-desktop-environment/issues/5
Some docs on how to set dark mode on linux in the recommended
XDG Desktop Portal dbus
method would be appreciated. I searched around but couldnt figure out how to set it up.