Mercurial > minori
diff src/gui/theme.cc @ 232:ff0061e75f0f
theme: add OS detection with glib
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 13 Jan 2024 11:06:16 -0500 |
parents | 2f5a9247e501 |
children | 4d461ef7d424 |
line wrap: on
line diff
--- a/src/gui/theme.cc Sat Jan 13 09:43:41 2024 -0500 +++ b/src/gui/theme.cc Sat Jan 13 11:06:16 2024 -0500 @@ -9,6 +9,10 @@ # include "sys/osx/dark_theme.h" #elif WIN32 # include "sys/win32/dark_theme.h" +#else +# ifdef GLIB +# include "sys/glib/dark_theme.h" +# endif #endif /* Weird quirks of this implementation: @@ -37,6 +41,10 @@ #elif defined(WIN32) if (win32::DarkThemeAvailable()) return win32::IsInDarkTheme(); +#else +# ifdef GLIB + return glib::IsInDarkTheme(); +# endif #endif return (theme == Themes::DARK); } @@ -68,13 +76,8 @@ } Themes Theme::GetCurrentOSTheme() const { -#ifdef MACOSX - if (osx::DarkThemeAvailable()) - return osx::IsInDarkTheme() ? Themes::DARK : Themes::LIGHT; -#elif defined(WIN32) - if (win32::DarkThemeAvailable()) - return win32::IsInDarkTheme() ? Themes::DARK : Themes::LIGHT; -#endif + return IsInDarkTheme() ? Themes::DARK : Themes::LIGHT; + /* Currently OS detection only supports Windows and macOS. Please don't be shy if you're willing to port it to other OSes (or desktop environments, or window managers) */