Page 1 of 1

[TUTORIAL] XFCE Notifications

Posted: Saturday 13 November 2021 20:05
by Jieffe
I am a long-time Linux user and my desktop of choice is XFCE4 (running under Debian).
I had a frustrating afternoon trying to send notifications from Domoticz to the XFCE desktop, but it is finally working.

On your Domoticz server, you need to install sshpass

Code: Select all

sudo apt install sshpass
On your XFCE workstation, the SSH daemon must be installed and running.

Code: Select all

sudo apt install ssh
In your domoticz/script directory, create a file "xfce-notify.sh" and make it executable

Code: Select all

#!/bin/bash
sshpass -p YOUR_PASSWORD ssh YOUR_USERNAME@SERVER_ADDRESS DISPLAY=:0 notify-send "Domoticz" \"$1\"
exit 0
In Domoticz, go to Setup/Settings/Notifications/CUSTOM HTTP/ACTION. Check "Enable" and fill "URL/ACTION" with

Code: Select all

script://xfce-notify.sh #MESSAGE
What the script does is opening an SSH session from the Domoticz server to your workstation and then using notify-send to access XFCE's notification system.
For a reason I can't explain, SSH login using key authentication doesn't work (it is working if I manually start the script from the command line), hence the use of sshpass.
Note also the escape character "\" around "$1". Without it, notify-send throws an "invalid arguments number" error.