-   Linux - Software (
-   -   Set Environment Variable within VNC Session? (

arew264 01-06-2008 04:47 PM

Set Environment Variable within VNC Session?
I have tightVNC set up within xinetd so that I can connect and get a KDM login screen, and from there start a KDE session as if I was in front of my box. It all works quite well, but there's no sound.
I've been working with pulseaudio for network sound, and I have it set up to the point that if I can set the environment variable PULSE_SERVER for the KDE session, sound will automagically work.
The problem is that I have to set PULSE_SERVER to the IP address of the VNC client. I have a wrapper script that xinetd calls that prints this IP address wherever I want and then starts tightVNC for me.
How should I set that variable once KDE begins to load? Do I have to put an entries in /home/[user]/.kde/autostart? Is there a better way that would make it apply to all users? Can I just have KDM set it somehow?

I have found that I need to set the variable in KDM's Xsession file, which actually starts whatever session the user has requested. The problem is that somehow I have to save what I should set it to. I can't have KDM pass my needed value as an argument to Xsession; that would be most convenient.
My next thought would be to have a queue setup in /tmp where I just append IP addresses to the file and remove then from the top when they're used, but that wouldn't work if User A logs in to VNC, User B logs in to VNC and User B enters his username and password first.

The wall I'm hitting is that I can get the remote IP when I start VNC, but VNC just gets connected to KDM and doesn't actually start it, so I can't get the remote IP anywhere within the KDM session.
I can store the remote IP in a file and have KDM retrieve it when it starts a session though, that might work.
Any suggestions?

All times are GMT -5. The time now is 01:05 AM.