Perform actions based on notification content

From Lucca's Wiki
Revision as of 00:01, 6 October 2025 by Lucka (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

I put together this script based on some info I found on a forum to execute bash 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