3

notify-send displays a notification box with the message that you want to display on your own machine.

Is there a way to use notify-send to send a notification message to another user and display the message on his machine?

Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Debugger
  • 9,130
  • 17
  • 45
  • 53

1 Answers1

8

Bash can write to network sockets but can't listen/read. You could use GNU Netcat for this functionality.

A network notify-reader listening on port 10000 (no security):

#!/bin/bash

# no multiple connections: needs to improve
while true; do
    line="$(netcat -l -p 10000)"
    notify-send -- "Received Message" "$line"
done

And a corresponding client:

#!/bin/bash

host="$1"
echo "$@" >/dev/tcp/$host/10000

So you can send messages using

notify-sender.sh  your-host message
Matthias Braun
  • 32,039
  • 22
  • 142
  • 171
Jürgen Hötzel
  • 18,997
  • 3
  • 42
  • 58