]> icculus.org git repositories - mikachu/openbox.git/blob - scripts/windowplacement.py
note about automake
[mikachu/openbox.git] / scripts / windowplacement.py
1 ############################################################################
2 ### Window placement algorithms, choose one of these and ebind it to the ###
3 ### ob.EventAction.PlaceWindow event.                                    ###
4 ############################################################################
5
6 import otk
7 import ob
8 import random
9
10 _rand = random.Random()
11
12 def random(data):
13     if not data.client: return
14     client_area = data.client.area()
15     frame_size = data.client.frame.size()
16     screen_area = ob.openbox.screen(data.screen).area()
17     width = screen_area.width() - (client_area.width() +
18                                    frame_size.left + frame_size.right)
19     height = screen_area.height() - (client_area.height() + 
20                                      frame_size.top + frame_size.bottom)
21     global _rand
22     x = _rand.randrange(screen_area.x(), width-1)
23     y = _rand.randrange(screen_area.y(), height-1)
24     data.client.move(x, y)
25
26 print "Loaded windowplacement.py"