Click to See Complete Forum and Search --> : send a wall message that pops up a konsole session in KDE


acid45
11-27-2008, 01:12 PM
Hey everyone,

I noticed that in Slackware, when I open a konsole session and su root and reboot the machine, another console session pops up and sends the reboot message.

I was wondering if I could do something similar with wall or talk.

bwkaz
11-28-2008, 11:05 AM
No.

wall and talk only allow sending messages to other terminals on the system. They do NOT allow starting up a new terminal emulator. They don't even know that X exists; they just write out the message you're sending to all the physical and virtual terminal devices that have someone logged into them. (Or all of the physical terminals on the system, depending on which program you're using.)

hlrguy
11-28-2008, 03:35 PM
Well, sort of. You can create a text message somewhere, then from terminal, you can start another one, passing along the command of "more <textfile>". You can (if you have permission) spawn the new xterm into any running X session.

It might help to know what/why you want to accomplish this. For every problem, someone has already tackled it, usually in an elegant way (unlike my kludge).

hlrguy

bwkaz
11-30-2008, 12:58 PM
Well, sure, there are a hundred different ways to do it using other programs. :p

(Just not "with wall or talk". That's what I get for focusing on the wrong part of the original post. :))

My probable favorite would be to spawn a terminal running some program that just sits and waits (perhaps cat). Then, because fork() returns the child's PID to the parent, you can poke around in /proc to find the process tree that ends at that cat process, and find where its stdin/stdout are going (by calling readlink() on /proc/<pid>/fd/[01]; both should be going to the same place). Then you can open that device and write to it or read from it, and the result will show up in the new terminal.

Of course, something much simpler would be simply shelling out to xmessage. ;)