Perform actions based on notification content: Difference between revisions

From Lucca's Wiki
Jump to navigationJump to search
Created page with " #!/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"
 
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.
  #!/usr/bin/env bash
  #!/usr/bin/env bash



Revision as of 00:00, 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