Sunday, April 13, 2008

Someone wondered if it was possible to get the resolutions of screens in Xinerama/TwinView, so I decided to do a proof-of-concept in Python using PyGTK. Here it is:

# coding=utf8
import pygtk
import gtk
from os import environ

display = gtk.gdk.Display(environ['DISPLAY'])
if display:
for i in xrange(display.get_n_screens()):
screen = display.get_screen(i)
for j in xrange(screen.get_n_monitors()):
geo = screen.get_monitor_geometry(i)
print 'Screen %d/%d %dx%d' % (i, j, geo.width, geo.height)
print 'Unable to get display:', environ['DISPLAY']
% python
Screen 0/0 1400x1050
Screen 0/1 1400x1050
Post a Comment