run scripts before initializing screens. kill the globals.py. add the python_get_stri...
[mikachu/openbox.git] / scripts / clicks.py
1 def def_click_client(data):
2         client = Openbox_findClient(openbox, data.window())
3         if not client: return
4
5         button = data.button()
6         type = data.target()
7         if button == 1 and type == Type_CloseButton:
8                 OBClient_close(client)
9         elif button <= 3 and type == Type_MaximizeButton:
10                 print "OBClient_maximize(client)"
11         elif button == 1 and type == Type_IconifyButton:
12                 print "OBClient_iconify(client)"
13         elif button == 1 and type == Type_StickyButton:
14                 print "OBClient_sendtodesktop(client, 0xffffffff)"
15         elif type == Type_Titlebar or type == Type_CloseButton or \
16              type == Type_MaximizeButton or type == Type_IconifyButton or \
17              type == Type_StickyButton or type == Type_Label:
18                 if button == 4:
19                         print "OBClient_shade(client)"
20                 elif button == 5:
21                         print "OBClient_unshade(client)"
22
23 def def_press_model(data):
24         if data.button() != 1: return
25         client = Openbox_findClient(openbox, data.window())
26         if not client or (type == Type_StickyButton or
27                           type == Type_IconifyButton or
28                           type == Type_MaximizeButton or
29                           type == Type_CloseButton):
30                 return
31         if click_focus != 0:
32                 OBClient_focus(client)
33         if click_raise != 0:
34                 print "OBClient_raise(client)"
35
36 def def_press_root(data):
37         button = data.button()
38         if type == Type_Root:
39                 if button == 1:
40                         print "nothing probly.."
41                         client = Openbox_focusedClient(openbox)
42                         if client: OBClient_unfocus(client)
43                 elif button == 2:
44                         print "workspace menu"
45                 elif button == 3:
46                         print "root menu"
47                 elif button == 4:
48                         print "next workspace"
49                 elif button == 5:
50                         print "previous workspace"
51
52 def def_doubleclick_client(data):
53         client = Openbox_findClient(openbox, data.window())
54         if not client: return
55
56         button = data.button()
57         if button == 1 and (type == Type_Titlebar or type == Type_Label):
58                 print "OBClient_toggleshade(client)"
59
60
61 register(Action_ButtonPress, def_press_model, 1)
62 register(Action_Click, def_click_client)
63 register(Action_ButtonPress, def_press_root)
64 register(Action_DoubleClick, def_doubleclick_client)
65
66 print "Loaded clicks.py"