Plugin for Profanity to launch a custom shell command when a message is received
-
Download the script
-
Launch Profanity
-
Install the plugin with the following command
/plugins install ~/profanity-notifycmd/notifycmd.py
/notifycmd on
/notifycmd off
/notifycmd active
/notifycmd rooms on|off|mention
Default: mention
on: Runs for all messages
mention: Run only for messages that contain your nick
off`: Don't run in rooms
/notifycmd command <command>
Set command to execute. You can use the following markers:
- %s -> sender
- %m -> message
- %% -> literal %
Warning: You can't use single quotes around markers in commands, because the markers get converted into shell variables. So a command like this echo "%s: %m>>~/log
will actually result in senderreplace='<sender>';messagereplace='<message>';echo "${senderreplace}: ${messagereplace}" >> ~/log
. This is for security reasons and prevents remote code execution.
You'll need Termux:API and the termux-api package (apt install termux-api
).
/notifycmd command termux-notification -t 'Profanity: %s says:' -c '%m' --vibrate 500,100,500
/notifycmd plugin command set to: echo '%m' | mutt -s 'New message from %s' [email protected]