5

Here is what I am trying to do. Kids are on Ubuntu box watching movies, youtube, etc. I am on my windows box doing whatever. Since kids have headphones implanted into their ears, I want to log into terminal and send a broadcast message of some sort to them to get their attention or give them a message. I already know how to log into terminal remotely to work on the box while they are playing around.

I have seen a few options like "Wall" or "Write" but, those only seem to work on terminal logins. I can send messages to my test account logged into through the terminal but, nothing goes out to the local user sitting in front of the monitor.

What are my options? For the most part, I would like a window to pop up with whatever message I am trying to deliver that will interrupt what they are doing when youtube or whatever is full-screen.

Thoughts? Suggestions? Advice?

  • Do you know your kid's password ? – Sergiy Kolodyazhnyy Aug 25 '15 at 3:21
  • No, I do not. I could be a butthead and log them off, I know how to do that remotely. I only reserve that meanness for when they cop an attitude and get grounded from the PC for a while. – KC5SDY Aug 25 '15 at 3:23
  • Posted an answer , please review – Sergiy Kolodyazhnyy Aug 25 '15 at 4:08
  • How are you logging to the remote machine by the way? ssh? Else? – kos Aug 25 '15 at 8:13
  • SSH. I use Putty from my box to get in. – KC5SDY Aug 25 '15 at 14:08
1

Grant access

xhost +local:

or disable access control, clients can connect from any host (bad idea, but seems to be ok in your network)

xhost +

Now you can do this from your remote connection:

DISPLAY=:0 xmessage -center " THIS IS A TEST MESSAGE"

Bellow is a little demo. I have shared session between TTY1 and GUI terminal. As you can see, there's no environmental variable set for DISPLAY, thus that terminal is as if I was working in TTY1. The command above temporarily sets the DISPLAY variable, thus making xmessage appear on the xserver instance on that display.

enter image description here

I tried doing that same thing with notify-send however that didn't seem to work.

EDIT

xmessage is a bit small. What I'd prefer is to use zenity dialog. For instance,

DISPLAY=:0 zenity --info --text=" THIS IS ZENITY INFO DIALOG "

| improve this answer | |
  • This is exactly what I am looking for. I ran into a snag though. When running the xmessage command, I get:"Invalid MIT-MAGIC-COOKIE-1 Can't open display:0: – KC5SDY Aug 25 '15 at 4:22
  • What about zenity ? – Sergiy Kolodyazhnyy Aug 25 '15 at 4:24
  • When running the zenity command, I get "Invalid MIT-MAGIC-COOKIE-1 key ** (zenity:4200): WARNING *: Count not open X display Invalid MIT-MAGIC-COOKIE-1 key (zenity:4200): gtk-WARNING **: cannot open display: :0 – KC5SDY Aug 25 '15 at 4:25
  • Take a look: unix.stackexchange.com/a/199892/85039 – Sergiy Kolodyazhnyy Aug 25 '15 at 4:26
  • Ok. Hmmm.... Trying export DISPLAY=desktop:0 method, if I replace "desktop" with the IP address, I get a message saying, "Can't open display: 192.168.1.102. – KC5SDY Aug 25 '15 at 4:37
1

Since you want to create pop-up on their screen, it would be easiest to:

1) Start a program (I would use a Perl script) when your kids logon. Put it in the background. The Perl script should listen for a TCP connection on some unused port above 1024 and below 65536, say port 12345. When it receives a message (over TCP port 12345), it can generate the pop-up, and wait for the next line.

2) On Windows, use putty to connect to TCP port 12345 on the Ubuntu server, and type your message.

| improve this answer | |
  • Interesting. I like that idea. I do not know anything about putting together a script like that, much less getting it to run when they login. – KC5SDY Aug 25 '15 at 4:16
  • That's a nice idea, +1, however I'd be interested in seeing a Perl implementation of this as well, maybe you can add a very brief example just to showcase the method? – kos Aug 25 '15 at 8:06
0

If it’s a short simple message that you want, you could use notify-send. This will create a short-lived alert message in the top right of the screen (in the same style that Thunderbird uses to alert you to new mail, or Filezilla uses to alert you that a long-running operation is complete).

notify-send "message text here"

or

notify-send "title here" "message text here"

or, if you really want their attention,

notify-send "title here" "message text here" -i face-angry

which will put an angry face (there’s a surprise!) before the message. There are various icons you can use. To see the list available on your computer, enter ls /usr/share/icons/gnome/32x32/emotes/.

| improve this answer | |
  • This would be indeed a good solution, however IME specifying a DISPLAY value (at least over ssh) is necessary, I think you should add that – kos Aug 25 '15 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.