Add callscreen DWM plugin for incoming and active voice calls
This commit is contained in:
@@ -631,16 +631,20 @@ int calllog_plugin_init(const DwmHostApi* host) {
|
||||
int calllog_on_global_key(const DwmHostApi* host, KeySym keysym,
|
||||
unsigned int keycode, unsigned int state,
|
||||
int is_press) {
|
||||
(void)host;
|
||||
if (!is_press || state != 0) {
|
||||
return 0;
|
||||
}
|
||||
if (keysym == XF86XK_Phone || keysym == XF86XK_PickupPhone || keycode == 177) {
|
||||
if (isCallRingingFast()) {
|
||||
const char* const argv[] = {"sxmo_hook_pickup.sh", nullptr};
|
||||
if (host && host->spawn_command) {
|
||||
host->spawn_command(argv);
|
||||
} else {
|
||||
runAsyncArgv("sxmo_hook_pickup.sh");
|
||||
if (!sendPluginCommand("callscreen", "ACCEPT")) {
|
||||
runAsyncArgv("xcallscreen", "accept");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (isCallActiveOrRingingFast()) {
|
||||
if (!sendPluginCommand("callscreen", "OPEN")) {
|
||||
runAsyncArgv("xcallscreen");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@@ -655,9 +659,14 @@ int calllog_on_idle_key(const DwmHostApi* host, KeySym keysym,
|
||||
}
|
||||
if (keysym == XF86XK_Phone || keysym == XF86XK_PickupPhone || keycode == 177) {
|
||||
if (isCallRingingFast()) {
|
||||
const char* const argv[] = {"sxmo_hook_pickup.sh", nullptr};
|
||||
if (host->spawn_command) {
|
||||
host->spawn_command(argv);
|
||||
if (!sendPluginCommand("callscreen", "ACCEPT")) {
|
||||
runAsyncArgv("xcallscreen", "accept");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (isCallActiveOrRingingFast()) {
|
||||
if (!sendPluginCommand("callscreen", "OPEN")) {
|
||||
runAsyncArgv("xcallscreen");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user