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