From: Phil Smy Date: 2009-01-14T03:00:07+09:00 Subject: Re: getting info about attached displays Kyle Schmitt wrote: > On Tue, Jan 13, 2009 at 11:01 AM, Phil Smy wrote: >> Hi, >> I have a ruby daemon process that needs to get info about the monitors >> attached to the machine it is running on. Does anyone have any nice >> x-platform way of doing this? Barring that, how about some Windows >> calls? >> >> Thanks! >> -- >> Posted via http://www.ruby-forum.com/. > Phil, that's really more of a general unix (or DOS in the case of > windows) question. > > Still, for real OSes running X, xdpyinfo is a utility that provides > tons of info, including the number of attached screens... > > irb>%x[xdpyinfo][/number of screens: +[0-9]+/] > => "number of screens: 1" > > I'd suggest just running it into less, so you can get acquainted with > it's output. The man page sadly doesn't point you to useful C calls, > but the source should be decently documented if you want to grab it > from x.org or xfree86.org. > > --Kyle Thanks Kyle, Yes... I realise now that it is more OS based (though I still can't find the windows command for it!). The problem with xdpyinfo is that number of screens is actually NOT the number of displays. I have 2 monitors attached and I get the answer of 1, because I have one virtual desktop spanning the two. Anyway... off topic! Thanks again -- Posted via http://www.ruby-forum.com/.