give the debian pkg names
[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     print str(screen_area.x()) + " " + str(screen_area.y()) + " " + \
18           str(screen_area.width()) + " " + str(screen_area.height())
19     width = screen_area.width() - (client_area.width() +
20                                    frame_size.left + frame_size.right)
21     height = screen_area.height() - (client_area.height() + 
22                                      frame_size.top + frame_size.bottom)
23     global _rand
24     x = _rand.randrange(screen_area.x(), width-1)
25     y = _rand.randrange(screen_area.y(), height-1)
26     data.client.move(x, y)
27
28 print "Loaded windowplacement.py"