I m trying to make notify-send passing messages to host and create a notification on my desktop from my local-machine.
But its not that simple :(.
My Operation system is Ubuntu and vm machine's Debian.
I know that containers communicating with "bridge" in docker or via "volume"
- My approche was to install dbus-monitor,libnotify-bin on virtual machine
- Write to file called
notofications
via demon who intercept notify-send messages. - Than have some sort of deamon on host machine which "watch" that file and everytime a new line of text is being added to that from virtual machine, deamon triggers launch a command
notify-send "that line"
Usecase:
I work with docker container workspace.
I m developing websites and I found it pretty annoying that when I m "live building" script and it fails I dont get a notification.
So I wanted to get one with having same environment accross my teamates using ddev
Problem:
To intercept and write to file I tried to use dbus but:
my dbus-monitor script:
#!/bin/bash
file=notifications
dbus-monitor "interface='org.freedesktop.Notifications'" |\
grep --line-buffered "string" |\
grep --line-buffered -e method -e ":" -e '""' -e urgency -e notify -v |\
grep --line-buffered '.*(?=string)|(?<=string).*' -oPi |\
grep --line-buffered -v '^\s*$' |\
xargs -I '{}' echo {} >> $file
seemss not to work without display configuration. And I have no idea how to fix that.
Failed to open connection to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
In order to work I need to find solution to somehow "watch"
notify-send
command and intercept the message. Please help :)