]> git.decadent.org.uk Git - ion3.git/blob - etc/cfg_ioncore.lua
[svn-upgrade] Integrating new upstream version, ion3 (20070506)
[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(_, _sub, '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("Display context menu."),
182     --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"),
183     kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"),
184 })
185
186
187 -- WFrame context bindings
188 --
189 -- These bindings are common to all types of frames. Some additional
190 -- frame bindings are found in some modules' configuration files.
191
192 defbindings("WFrame", {
193     submap(META.."K", {
194         bdoc("Maximize the frame horizontally/vertically."),
195         kpress("H", "WFrame.maximize_horiz(_)"),
196         kpress("V", "WFrame.maximize_vert(_)"),
197     }),
198     
199     bdoc("Display context menu."),
200     mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"),
201     
202     bdoc("Begin move/resize mode."),
203     kpress(META.."R", "WFrame.begin_kbresize(_)"),
204     
205     bdoc("Switch the frame to display the object indicated by the tab."),
206     mclick("Button1@tab", "WFrame.p_switch_tab(_)"),
207     mclick("Button2@tab", "WFrame.p_switch_tab(_)"),
208     
209     bdoc("Resize the frame."),
210     mdrag("Button1@border", "WFrame.p_resize(_)"),
211     mdrag(META.."Button3", "WFrame.p_resize(_)"),
212     
213     bdoc("Move the frame."),
214     mdrag(META.."Button1", "WFrame.p_move(_)"),
215     
216     bdoc("Move objects between frames by dragging and dropping the tab."),
217     mdrag("Button1@tab", "WFrame.p_tabdrag(_)"),
218     mdrag("Button2@tab", "WFrame.p_tabdrag(_)"),
219            
220 })
221
222 -- Frames for transient windows ignore this bindmap
223
224 defbindings("WFrame.toplevel", {
225     bdoc("Query for a client window to attach."),
226     kpress(META.."A", "mod_query.query_attachclient(_)"),
227     
228     submap(META.."K", {
229         -- Display tab numbers when modifiers are released
230         submap_wait("ioncore.tabnum.show(_)"),
231         
232         bdoc("Switch to n:th object within the frame."),
233         kpress("1", "WFrame.switch_nth(_, 0)"),
234         kpress("2", "WFrame.switch_nth(_, 1)"),
235         kpress("3", "WFrame.switch_nth(_, 2)"),
236         kpress("4", "WFrame.switch_nth(_, 3)"),
237         kpress("5", "WFrame.switch_nth(_, 4)"),
238         kpress("6", "WFrame.switch_nth(_, 5)"),
239         kpress("7", "WFrame.switch_nth(_, 6)"),
240         kpress("8", "WFrame.switch_nth(_, 7)"),
241         kpress("9", "WFrame.switch_nth(_, 8)"),
242         kpress("0", "WFrame.switch_nth(_, 9)"),
243         
244         bdoc("Switch to next/previous object within the frame."),
245         kpress("N", "WFrame.switch_next(_)"),
246         kpress("P", "WFrame.switch_prev(_)"),
247         
248         bdoc("Move current object within the frame left/right."),
249         kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"),
250         kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"),
251                
252         bdoc("Maximize the frame horizontally/vertically."),
253         kpress("H", "WFrame.maximize_horiz(_)"),
254         kpress("V", "WFrame.maximize_vert(_)"),
255
256         bdoc("Attach tagged objects to this frame."),
257         kpress("A", "ioncore.tagged_attach(_)"),
258     }),
259 })
260
261 -- Bindings for floating frames.
262
263 defbindings("WFrame.floating", {
264     bdoc("Toggle shade mode"),
265     mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"),
266     
267     bdoc("Raise the frame."),
268     mpress("Button1@tab", "WRegion.rqorder(_, 'front')"),
269     mpress("Button1@border", "WRegion.rqorder(_, 'front')"),
270     mclick(META.."Button1", "WRegion.rqorder(_, 'front')"),
271     
272     bdoc("Lower the frame."),
273     mclick(META.."Button3", "WRegion.rqorder(_, 'back')"),
274     
275     bdoc("Move the frame."),
276     mdrag("Button1@tab", "WFrame.p_move(_)"),
277 })
278
279
280 -- WMoveresMode context bindings
281 -- 
282 -- These bindings are available keyboard move/resize mode. The mode
283 -- is activated on frames with the command begin_kbresize (bound to
284 -- META.."R" above by default).
285
286 defbindings("WMoveresMode", {
287     bdoc("Cancel the resize mode."),
288     kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"),
289
290     bdoc("End the resize mode."),
291     kpress("AnyModifier+Return","WMoveresMode.finish(_)"),
292
293     bdoc("Grow in specified direction."),
294     kpress("Left",  "WMoveresMode.resize(_, 1, 0, 0, 0)"),
295     kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
296     kpress("Up",    "WMoveresMode.resize(_, 0, 0, 1, 0)"),
297     kpress("Down",  "WMoveresMode.resize(_, 0, 0, 0, 1)"),
298     kpress("F",     "WMoveresMode.resize(_, 1, 0, 0, 0)"),
299     kpress("B",     "WMoveresMode.resize(_, 0, 1, 0, 0)"),
300     kpress("P",     "WMoveresMode.resize(_, 0, 0, 1, 0)"),
301     kpress("N",     "WMoveresMode.resize(_, 0, 0, 0, 1)"),
302     
303     bdoc("Shrink in specified direction."),
304     kpress("Shift+Left",  "WMoveresMode.resize(_,-1, 0, 0, 0)"),
305     kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
306     kpress("Shift+Up",    "WMoveresMode.resize(_, 0, 0,-1, 0)"),
307     kpress("Shift+Down",  "WMoveresMode.resize(_, 0, 0, 0,-1)"),
308     kpress("Shift+F",     "WMoveresMode.resize(_,-1, 0, 0, 0)"),
309     kpress("Shift+B",     "WMoveresMode.resize(_, 0,-1, 0, 0)"),
310     kpress("Shift+P",     "WMoveresMode.resize(_, 0, 0,-1, 0)"),
311     kpress("Shift+N",     "WMoveresMode.resize(_, 0, 0, 0,-1)"),
312     
313     bdoc("Move in specified direction."),
314     kpress(META.."Left",  "WMoveresMode.move(_,-1, 0)"),
315     kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"),
316     kpress(META.."Up",    "WMoveresMode.move(_, 0,-1)"),
317     kpress(META.."Down",  "WMoveresMode.move(_, 0, 1)"),
318     kpress(META.."F",     "WMoveresMode.move(_,-1, 0)"),
319     kpress(META.."B",     "WMoveresMode.move(_, 1, 0)"),
320     kpress(META.."P",     "WMoveresMode.move(_, 0,-1)"),
321     kpress(META.."N",     "WMoveresMode.move(_, 0, 1)"),
322 })
323
324
325 --
326 -- Menu definitions
327 --
328
329
330 -- Main menu
331 defmenu("mainmenu", {
332     menuentry("Run...",         "mod_query.query_exec(_)"),
333     menuentry("Terminal",       "ioncore.exec_on(_, XTERM or 'xterm')"),
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 -- Session control menu
343 defmenu("sessionmenu", {
344     menuentry("Save",           "ioncore.snapshot()"),
345     menuentry("Restart",        "ioncore.restart()"),
346     menuentry("Restart TWM",    "ioncore.restart_other('twm')"),
347     menuentry("Exit",           "ioncore.shutdown()"),
348 })
349
350
351 -- Context menu (frame actions etc.)
352 defctxmenu("WFrame", "Frame", {
353     -- Note: this propagates the close to any subwindows; it does not
354     -- destroy the frame itself, unless empty. An entry to destroy tiled
355     -- frames is configured in cfg_tiling.lua.
356     menuentry("Close",          "WRegion.rqclose_propagate(_, _sub)"),
357     -- Low-priority entries
358     menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }),
359     menuentry("Clear tags",    "ioncore.clear_tags()", { priority = 0 }),
360     menuentry("Window info",   "mod_query.show_tree(_, _sub)", { priority = 0 }),
361 })
362
363
364 -- Context menu for groups (workspaces, client windows)
365 defctxmenu("WGroup", "Group", {
366     menuentry("Toggle tag",     "WRegion.set_tagged(_, 'toggle')"),
367     menuentry("De/reattach",    "ioncore.detach(_, 'toggle')"), 
368 })
369
370
371 -- Context menu for workspaces
372 defctxmenu("WGroupWS", "Workspace", {
373     menuentry("Close",          "WRegion.rqclose(_)"),
374     menuentry("Rename",         "mod_query.query_renameworkspace(nil, _)"),
375     menuentry("Attach tagged",  "ioncore.tagged_attach(_)"),
376 })
377
378
379 -- Context menu for client windows
380 defctxmenu("WClientWin", "Client window", {
381     menuentry("Kill",           "WClientWin.kill(_)"),
382 })