Compare commits

...

2 Commits

Author SHA1 Message Date
a67b787386 Oops forgot I disabled an if
Signed-off-by: Slendi <slendi@socopon.com>
2025-10-15 03:41:19 +03:00
86ecd128f8 Gnome moment
Signed-off-by: Slendi <slendi@socopon.com>
2025-10-15 03:41:02 +03:00

View File

@@ -6,10 +6,10 @@
#include <cstdlib>
#include <cstring>
#include <filesystem>
#include <print>
#include <ranges>
#include <stdexcept>
#include <gio/gio.h>
#include <lunasvg.h>
#include <mini/ini.h>
@@ -90,6 +90,35 @@ static auto kde_get_theme() -> std::string const
return {};
}
static auto other_get_theme() -> std::string
{
char const *schema_id { "org.gnome.desktop.interface" };
char const *key { "icon-theme" };
GSettingsSchemaSource *src { g_settings_schema_source_get_default() };
if (!src)
return {};
GSettingsSchema *schema { g_settings_schema_source_lookup(
src, schema_id, TRUE) };
if (!schema)
return {};
GSettings *settings { g_settings_new_full(schema, nullptr, nullptr) };
g_settings_schema_unref(schema);
if (!settings)
return {};
gchar *cstr { g_settings_get_string(settings, key) };
g_object_unref(settings);
if (!cstr)
return {};
std::string theme { cstr };
g_free(cstr);
return theme;
}
static auto get_current_icon_theme() -> std::optional<std::string> const
{
auto de { detect_desktop_environment() };
@@ -100,6 +129,10 @@ static auto get_current_icon_theme() -> std::optional<std::string> const
if (auto const t = kde_get_theme(); !t.empty()) {
return t;
}
} else {
if (auto const t = other_get_theme(); !t.empty()) {
return t;
}
}
return std::nullopt;