]> git.decadent.org.uk Git - ion3.git/blob - etc/cfg_ioncore.lua
[svn-upgrade] Integrating new upstream version, ion3 (20070203)
[ion3.git] / etc / cfg_ioncore.lua
1 --
2 -- Ion core configuration file
3 --
4
5
6 -- 
7 -- Bindings. This includes global bindings and bindings common to
8 -- screens and all types of frames only. See modules' configuration 
9 -- files for other bindings.
10 --
11
12
13 -- WScreen context bindings
14 --
15 -- The bindings in this context are available all the time.
16 --
17 -- The variable META should contain a string of the form 'Mod1+'
18 -- where Mod1 maybe replaced with the modifier you want to use for most
19 -- of the bindings. Similarly ALTMETA may be redefined to add a 
20 -- modifier to some of the F-key bindings.
21
22 defbindings("WScreen", {
23     bdoc("Switch to n:th object (workspace, full screen client window) "..
24          "within current screen."),
25     kpress(META.."1", "WScreen.switch_nth(_, 0)"),
26     kpress(META.."2", "WScreen.switch_nth(_, 1)"),
27     kpress(META.."3", "WScreen.switch_nth(_, 2)"),
28     kpress(META.."4", "WScreen.switch_nth(_, 3)"),
29     kpress(META.."5", "WScreen.switch_nth(_, 4)"),
30     kpress(META.."6", "WScreen.switch_nth(_, 5)"),
31     kpress(META.."7", "WScreen.switch_nth(_, 6)"),
32     kpress(META.."8", "WScreen.switch_nth(_, 7)"),
33     kpress(META.."9", "WScreen.switch_nth(_, 8)"),
34     kpress(META.."0", "WScreen.switch_nth(_, 9)"),
35     
36     bdoc("Switch to next/previous object within current screen."),
37     kpress(META.."comma", "WScreen.switch_prev(_)"),
38     kpress(META.."period", "WScreen.switch_next(_)"),
39
40     submap(META.."K", {
41         bdoc("Go to first region demanding attention or previously active one."),
42         kpress("K", "mod_menu.grabmenu(_, _sub, 'focuslist')"),
43         -- Alternative without (cyclable) menu
44         --kpress("K", "ioncore.goto_activity() or ioncore.goto_previous()"),
45
46         --bdoc("Go to previous active object."),
47         --kpress("K", "ioncore.goto_previous()"),
48         
49         --bdoc("Go to first object on activity/urgency list."),
50         --kpress("I", "ioncore.goto_activity()"),
51         
52         bdoc("Clear all tags."),
53         kpress("T", "ioncore.clear_tags()"),
54     }),
55
56     bdoc("Go to n:th screen on multihead setup."),
57     kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"),
58     kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"),
59     
60     bdoc("Go to next/previous screen on multihead setup."),
61     kpress(META.."Shift+comma", "ioncore.goto_prev_screen()"),
62     kpress(META.."Shift+period", "ioncore.goto_next_screen()"),
63     
64     bdoc("Create a new workspace of chosen default type."),
65     kpress(META.."F9", "ioncore.create_ws(_)"),
66     
67     bdoc("Display the main menu."),
68     kpress(ALTMETA.."F12", "mod_query.query_menu(_, 'mainmenu', 'Main menu:')"),
69     --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"),
70     mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"),
71     
72     bdoc("Display the window list menu."),
73     mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"),
74
75     bdoc("Forward-circulate focus."),
76     -- '_chld' used here stands to for an actual child window that may not
77     -- be managed by the screen itself, unlike '_sub', that is likely to be
78     -- the managing group of that window. The right/left directions are
79     -- used instead of next/prev, because they work better in conjunction
80     -- with tilings.
81     kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')", 
82            "_chld:non-nil"),
83     submap(META.."K", { 
84         bdoc("Backward-circulate focus."),
85         kpress("AnyModifier+Tab", "ioncore.goto_next(_chld, 'left')", 
86                "_chld:non-nil"),
87         
88         bdoc("Raise focused object, if possible."),
89         kpress("AnyModifier+R", "WRegion.rqorder(_chld, 'front')",
90                "_chld:non-nil"),
91     }),
92
93 })
94
95
96 -- Client window bindings
97 --
98 -- These bindings affect client windows directly.
99
100 defbindings("WClientWin", {
101     bdoc("Nudge the client window. This might help with some "..
102          "programs' resizing problems."),
103     kpress_wait(META.."L", "WClientWin.nudge(_)"),
104     
105     submap(META.."K", {
106        bdoc("Kill client owning the client window."),
107        kpress("C", "WClientWin.kill(_)"),
108        
109        bdoc("Send next key press to the client window. "..
110             "Some programs may not allow this by default."),
111        kpress("Q", "WClientWin.quote_next(_)"),
112     }),
113 })
114
115
116 -- Client window group bindings
117
118 defbindings("WGroupCW", {
119     bdoc("Toggle client window group full-screen mode"),
120     kpress_wait(META.."Return", "WGroup.set_fullscreen(_, 'toggle')"),
121 })
122
123
124 -- WMPlex context bindings
125 --
126 -- These bindings work in frames and on screens. The innermost of such
127 -- contexts/objects always gets to handle the key press. 
128
129 defbindings("WMPlex", {
130     bdoc("Close current object."),
131     kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"),
132     
133     submap(META.."K", {
134         bdoc("Detach (float) or reattach an object to its previous location."),
135         -- By using _chld instead of _sub, we can detach/reattach queries
136         -- attached to a group. The detach code checks if the parameter 
137         -- (_chld) is a group 'bottom' and detaches the whole group in that
138         -- case.
139         kpress("D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"),
140     }),
141 })
142
143 -- Frames for transient windows ignore this bindmap
144
145 defbindings("WMPlex.toplevel", {
146     bdoc("Toggle tag of current object."),
147     kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
148
149     bdoc("Query for manual page to be displayed."),
150     kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"),
151
152     bdoc("Show the Ion manual page."),
153     kpress(META.."F1", "ioncore.exec_on(_, ':man ion3')"),
154
155     bdoc("Run a terminal emulator."),
156     kpress(ALTMETA.."F2", "ioncore.exec_on(_, XTERM or 'xterm')"),
157     
158     bdoc("Query for command line to execute."),
159     kpress(ALTMETA.."F3", "mod_query.query_exec(_)"),
160
161     bdoc("Query for Lua code to execute."),
162     kpress(META.."F3", "mod_query.query_lua(_)"),
163
164     bdoc("Query for host to connect to with SSH."),
165     kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"),
166
167     bdoc("Query for file to edit."),
168     kpress(ALTMETA.."F5", 
169            "mod_query.query_editfile(_, 'run-mailcap --action=edit')"),
170
171     bdoc("Query for file to view."),
172     kpress(ALTMETA.."F6", 
173            "mod_query.query_runfile(_, 'run-mailcap --action=view')"),
174
175     bdoc("Query for workspace to go to or create a new one."),
176     kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"),
177     
178     bdoc("Query for a client window to go to."),
179     kpress(META.."G", "mod_query.query_gotoclient(_)"),
180     
181     bdoc("Query for a client window to attach."),
182     kpress(META.."A", "mod_query.query_attachclient(_)"),
183     
184     bdoc("Display context menu."),
185     --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"),
186     kpress(META.."M", "mod_query.query_menu(_, 'ctxmenu', 'Context menu:')"),
187
188 })
189
190
191 -- WFrame context bindings
192 --
193 -- These bindings are common to all types of frames. Some additional
194 -- frame bindings are found in some modules' configuration files.
195
196 defbindings("WFrame", {
197     submap(META.."K", {
198         bdoc("Maximize the frame horizontally/vertically."),
199         kpress("H", "WFrame.maximize_horiz(_)"),
200         kpress("V", "WFrame.maximize_vert(_)"),
201     }),
202     
203     bdoc("Display context menu."),
204     mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"),
205     
206     bdoc("Begin move/resize mode."),
207     kpress(META.."R", "WFrame.begin_kbresize(_)"),
208     
209     bdoc("Switch the frame to display the object indicated by the tab."),
210     mclick("Button1@tab", "WFrame.p_switch_tab(_)"),
211     mclick("Button2@tab", "WFrame.p_switch_tab(_)"),
212     
213     bdoc("Resize the frame."),
214     mdrag("Button1@border", "WFrame.p_resize(_)"),
215     mdrag(META.."Button3", "WFrame.p_resize(_)"),
216     
217     bdoc("Move the frame."),
218     mdrag(META.."Button1", "WFrame.p_move(_)"),
219     
220     bdoc("Move objects between frames by dragging and dropping the tab."),
221     mdrag("Button1@tab", "WFrame.p_tabdrag(_)"),
222     mdrag("Button2@tab", "WFrame.p_tabdrag(_)"),
223            
224 })
225
226 -- Frames for transient windows ignore this bindmap
227
228 defbindings("WFrame.toplevel", {
229     bdoc("Tag current object within the frame."),
230     kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
231     
232     submap(META.."K", {
233         bdoc("Switch to n:th object within the frame."),
234         kpress("1", "WFrame.switch_nth(_, 0)"),
235         kpress("2", "WFrame.switch_nth(_, 1)"),
236         kpress("3", "WFrame.switch_nth(_, 2)"),
237         kpress("4", "WFrame.switch_nth(_, 3)"),
238         kpress("5", "WFrame.switch_nth(_, 4)"),
239         kpress("6", "WFrame.switch_nth(_, 5)"),
240         kpress("7", "WFrame.switch_nth(_, 6)"),
241         kpress("8", "WFrame.switch_nth(_, 7)"),
242         kpress("9", "WFrame.switch_nth(_, 8)"),
243         kpress("0", "WFrame.switch_nth(_, 9)"),
244         
245         bdoc("Switch to next/previous object within the frame."),
246         kpress("N", "WFrame.switch_next(_)"),
247         kpress("P", "WFrame.switch_prev(_)"),
248         
249         bdoc("Move current object within the frame left/right."),
250         kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"),
251         kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"),
252                
253         bdoc("Maximize the frame horizontally/vertically."),
254         kpress("H", "WFrame.maximize_horiz(_)"),
255         kpress("V", "WFrame.maximize_vert(_)"),
256
257         bdoc("Attach tagged objects to this frame."),
258         kpress("A", "WFrame.attach_tagged(_)"),
259     }),
260 })
261
262 -- Bindings for floating frames.
263
264 defbindings("WFrame.floating", {
265     bdoc("Toggle shade mode"),
266     mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"),
267     
268     bdoc("Raise the frame."),
269     mpress("Button1@tab", "WRegion.rqorder(_, 'front')"),
270     mpress("Button1@border", "WRegion.rqorder(_, 'front')"),
271     mclick(META.."Button1", "WRegion.rqorder(_, 'front')"),
272     
273     bdoc("Lower the frame."),
274     mclick(META.."Button3", "WRegion.rqorder(_, 'back')"),
275     
276     bdoc("Move the frame."),
277     mdrag("Button1@tab", "WFrame.p_move(_)"),
278 })
279
280
281 -- WMoveresMode context bindings
282 -- 
283 -- These bindings are available keyboard move/resize mode. The mode
284 -- is activated on frames with the command begin_kbresize (bound to
285 -- META.."R" above by default).
286
287 defbindings("WMoveresMode", {
288     bdoc("Cancel the resize mode."),
289     kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"),
290
291     bdoc("End the resize mode."),
292     kpress("AnyModifier+Return","WMoveresMode.finish(_)"),
293
294     bdoc("Grow in specified direction."),
295     kpress("Left",  "WMoveresMode.resize(_, 1, 0, 0, 0)"),
296     kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
297     kpress("Up",    "WMoveresMode.resize(_, 0, 0, 1, 0)"),
298     kpress("Down",  "WMoveresMode.resize(_, 0, 0, 0, 1)"),
299     kpress("F",     "WMoveresMode.resize(_, 1, 0, 0, 0)"),
300     kpress("B",     "WMoveresMode.resize(_, 0, 1, 0, 0)"),
301     kpress("P",     "WMoveresMode.resize(_, 0, 0, 1, 0)"),
302     kpress("N",     "WMoveresMode.resize(_, 0, 0, 0, 1)"),
303     
304     bdoc("Shrink in specified direction."),
305     kpress("Shift+Left",  "WMoveresMode.resize(_,-1, 0, 0, 0)"),
306     kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
307     kpress("Shift+Up",    "WMoveresMode.resize(_, 0, 0,-1, 0)"),
308     kpress("Shift+Down",  "WMoveresMode.resize(_, 0, 0, 0,-1)"),
309     kpress("Shift+F",     "WMoveresMode.resize(_,-1, 0, 0, 0)"),
310     kpress("Shift+B",     "WMoveresMode.resize(_, 0,-1, 0, 0)"),
311     kpress("Shift+P",     "WMoveresMode.resize(_, 0, 0,-1, 0)"),
312     kpress("Shift+N",     "WMoveresMode.resize(_, 0, 0, 0,-1)"),
313     
314     bdoc("Move in specified direction."),
315     kpress(META.."Left",  "WMoveresMode.move(_,-1, 0)"),
316     kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"),
317     kpress(META.."Up",    "WMoveresMode.move(_, 0,-1)"),
318     kpress(META.."Down",  "WMoveresMode.move(_, 0, 1)"),
319     kpress(META.."F",     "WMoveresMode.move(_,-1, 0)"),
320     kpress(META.."B",     "WMoveresMode.move(_, 1, 0)"),
321     kpress(META.."P",     "WMoveresMode.move(_, 0,-1)"),
322     kpress(META.."N",     "WMoveresMode.move(_, 0, 1)"),
323 })
324
325
326 --
327 -- Menu definitions
328 --
329
330
331 -- Main menu
332 defmenu("mainmenu", {
333     submenu("Programs",         "appmenu"),
334     menuentry("Lock screen",    "ioncore.exec_on(_, 'xlock')"),
335     menuentry("Help",           "mod_query.query_man(_)"),
336     menuentry("About Ion",      "mod_query.show_about_ion(_)"),
337     submenu("Styles",           "stylemenu"),
338     submenu("Session",          "sessionmenu"),
339 })
340
341
342 -- Application menu
343 defmenu("appmenu", {
344     menuentry("XTerm",          "ioncore.exec_on(_, 'xterm')"),
345     menuentry("W3M",            "ioncore.exec_on(_, ':w3m -v')"),
346     menuentry("Rxvt",           "ioncore.exec_on(_, 'rxvt')"),
347     menuentry("Opera",          "ioncore.exec_on(_, 'opera')"),
348     menuentry("Links",          "ioncore.exec_on(_, ':links')"),
349     menuentry("Konqueror",      "ioncore.exec_on(_, 'konqueror')"),
350     menuentry("Dillo",          "ioncore.exec_on(_, 'dillo')"),
351     menuentry("Run...",         "mod_query.query_exec(_)"),
352 })
353
354
355 -- Session control menu
356 defmenu("sessionmenu", {
357     menuentry("Save",           "ioncore.snapshot()"),
358     menuentry("Restart",        "ioncore.restart()"),
359     menuentry("Restart TWM",    "ioncore.restart_other('twm')"),
360     menuentry("Exit",           "ioncore.shutdown()"),
361 })
362
363
364 -- Context menu (frame/client window actions)
365 defctxmenu("WFrame", "Frame", {
366     menuentry("Close",          "WRegion.rqclose_propagate(_, _sub)"),
367     menuentry("Kill",           "WClientWin.kill(_sub)",
368                                 "_sub:WClientWin"),
369     menuentry("De/reattach",    "ioncore.detach(_sub, 'toggle')", 
370                                 "_sub:non-nil"),
371     menuentry("Toggle tag",     "WRegion.set_tagged(_sub, 'toggle')",
372                                 "_sub:non-nil"),
373     menuentry("Attach tagged",  "WFrame.attach_tagged(_)"),
374     menuentry("Clear tags",     "ioncore.clear_tags()"),
375     menuentry("Window info",    "mod_query.show_tree(_, _sub)"),
376 })
377
378
379 -- Context menu for workspaces
380 defctxmenu("WGroupWS", "Workspace", {
381     menuentry("Close",          "WRegion.rqclose(_)"),
382     menuentry("Rename",         "mod_query.query_renameworkspace(nil, _)"),
383 })
384