Fix background call hangup and end calls on screen lock or lid close
This commit is contained in:
1 parent
c7cdde6734
commit
0c352f0a10
55 files changed
+391
-120
No files matched your search
@@ -25,6 +25,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <ctime>
|
||||
#include <dirent.h>
|
||||
#include <fcntl.h>
|
||||
#include <fstream>
|
||||
#include <poll.h>
|
||||
@@ -1244,6 +1245,33 @@ static int xdrawer_run_main(int argc, char** argv) {
|
||||
|
||||
if (sym == XF86XK_PowerOff || ev.xkey.keycode == 124) {
|
||||
hideWindow(false);
|
||||
bool callActive = (::access("/tmp/sxmo_call_ringing", F_OK) == 0 ||
|
||||
::access("/tmp/sxmo_active_call", F_OK) == 0);
|
||||
if (!callActive) {
|
||||
std::string cdir = getRuntimeFile("sxmo_calls");
|
||||
DIR* d = ::opendir(cdir.c_str());
|
||||
if (d) {
|
||||
struct dirent* ent;
|
||||
while ((ent = ::readdir(d)) != nullptr) {
|
||||
if (ent->d_name[0] != '.' && ent->d_name[0] != '\0') {
|
||||
callActive = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
::closedir(d);
|
||||
}
|
||||
}
|
||||
if (callActive) {
|
||||
int cfd = ::open("/tmp/dwm_plugin_callscreen.fifo",
|
||||
O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (cfd >= 0) {
|
||||
(void)::write(cfd, "HANGUP\n", 7);
|
||||
::close(cfd);
|
||||
} else {
|
||||
runAsyncCmd("xcallscreen hangup >/dev/null 2>&1");
|
||||
}
|
||||
break;
|
||||
}
|
||||
int ffd = ::open("/tmp/dwm_plugin_dmenu.fifo",
|
||||
O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||
if (ffd >= 0) {
|
||||
|
||||
Reference in new issue
Block a user