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)
64 def toggle_shade(data):
68 client = Openbox_findClient(openbox, data.window())
70 screen = Openbox_screen(openbox, OBClient_screen(client))
71 OBScreen_restack(screen, 1, client)
74 client = Openbox_findClient(openbox, data.window())
76 screen = Openbox_screen(openbox, OBClient_screen(client))
77 OBScreen_restack(screen, 0, client)