]>
Dogcows Code - chaz/openbox/blob - python/windowplacement.py
afeff2ed489da4a2f5a1e7150bc40846afbc2737
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 if sw
- cw
- 1 <= 0: x
= 0
21 else: x
= Random().randrange(sx
, sw
- cw
- 1)
22 if (sh
- ch
- 1 <= 0: y
= 0
23 else: y
= Random().randrange(sy
, sh
- ch
- 1)
24 client
.setArea((x
, y
, cw
, ch
))
27 """Place windows in a cascading order from top-left to bottom-right."""
28 if ob
.Openbox
.state() == ob
.State
.Starting
: return
29 #if data.client.positionRequested(): return
30 cx
, cy
, cw
, ch
= client
.area()
31 sx
, sy
, sw
, sh
= ob
.Openbox
.screenArea(client
.desktop())
34 global _cascade_x
, _cascade_y
35 if _cascade_x
< sx
or _cascade_y
< sy
or \
36 _cascade_x
>= width
or _cascade_y
>= height
:
39 client
.setArea((_cascade_x
, _cascade_y
, cw
, ch
))
40 frame_size
= client
.frameSize()
41 _cascade_x
+= frame_size
[1]
42 _cascade_y
+= frame_size
[1]
47 export_functions
= random
, cascade
49 print "Loaded windowplacement.py"
This page took 0.036539 seconds and 4 git commands to generate.