feat(dwm): add dynamic plugin system with xdrawer, dialer, and calllog plugins
This commit is contained in:
+32
-1
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user