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:
screensize.py
#!/usr/bin/python
# coding=utf8
import pygtk
pygtk.require('2.0')
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)
else:
print 'Unable to get display:', environ['DISPLAY']
% python screensize.py
Screen 0/0 1400x1050
Screen 0/1 1400x1050
No comments:
Post a Comment