Add unified Xresources theme engine, Default.xth export, and xthemes manager plugin

This commit is contained in:
Luxferre committed 2026-10-21 20:36:27 +03:00
1 parent f615c6ddbe
commit a31595070c
60 files changed
+3692 -419

No files matched your search

+30
View File
@@ -8,6 +8,8 @@
#define _EVDEVK(_v) (0x10081000 + (_v))
#endif
#include "theme.h"
#include <algorithm>
#include <cctype>
#include <csignal>
@@ -69,6 +71,7 @@ constexpr const char* kIconInfo = "\xef\x81\x9a"; // U+F05A info-circle
constexpr const char* kIconRefresh = "\xef\x80\xa1"; // U+F021 refresh
constexpr const char* kIconSort = "\xef\x83\x9c"; // U+F0DC sort
constexpr const char* kIconEye = "\xef\x81\xae"; // U+F06E eye/view
constexpr const char* kIconPalette = "\xef\x87\xbc"; // U+F1FC paint-brush / theme
inline int64_t nowMs() {
struct timespec ts {};
@@ -962,6 +965,7 @@ inline void closeOtherPlugins(const char* selfPluginName) {
{"xsms.pid", "sms"},
{"xfiles.pid", "files"},
{"xcamera.pid", "camera"},
{"xthemes.pid", "themes"},
};
for (const auto& p : kAllPlugins) {
if (selfPluginName && std::strcmp(p.name, selfPluginName) == 0) {
@@ -976,6 +980,32 @@ inline void closeOtherPlugins(const char* selfPluginName) {
}
}
inline void broadcastThemeReload(const char* selfPluginName = nullptr) {
static const char* kPlugins[] = {
"dmenu",
"xdrawer",
"dialer",
"calllog",
"contacts",
"sms",
"files",
"camera",
"themes",
};
for (const char* name : kPlugins) {
if (selfPluginName && std::strcmp(name, selfPluginName) == 0) {
continue;
}
std::string fifoPath = getPluginFifoPath(name);
int fd = ::open(fifoPath.c_str(), O_WRONLY | O_NONBLOCK | O_CLOEXEC);
if (fd >= 0) {
(void)::write(fd, "RELOAD_THEME\n", 13);
::close(fd);
}
}
runAsyncCmd("pkill -USR1 -x st >/dev/null 2>&1");
}
inline std::string getModemLogDirPath() {
const char* env = std::getenv("SXMO_LOGDIR");
if (env && env[0]) {