]>
Dogcows Code - chaz/openbox/blob - python/windowplacement.py
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 ############################################################################
11 from random
import Random
14 """Place windows randomly around the screen."""
15 if ob
.Openbox
.state() == ob
.State
.Starting
: return
16 #if data.client.positionRequested(): return
17 cx
, cy
, cw
, ch
= client
.area()
18 sx
, sy
, sw
, sh
= ob
.Openbox
.screenArea(client
.desktop())
20 x
= Random().randrange(sx
, sw
- cw
- 1)
21 y
= Random().randrange(sy
, sh
- ch
- 1)
22 client
.setArea((x
, y
, cw
, ch
))
25 """Place windows in a cascading order from top-left to bottom-right."""
26 if ob
.Openbox
.state() == ob
.State
.Starting
: return
27 #if data.client.positionRequested(): return
28 cx
, cy
, cw
, ch
= client
.area()
29 sx
, sy
, sw
, sh
= ob
.Openbox
.screenArea(client
.desktop())
32 global _cascade_x
, _cascade_y
33 if _cascade_x
< sx
or _cascade_y
< sy
or \
34 _cascade_x
>= width
or _cascade_y
>= height
:
37 client
.setArea((_cascade_x
, _cascade_y
, cw
, ch
))
38 frame_size
= client
.frameSize()
39 _cascade_x
+= frame_size
[1]
40 _cascade_y
+= frame_size
[1]
45 export_functions
= random
, cascade
47 print "Loaded windowplacement.py"
This page took 0.03537 seconds and 4 git commands to generate.