feat(dwm): add dynamic plugin system with xdrawer, dialer, and calllog plugins

This commit is contained in:
Luxferre
2026-10-21 11:11:45 +03:00
parent 7b7ae1dcc5
commit 0a02400505
28 changed files with 2589 additions and 22 deletions
+32 -1
View File
@@ -14,6 +14,8 @@
#include <pango/pango.h>
#include <pango/pangoxft.h>
#include "../sxmo-dwm/dwm_plugin.h"
#include <algorithm>
#include <cmath>
#include <csignal>
@@ -433,7 +435,8 @@ class PhoneController {
} // namespace
int main() {
static int xdrawer_run_main(int, char**) {
gRunning = 1;
int64_t startMs = nowMs();
std::string pidPath = getRuntimeFile("xdrawer.pid");
std::string startPath = getRuntimeFile("xdrawer.start");
@@ -870,3 +873,31 @@ int main() {
::unlink(pidPath.c_str());
return 0;
}
static int xdrawer_plugin_init(const DwmHostApi*) {
return 0;
}
static int xdrawer_on_softkey_chord(const DwmHostApi* host) {
if (host && host->spawn_plugin) {
host->spawn_plugin("xdrawer", nullptr);
return 1;
}
return 0;
}
extern "C" __attribute__((visibility("default"))) const DwmPlugin dwm_plugin_entry = {
DWM_PLUGIN_API_VERSION,
"xdrawer",
"Global phone hardware controls drawer (softkey chord)",
xdrawer_plugin_init,
nullptr,
xdrawer_on_softkey_chord,
nullptr,
nullptr,
xdrawer_run_main
};
int main(int argc, char** argv) {
return xdrawer_run_main(argc, argv);
}