-   Linux - General (
-   -   Determining the Active Virtual Console (

MasterPi 04-30-2005 02:21 PM

Determining the Active Virtual Console
This may be a really stupid question but does anyone know how to tell which virtual console / screen is currently being displayed on screen by a script. I'm writing a cron script to do some things when it detects a network connection but some of the things (like running evolution) depend on the DISPLAY being set. i'm currently just using "who" and awking for my username and the console, but it would be nice to know which display is actually active, since i sometimes log in on more than one.

homey 04-30-2005 06:34 PM

Run the command: fgconsole
7 is for X
1-6 is cli

MasterPi 05-02-2005 02:39 PM

thank you! i knew it was probably something simple. one more thing: any way to determine the X display from this?

homey 05-02-2005 02:51 PM

Do you mean something like ...

MasterPi 05-02-2005 05:31 PM

umm, no... if you read the first post you would see that i was trying to set DISPLAY. i was wondering if there was a way to determine which X screen was running on a given VC

neo 05-03-2005 12:11 AM

xdpyinfo | grep display

All times are GMT -5. The time now is 06:59 AM.