How to center a GNOME pop-up notification?
Question: To display a GNOME pop-up notification at (200,400) on the screen (using
Python):

    
    
    import pynotify
    
    n = pynotify.Notification("This is my title", "This is my description")
    n.set_hint('x', 200)
    n.set_hint('y', 400)
    n.show()
    

I'm a gtk noob. How can I make this Notification show up centered on the
screen, or at the bottom-center of the screen?

Perhaps my question should be "what Python snippet gets me the Linux screen
dimensions?", and I'll plug those into set_hint() as appropriate.


Answer: Since you're using GNOME, here's the GTK way of getting the screen resolution

    
    
    import gtk.gdk
    import pynotify
    
    n = pynotify.Notification("This is my title", "This is my description")
    n.set_hint('x', gtk.gdk.screen_width()/2.)
    n.set_hint('y', gtk.gdk.screen_height()/2.)
    n.show()
    

