1 ############################################################################
2 ### Window placement algorithms, choose one of these and ebind it to the ###
3 ### ob.EventAction.PlaceWindow event. ###
5 ### Also see historyplacement.py for the history placement module which ###
6 ### provides an algorithm that can be used in place of, or alongside, ###
8 ############################################################################
14 _rand = random.Random()
17 if not data.client: return
18 if data.client.positionRequested(): return
19 client_area = data.client.area()
20 frame_size = data.client.frame.size()
21 screen_area = ob.openbox.screen(data.screen).area()
22 width = screen_area.width() - (client_area.width() +
23 frame_size.left + frame_size.right)
24 height = screen_area.height() - (client_area.height() +
25 frame_size.top + frame_size.bottom)
27 x = _rand.randrange(screen_area.x(), width-1)
28 y = _rand.randrange(screen_area.y(), height-1)
29 data.client.move(x, y)
31 print "Loaded windowplacement.py"