Add callscreen DWM plugin for incoming and active voice calls
This commit is contained in:
1 parent
cbac6743bc
commit
6e58218e10
38 files changed
+2120
-38
No files matched your search
@@ -72,6 +72,12 @@ 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
|
||||
constexpr const char* kIconSpeaker = "\xef\x80\xa8"; // U+F028 speaker
|
||||
constexpr const char* kIconEarpiece = "\xef\x8a\xa0"; // U+F2A0 earpiece
|
||||
constexpr const char* kIconSoundOff = "\xef\x91\xa6"; // U+F466 mute
|
||||
constexpr const char* kIconMicOn = "\xf3\xb0\x8d\xac"; // U+F036C mic on
|
||||
constexpr const char* kIconMicOff = "\xf3\xb0\x8d\xad"; // U+F036D mic off
|
||||
constexpr const char* kIconRecord = "\xef\x84\x91"; // U+F111 circle / record dot
|
||||
|
||||
inline int64_t nowMs() {
|
||||
struct timespec ts {};
|
||||
@@ -211,7 +217,37 @@ inline bool isCallRingingFast() {
|
||||
}
|
||||
std::string ringPidFile = getRuntimeFile("sxmo.ring.pid");
|
||||
int pid = readIntFile(ringPidFile, -1);
|
||||
return (pid > 0 && ::kill(pid, 0) == 0);
|
||||
if (pid > 0 && ::kill(pid, 0) == 0) {
|
||||
return true;
|
||||
}
|
||||
if (::access("/tmp/sxmo_call_ringing", F_OK) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool isCallActiveOrRingingFast() {
|
||||
if (isCallRingingFast()) {
|
||||
return true;
|
||||
}
|
||||
if (::access("/tmp/sxmo_active_call", F_OK) == 0) {
|
||||
return true;
|
||||
}
|
||||
std::string callsDir = getRuntimeFile("sxmo_calls");
|
||||
DIR* d = ::opendir(callsDir.c_str());
|
||||
if (!d) {
|
||||
return false;
|
||||
}
|
||||
bool found = false;
|
||||
struct dirent* ent;
|
||||
while ((ent = ::readdir(d)) != nullptr) {
|
||||
if (ent->d_name[0] != '.' && ent->d_name[0] != '\0') {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
::closedir(d);
|
||||
return found;
|
||||
}
|
||||
|
||||
struct FileStamp {
|
||||
@@ -299,7 +335,8 @@ inline void runAsyncCmd(const std::string& cmd) {
|
||||
|
||||
inline void runAsyncArgv(const char* prog,
|
||||
const char* arg1 = nullptr,
|
||||
const char* arg2 = nullptr) {
|
||||
const char* arg2 = nullptr,
|
||||
const char* arg3 = nullptr) {
|
||||
pid_t pid = ::fork();
|
||||
if (pid == 0) {
|
||||
::setsid();
|
||||
@@ -312,7 +349,13 @@ inline void runAsyncArgv(const char* prog,
|
||||
::close(nullfd);
|
||||
}
|
||||
}
|
||||
if (arg1 && arg2) {
|
||||
if (arg1 && arg2 && arg3) {
|
||||
execlp(prog, prog, arg1, arg2, arg3, static_cast<char*>(nullptr));
|
||||
std::string localBin = std::string("/home/user/.local/bin/") + prog;
|
||||
execl(localBin.c_str(), prog, arg1, arg2, arg3, static_cast<char*>(nullptr));
|
||||
std::string usrBin = std::string("/usr/bin/") + prog;
|
||||
execl(usrBin.c_str(), prog, arg1, arg2, arg3, static_cast<char*>(nullptr));
|
||||
} else if (arg1 && arg2) {
|
||||
execlp(prog, prog, arg1, arg2, static_cast<char*>(nullptr));
|
||||
std::string localBin = std::string("/home/user/.local/bin/") + prog;
|
||||
execl(localBin.c_str(), prog, arg1, arg2, static_cast<char*>(nullptr));
|
||||
@@ -949,6 +992,9 @@ inline void placePhoneCall(const std::string& rawNumber) {
|
||||
if (num.empty()) {
|
||||
return;
|
||||
}
|
||||
if (!sendPluginCommand("callscreen", "OUTGOING - " + num)) {
|
||||
runAsyncArgv("xcallscreen", "outgoing", "-", num.c_str());
|
||||
}
|
||||
runAsyncArgv("sxmo_modemdial.sh", num.c_str());
|
||||
}
|
||||
|
||||
@@ -961,6 +1007,7 @@ inline void closeOtherPlugins(const char* selfPluginName) {
|
||||
{"xdrawer.pid", "xdrawer"},
|
||||
{"xdialer.pid", "dialer"},
|
||||
{"xcalllog.pid", "calllog"},
|
||||
{"xcallscreen.pid", "callscreen"},
|
||||
{"xcontacts.pid", "contacts"},
|
||||
{"xsms.pid", "sms"},
|
||||
{"xfiles.pid", "files"},
|
||||
@@ -986,6 +1033,7 @@ inline void broadcastThemeReload(const char* selfPluginName = nullptr) {
|
||||
"xdrawer",
|
||||
"dialer",
|
||||
"calllog",
|
||||
"callscreen",
|
||||
"contacts",
|
||||
"sms",
|
||||
"files",
|
||||
|
||||
Reference in new issue
Block a user