]>
Dogcows Code - chaz/openbox/blob - scripts/builtins.py
1 ###########################################################################
2 ### Functions that can be used as callbacks for mouse/keyboard bindings ###
3 ###########################################################################
6 """Closes the window on which the event occured"""
7 client
= Openbox_findClient(openbox
, data
.window())
8 if client
: OBClient_close(client
)
11 """Focuses the window on which the event occured"""
12 client
= Openbox_findClient(openbox
, data
.window())
14 OBClient_focus(client
)
17 """Moves the window interactively. This should only be used with
19 client
= Openbox_findClient(openbox
, data
.window())
22 dx
= data
.xroot() - data
.pressx()
23 dy
= data
.yroot() - data
.pressy()
24 OBClient_move(client
, data
.press_clientx() + dx
, data
.press_clienty() + dy
)
27 """Resizes the window interactively. This should only be used with
29 client
= Openbox_findClient(openbox
, data
.window())
34 dx
= data
.xroot() - px
35 dy
= data
.yroot() - py
37 # pick a corner to anchor
38 if not (resize_nearest
or data
.context() == MC_Grip
):
39 corner
= OBClient_TopLeft
41 x
= px
- data
.press_clientx()
42 y
= py
- data
.press_clienty()
43 if y
< data
.press_clientheight() / 2:
44 if x
< data
.press_clientwidth() / 2:
45 corner
= OBClient_BottomRight
48 corner
= OBClient_BottomLeft
51 if x
< data
.press_clientwidth() / 2:
52 corner
= OBClient_TopRight
55 corner
= OBClient_TopLeft
57 OBClient_resize(client
, corner
,
58 data
.press_clientwidth() + dx
,
59 data
.press_clientheight() + dy
);
61 def execute(bin
, screen
= 0):
62 Openbox_execute(openbox
, screen
, bin
)
65 Openbox_restart(openbox
, "")
67 def toggle_shade(data
):
71 client
= Openbox_findClient(openbox
, data
.window())
73 screen
= Openbox_screen(openbox
, OBClient_screen(client
))
74 OBScreen_restack(screen
, 1, client
)
77 client
= Openbox_findClient(openbox
, data
.window())
79 screen
= Openbox_screen(openbox
, OBClient_screen(client
))
80 OBScreen_restack(screen
, 0, client
)
82 def toggle_shade(data
):
83 client
= Openbox_findClient(openbox
, data
.window())
86 OBClient_shade(client
, not OBClient_shaded(client
))
89 client
= Openbox_findClient(openbox
, data
.window())
91 OBClient_shade(client
, 1)
94 client
= Openbox_findClient(openbox
, data
.window())
96 OBClient_shade(client
, 0)
98 print "Loaded builtins.py"
This page took 0.044897 seconds and 5 git commands to generate.