Compare commits
2 Commits
06418b4cf4
...
a67b787386
| Author | SHA1 | Date | |
|---|---|---|---|
| a67b787386 | |||
| 86ecd128f8 |
@@ -6,10 +6,10 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <print>
|
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
|
#include <gio/gio.h>
|
||||||
#include <lunasvg.h>
|
#include <lunasvg.h>
|
||||||
#include <mini/ini.h>
|
#include <mini/ini.h>
|
||||||
|
|
||||||
@@ -90,6 +90,35 @@ static auto kde_get_theme() -> std::string const
|
|||||||
return {};
|
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
|
static auto get_current_icon_theme() -> std::optional<std::string> const
|
||||||
{
|
{
|
||||||
auto de { detect_desktop_environment() };
|
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()) {
|
if (auto const t = kde_get_theme(); !t.empty()) {
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (auto const t = other_get_theme(); !t.empty()) {
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|||||||
Reference in New Issue
Block a user