aichingm / lonewolf

Organize and track your tasks with ease and flexibility
GNU General Public License v3.0
23 stars 1 forks source link

Automatically follow system theme #12

Open nekohayo opened 3 months ago

nekohayo commented 3 months ago

The app has a dark mode switch, but it would be better if it just followed the freedesktop standard dark preference, or in the case of CSS-based web apps, maybe using the prefers-color-scheme media query.

That way it could adapt automatically based on the time of the day using things like https://extensions.gnome.org/extension/2236/night-theme-switcher/ (which will eventually be a built-in feature)

aichingm commented 2 months ago

Interesting idea! Ill think about how this can be accomplished.

nekohayo commented 2 months ago

As it seems to me your app is an electron web app, this is probably how you'd achieve it:

AFAIK recent versions of Electron transmit this information from the OS nowadays.

aichingm commented 1 month ago

Implemented in 9c51e16cfa35734b75acac21ca2ff3277ad0ab6e will be release in 1.3.0

nekohayo commented 1 month ago

Tested the version that came down the flathub pipe now, and it doesn't seem to work, system theme always remains light. Is there a dependency update missing?

aichingm commented 1 month ago

Hi @nekohayo, I have a few questions but also some answers.

Questions first:

In principal the implementation I wrote works BUT it seams the the framework (Tauri) I'm using uses webkitgtk, as the component which renders the app, which has a quite unique understanding of when a system has dark mode enabled or not^1.

Basically it checks if the the GTK theme ends with -dark this is true for the gtk theme adwaita-dark or if the environment variable GTK_THEME ends with -dark . The bad news is that kde does not set the environment variable and flatpak does not propagate the theme to the application.

I sad in principal that the implementation works in principal because if you start lonewolf with GTK_THEME=foo-dark and set the dark mode to System it works (you could also set the environment variable using flatseal or the kde system settings plugin for flatpak):

flatpak run --env=GTK_THEME=foo-dark site.someones.Lonewolf

Conclusion

This is a limitation in the framework lonewolf is using. I can currently not think about a solution which would not be a terrible hack. This is not the only issue I have with Tauri and its decision to use webkitgtk. I know the team around Tauri is working hard to get version 2 out the door. I don't know if the new version solves some of the issues I have.

Personally I like the Tauri but webkitgtk is a mess... I am thinking about moving the project over to Electron (but not before Tauri v2 is out)

More Links