This python code show how to do it:
>>> import gtk >>> dgd=gtk.gdk.display_get_default() >>> gsd=dgd.get_default_screen() >>> height=gsd.get_height() >>> width=gsd.get_width() >>> print "height=",height,"width=",width height= 1024 width= 1280
Quite simply ...