2

here is my code:

roroco@roroco ~/Dropbox/rbs/ro_wemedia $ time sudo -u root notify-send 'prpr'

real    0m0.033s
user    0m0.008s
sys 0m0.012s

roroco@roroco ~/Dropbox/rbs/ro_wemedia $ time sudo -u roroco /usr/bin/notify-send "prpr"

real    0m6.044s
user    0m0.016s
sys 0m0.016s
roroco@roroco ~/Dropbox/rbs/ro_wemedia $ time /usr/bin/notify-send "prpr"

real    0m0.110s
user    0m0.004s
sys 0m0.008s

see above output, when i use sudo -u roroco notify-send 'prpr', the time is long, what cause it?

here is my notify-send version

roroco@roroco ~/Dropbox/rbs/ro_wemedia $ notify-send -v
notify-send 0.7.6
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
chikadance
  • 3,591
  • 4
  • 41
  • 73

2 Answers2

2

solution: make sure 3 env vars exist

to me, it's

sudo -u roroco DISPLAY=:0.0 DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-L9d2ku9CfF" XAUTHORITY=/home/roroco/.Xauthority notify-send 'prpr'

you can get env var value with echo $env-name

chikadance
  • 3,591
  • 4
  • 41
  • 73
0

For me, using vagrant, I needed to allow port 2250 in my client's firewall (iptables) using:

iptables -A INPUT  -p tcp     --sport  2250 -j ACCEPT #notify-send
iptables -A OUTPUT -p tcp     --dport  2250 -j ACCEPT #notify-send
Redzarf
  • 2,578
  • 4
  • 30
  • 40