swaync/feedbackd: activate ringer on incoming dino call
This commit is contained in:
parent
254da7e17b
commit
81c16ec479
|
@ -23,6 +23,32 @@ in
|
||||||
|
|
||||||
# N.B.: feedbackd will load ~/.config/feedbackd/themes/default.json by default
|
# N.B.: feedbackd will load ~/.config/feedbackd/themes/default.json by default
|
||||||
# - but using that would forbid `parent-theme = "default"`
|
# - but using that would forbid `parent-theme = "default"`
|
||||||
|
# the default theme ships support for these events:
|
||||||
|
# - alarm-clock-elapsed
|
||||||
|
# - alarm-clock-elapsed
|
||||||
|
# - battery-caution
|
||||||
|
# - bell-terminal
|
||||||
|
# - button-pressed
|
||||||
|
# - button-released
|
||||||
|
# - camera-focus
|
||||||
|
# - camera-shutter
|
||||||
|
# - message-missed-email
|
||||||
|
# - message-missed-instant
|
||||||
|
# - message-missed-notification
|
||||||
|
# - message-missed-sms
|
||||||
|
# - message-new-email
|
||||||
|
# - message-new-instant
|
||||||
|
# - message-new-sms
|
||||||
|
# - message-sent-instant
|
||||||
|
# - phone-failure
|
||||||
|
# - phone-hangup
|
||||||
|
# - phone-incoming-call
|
||||||
|
# - phone-missed-call
|
||||||
|
# - phone-outgoing-busy
|
||||||
|
# - screen-capture
|
||||||
|
# - theme-demo
|
||||||
|
# - timeout-completed
|
||||||
|
# - window-close
|
||||||
fs.".config/feedbackd/themes/proxied.json".symlink.text = builtins.toJSON {
|
fs.".config/feedbackd/themes/proxied.json".symlink.text = builtins.toJSON {
|
||||||
name = "proxied";
|
name = "proxied";
|
||||||
parent-theme = "default";
|
parent-theme = "default";
|
||||||
|
@ -40,6 +66,12 @@ in
|
||||||
type = "Sound";
|
type = "Sound";
|
||||||
effect = "message-new-instant";
|
effect = "message-new-instant";
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
# i guess we aren't actually inheriting from the default theme?
|
||||||
|
event-name = "phone-incoming-call";
|
||||||
|
type = "Sound";
|
||||||
|
effect = "phone-incoming-call";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -21,24 +21,49 @@ let
|
||||||
name = "swaync-fbcli";
|
name = "swaync-fbcli";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
config.sane.programs.feedbackd.package
|
config.sane.programs.feedbackd.package
|
||||||
|
pkgs.procps # for pkill
|
||||||
cfg.package
|
cfg.package
|
||||||
];
|
];
|
||||||
text = ''
|
text = ''
|
||||||
# if in Do Not Disturb, don't do any feedback
|
# if in Do Not Disturb, don't do any feedback
|
||||||
# TODO: better solution is to actually make use of feedbackd profiles.
|
# TODO: better solution is to actually make use of feedbackd profiles.
|
||||||
# i.e. set profile to `quiet` when in DnD mode
|
# i.e. set profile to `quiet` when in DnD mode
|
||||||
if [ "$(swaync-client --get-dnd)" = "true" ]; then
|
if [ "$SWAYNC_URGENCY" != "Critical" ] && [ "$(swaync-client --get-dnd)" = "true" ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# kill children if killed, to allow that killing this parent process will end the real fbcli call
|
||||||
|
cleanup() {
|
||||||
|
echo "aborting fbcli notification (PID $child)"
|
||||||
|
pkill -P "$child"
|
||||||
|
exit 0 # exit cleanly to avoid swaync alerting a script failure
|
||||||
|
}
|
||||||
|
trap cleanup SIGINT SIGQUIT SIGTERM
|
||||||
|
|
||||||
# feedbackd stops playback when the caller exits
|
# feedbackd stops playback when the caller exits
|
||||||
# and fbcli will exit immediately if it has no stdin.
|
# and fbcli will exit immediately if it has no stdin.
|
||||||
# so spoof a stdin:
|
# so spoof a stdin:
|
||||||
true | fbcli "$@"
|
/bin/sh -c "true | fbcli $*" &
|
||||||
|
child=$!
|
||||||
|
wait
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
fbcli = "${fbcli-wrapper}/bin/swaync-fbcli";
|
fbcli = "${fbcli-wrapper}/bin/swaync-fbcli";
|
||||||
|
|
||||||
|
# we do this because swaync's exec naively splits the command on space to produce its argv, rather than parsing the shell.
|
||||||
|
# [ "pkill" "-f" "fbcli" "--event" ... ] -> breaks pkill
|
||||||
|
# [ "pkill" "-f" "fbcli --event ..." ] -> is what we want
|
||||||
|
fbcli-stop-wrapper = pkgs.writeShellApplication {
|
||||||
|
name = "fbcli-stop";
|
||||||
|
runtimeInputs = [
|
||||||
|
pkgs.procps # for pkill
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
pkill -e -f "${fbcli} $*"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
fbcli-stop = "${fbcli-stop-wrapper}/bin/fbcli-stop";
|
||||||
|
|
||||||
systemctl-toggle = pkgs.writeShellApplication {
|
systemctl-toggle = pkgs.writeShellApplication {
|
||||||
name = "systemctl-toggle";
|
name = "systemctl-toggle";
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
|
@ -152,9 +177,21 @@ in
|
||||||
# - SWAYNC_SUMMARY
|
# - SWAYNC_SUMMARY
|
||||||
sound-im = {
|
sound-im = {
|
||||||
# trigger notification sound on behalf of these IM clients.
|
# trigger notification sound on behalf of these IM clients.
|
||||||
# TODO: dispatch calls separately!
|
|
||||||
exec = "${fbcli} --event proxied-message-new-instant";
|
exec = "${fbcli} --event proxied-message-new-instant";
|
||||||
app-name = "(Chats|Dino|discord|Element)";
|
app-name = "(Chats|Dino|discord|Element)";
|
||||||
|
body = "^(?!Incoming call).*$"; #< don't match Dino Incoming calls
|
||||||
|
};
|
||||||
|
sound-call = {
|
||||||
|
exec = "${fbcli} --event phone-incoming-call -t 20";
|
||||||
|
app-name = "Dino";
|
||||||
|
body = "^Incoming call$";
|
||||||
|
};
|
||||||
|
sound-call-end = {
|
||||||
|
# pkill will kill all processes matching -- not just the first
|
||||||
|
exec = "${fbcli-stop} --event phone-incoming-call -t 20";
|
||||||
|
app-name = "Dino";
|
||||||
|
body = "^Incoming call$";
|
||||||
|
run-on = "action";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
notification-visibility = {
|
notification-visibility = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user