I am currently working on building a php command line app and I make use of notify-send
to send notification in my Ubuntu 17.10
which now comes with gnome.
The notifications look fine and as they should when I manually run the cli app in terminal. (at the top, in notification center)
but when the same app is run through a cron job the notificaiton looks completely different and is displayed in a different location! (top right)
I am calling the notify-send in my app using exec('notify-send tas)
The problem I have with the slightly different looking notification is I can not click on the hyper-links! while the other one supports clicking on hyper-links and then it opens up web page.
What is going wrong here?
After a lot of research, trial, and error. I arrived at the solution below!.
The PHP code will call a shell script which will actually send the
libnotify
message.The bash script:
The PHP Code:
P.S: This was used in a command-line app that sends a system notification whenever a new question on stackoverflow.com is posted! (the questions that match your tags)
You can check it out here: https://kerneldev.com/2017/12/27/so-notify-a-stack-overflow-question-notifier/