Perform actions based on notification content: Difference between revisions
From Lucca's Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
I put together this script based on some info I found on a forum to execute commands when notifications are received that contain specific text. | I put together this script based on some info I found on a forum to execute commands when notifications are received that contain specific text. | ||
#!/usr/bin/env bash | #!/usr/bin/env bash | ||
| Line 12: | Line 13: | ||
mpv "${HOME}/share/audio/dark_souls_2_parry.mp3" # replace with your command | mpv "${HOME}/share/audio/dark_souls_2_parry.mp3" # replace with your command | ||
done | done | ||
<hr> | |||
Sources: https://superuser.com/questions/1847019/kde-plasma-parse-tray-notifications | |||
Revision as of 00:01, 6 October 2025
I put together this script based on some info I found on a forum to execute commands when notifications are received that contain specific text.
#!/usr/bin/env bash
n1='buff luigi'
n2='ripped mario'
dbus-monitor "interface=org.freedesktop.Notifications" |
grep -i -e "$n1" -e "$n2" --line-buffered |
while read found_line; do
echo "$found_line"
mpv "${HOME}/share/audio/dark_souls_2_parry.mp3" # replace with your command
done
Sources: https://superuser.com/questions/1847019/kde-plasma-parse-tray-notifications