]> Dogcows Code - chaz/openbox/blob - scripts/windowplacement.py
better historyplacement
[chaz/openbox] / scripts / windowplacement.py
1 ############################################################################
2 ### Window placement algorithms, choose one of these and ebind it to the ###
3 ### ob.EventAction.PlaceWindow event. ###
4 ### ###
5 ### Also see historyplacement.py for the history placement module which ###
6 ### provides an algorithm that can be used in place of, or alongside, ###
7 ### these. ###
8 ############################################################################
9
10 import otk
11 import ob
12 import random
13
14 _rand = random.Random()
15
16 def random(data):
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)
26 global _rand
27 x = _rand.randrange(screen_area.x(), width-1)
28 y = _rand.randrange(screen_area.y(), height-1)
29 data.client.move(x, y)
30
31 print "Loaded windowplacement.py"
This page took 0.037441 seconds and 4 git commands to generate.