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 ############################################################################
10 ##############################################################################
11 ### Options for the windowplacement module: ###
13 # ignore_requested_positions - When true, the placement algorithm will ###
14 ### attempt to place windows even when they ###
15 ### request a position (like XMMS). ###
16 ignore_requested_positions
= 0 ###
18 ##############################################################################
24 _rand
= random
.Random()
27 if not data
.client
: return
28 if not ignore_requested_positions
:
29 if data
.client
.positionRequested(): return
30 client_area
= data
.client
.area()
31 frame_size
= data
.client
.frame
.size()
32 screen_area
= ob
.openbox
.screen(data
.screen
).area()
33 width
= screen_area
.width() - (client_area
.width() +
34 frame_size
.left
+ frame_size
.right
)
35 height
= screen_area
.height() - (client_area
.height() +
36 frame_size
.top
+ frame_size
.bottom
)
38 x
= _rand
.randrange(screen_area
.x(), width
-1)
39 y
= _rand
.randrange(screen_area
.y(), height
-1)
40 data
.client
.move(x
, y
)
42 print "Loaded windowplacement.py"