Add diagnostic logging
[notion.git] / etc / cfg_notioncore.lua
blobe011af5ce942a119d8fe50308accfd056942d917
1 --
2 -- Notion core configuration file
3 --
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.
13 -- WScreen context bindings
15 -- The bindings in this context are available all the time.
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.
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)"),
36 bdoc("Switch to next/previous object within current screen."),
37 kpress(META.."comma", "WScreen.switch_prev(_)"),
38 kpress(META.."period", "WScreen.switch_next(_)"),
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()"),
46 --bdoc("Go to previous active object."),
47 --kpress("K", "ioncore.goto_previous()"),
49 --bdoc("Go to first object on activity/urgency list."),
50 --kpress("I", "ioncore.goto_activity()"),
52 bdoc("Clear all tags."),
53 kpress("T", "ioncore.tagged_clear()"),
54 }),
56 bdoc("Go to n:th screen on multihead setup."),
57 kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"),
58 kpress(META.."Q", "ioncore.goto_nth_screen(0)"),
59 kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"),
60 kpress(META.."W", "ioncore.goto_nth_screen(1)"),
61 kpress(META.."Shift+3", "ioncore.goto_nth_screen(2)"),
62 kpress(META.."E", "ioncore.goto_nth_screen(2)"),
64 bdoc("Go to next/previous screen on multihead setup."),
65 kpress(META.."Shift+comma", "ioncore.goto_prev_screen()"),
66 kpress(META.."I", "ioncore.goto_prev_screen()"),
67 kpress(META.."O", "ioncore.goto_next_screen()"),
68 kpress(META.."grave", "ioncore.goto_next_screen()"),
70 bdoc("Create a new workspace of chosen default type."),
71 kpress(META.."F9", "ioncore.create_ws(_)"),
73 bdoc("Display the main menu."),
74 kpress(ALTMETA.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"),
75 --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"),
76 mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"),
78 bdoc("Display the window list menu."),
79 mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"),
81 bdoc("Forward-circulate focus."),
82 -- '_chld' used here stands to for an actual child window that may not
83 -- be managed by the screen itself, unlike '_sub', that is likely to be
84 -- the managing group of that window. The right/left directions are
85 -- used instead of next/prev, because they work better in conjunction
86 -- with tilings.
87 kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')",
88 "_chld:non-nil"),
89 submap(META.."K", {
90 bdoc("Backward-circulate focus."),
91 kpress("AnyModifier+Tab", "ioncore.goto_next(_chld, 'left')",
92 "_chld:non-nil"),
94 bdoc("Raise focused object, if possible."),
95 kpress("AnyModifier+R", "WRegion.rqorder(_chld, 'front')",
96 "_chld:non-nil"),
97 }),
102 -- Client window bindings
104 -- These bindings affect client windows directly.
106 defbindings("WClientWin", {
107 submap(META.."K", {
108 bdoc("Nudge the client window. This might help with some "..
109 "programs' resizing problems."),
110 kpress_wait(META.."L", "WClientWin.nudge(_)"),
112 bdoc("Kill client owning the client window."),
113 kpress("C", "WClientWin.kill(_)"),
115 bdoc("Send next key press to the client window. "..
116 "Some programs may not allow this by default."),
117 kpress("Q", "WClientWin.quote_next(_)"),
122 -- Client window group bindings
124 defbindings("WGroupCW", {
125 bdoc("Toggle client window group full-screen mode"),
126 kpress_wait(META.."Return", "WGroup.set_fullscreen(_, 'toggle')"),
130 -- WMPlex context bindings
132 -- These bindings work in frames and on screens. The innermost of such
133 -- contexts/objects always gets to handle the key press.
135 defbindings("WMPlex", {
136 bdoc("Close current object."),
137 kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"),
140 -- Frames for transient windows ignore this bindmap
141 defbindings("WMPlex.toplevel", {
142 bdoc("Toggle tag of current object."),
143 kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
145 bdoc("Lock screen"),
146 kpress(META.."L", "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"),
148 bdoc("Query for manual page to be displayed."),
149 kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"),
151 bdoc("Show the Notion manual page."),
152 kpress(META.."F1", "ioncore.exec_on(_, ':man notion')"),
154 bdoc("Run a terminal emulator."),
155 kpress(ALTMETA.."F2", "mod_query.exec_on_merr(_, XTERM or 'xterm')"),
157 bdoc("Query for command line to execute."),
158 kpress(ALTMETA.."F3", "mod_query.query_exec(_)"),
160 bdoc("Query for Lua code to execute."),
161 kpress(META.."F3", "mod_query.query_lua(_)"),
163 bdoc("Query for host to connect to with SSH."),
164 kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"),
166 bdoc("Query for file to edit."),
167 kpress(ALTMETA.."F5",
168 "mod_query.query_editfile(_, 'run-mailcap --action=edit')"),
170 bdoc("Query for file to view."),
171 kpress(ALTMETA.."F6",
172 "mod_query.query_runfile(_, 'run-mailcap --action=view')"),
174 bdoc("Query for workspace to go to or create a new one."),
175 kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"),
177 bdoc("Query for a client window to go to."),
178 kpress(META.."G", "mod_query.query_gotoclient(_)"),
180 bdoc("Display context menu."),
181 --kpress(META.."M", "mod_menu.menu(_, _sub, 'ctxmenu')"),
182 kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"),
184 submap(META.."K", {
185 bdoc("Detach (float) or reattach an object to its previous location."),
186 -- By using _chld instead of _sub, we can detach/reattach queries
187 -- attached to a group. The detach code checks if the parameter
188 -- (_chld) is a group 'bottom' and detaches the whole group in that
189 -- case.
190 kpress("D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"),
195 -- WFrame context bindings
197 -- These bindings are common to all types of frames. Some additional
198 -- frame bindings are found in some modules' configuration files.
200 defbindings("WFrame", {
201 submap(META.."K", {
202 bdoc("Maximize the frame horizontally/vertically."),
203 kpress("H", "WFrame.maximize_horiz(_)"),
204 kpress("V", "WFrame.maximize_vert(_)"),
207 bdoc("Display context menu."),
208 mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"),
210 bdoc("Begin move/resize mode."),
211 kpress(META.."R", "WFrame.begin_kbresize(_)"),
213 bdoc("Switch the frame to display the object indicated by the tab."),
214 mclick("Button1@tab", "WFrame.p_switch_tab(_)"),
215 mclick("Button2@tab", "WFrame.p_switch_tab(_)"),
217 bdoc("Resize the frame."),
218 mdrag("Button1@border", "WFrame.p_resize(_)"),
219 mdrag(META.."Button3", "WFrame.p_resize(_)"),
221 bdoc("Move the frame."),
222 mdrag(META.."Button1", "WFrame.p_move(_)"),
224 bdoc("Move objects between frames by dragging and dropping the tab."),
225 mdrag("Button1@tab", "WFrame.p_tabdrag(_)"),
226 mdrag("Button2@tab", "WFrame.p_tabdrag(_)"),
228 bdoc("Switch to next/previous object within the frame."),
229 mclick(META.."Button4", "WFrame.switch_next(_)"),
230 mclick(META.."Button5", "WFrame.switch_prev(_)"),
233 -- Frames for transient windows ignore this bindmap
235 defbindings("WFrame.toplevel", {
236 bdoc("Query for a client window to attach."),
237 kpress(META.."A", "mod_query.query_attachclient(_)"),
239 submap(META.."K", {
240 -- Display tab numbers when modifiers are released
241 submap_wait("ioncore.tabnum.show(_)"),
243 bdoc("Switch to n:th object within the frame."),
244 kpress("1", "WFrame.switch_nth(_, 0)"),
245 kpress("2", "WFrame.switch_nth(_, 1)"),
246 kpress("3", "WFrame.switch_nth(_, 2)"),
247 kpress("4", "WFrame.switch_nth(_, 3)"),
248 kpress("5", "WFrame.switch_nth(_, 4)"),
249 kpress("6", "WFrame.switch_nth(_, 5)"),
250 kpress("7", "WFrame.switch_nth(_, 6)"),
251 kpress("8", "WFrame.switch_nth(_, 7)"),
252 kpress("9", "WFrame.switch_nth(_, 8)"),
253 kpress("0", "WFrame.switch_nth(_, 9)"),
255 bdoc("Switch to next/previous object within the frame."),
256 kpress("N", "WFrame.switch_next(_)"),
257 kpress("P", "WFrame.switch_prev(_)"),
259 bdoc("Move current object within the frame left/right."),
260 kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"),
261 kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"),
263 bdoc("Maximize the frame horizontally/vertically."),
264 kpress("H", "WFrame.maximize_horiz(_)"),
265 kpress("V", "WFrame.maximize_vert(_)"),
267 bdoc("Attach tagged objects to this frame."),
268 kpress("A", "ioncore.tagged_attach(_)"),
272 -- Bindings for floating frames.
274 defbindings("WFrame.floating", {
275 bdoc("Toggle shade mode"),
276 mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"),
278 bdoc("Raise the frame."),
279 mpress("Button1@tab", "WRegion.rqorder(_, 'front')"),
280 mpress("Button1@border", "WRegion.rqorder(_, 'front')"),
281 mclick(META.."Button1", "WRegion.rqorder(_, 'front')"),
283 bdoc("Lower the frame."),
284 mclick(META.."Button3", "WRegion.rqorder(_, 'back')"),
286 bdoc("Move the frame."),
287 mdrag("Button1@tab", "WFrame.p_move(_)"),
291 -- WMoveresMode context bindings
293 -- These bindings are available keyboard move/resize mode. The mode
294 -- is activated on frames with the command begin_kbresize (bound to
295 -- META.."R" above by default).
297 defbindings("WMoveresMode", {
298 bdoc("Cancel the resize mode."),
299 kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"),
301 bdoc("End the resize mode."),
302 kpress("AnyModifier+Return","WMoveresMode.finish(_)"),
304 bdoc("Grow in specified direction."),
305 kpress("Left", "WMoveresMode.resize(_, 1, 0, 0, 0)"),
306 kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
307 kpress("Up", "WMoveresMode.resize(_, 0, 0, 1, 0)"),
308 kpress("Down", "WMoveresMode.resize(_, 0, 0, 0, 1)"),
309 kpress("F", "WMoveresMode.resize(_, 1, 0, 0, 0)"),
310 kpress("B", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
311 kpress("P", "WMoveresMode.resize(_, 0, 0, 1, 0)"),
312 kpress("N", "WMoveresMode.resize(_, 0, 0, 0, 1)"),
314 bdoc("Shrink in specified direction."),
315 kpress("Shift+Left", "WMoveresMode.resize(_,-1, 0, 0, 0)"),
316 kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
317 kpress("Shift+Up", "WMoveresMode.resize(_, 0, 0,-1, 0)"),
318 kpress("Shift+Down", "WMoveresMode.resize(_, 0, 0, 0,-1)"),
319 kpress("Shift+F", "WMoveresMode.resize(_,-1, 0, 0, 0)"),
320 kpress("Shift+B", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
321 kpress("Shift+P", "WMoveresMode.resize(_, 0, 0,-1, 0)"),
322 kpress("Shift+N", "WMoveresMode.resize(_, 0, 0, 0,-1)"),
324 bdoc("Move in specified direction."),
325 kpress(META.."Left", "WMoveresMode.move(_,-1, 0)"),
326 kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"),
327 kpress(META.."Up", "WMoveresMode.move(_, 0,-1)"),
328 kpress(META.."Down", "WMoveresMode.move(_, 0, 1)"),
329 kpress(META.."F", "WMoveresMode.move(_,-1, 0)"),
330 kpress(META.."B", "WMoveresMode.move(_, 1, 0)"),
331 kpress(META.."P", "WMoveresMode.move(_, 0,-1)"),
332 kpress(META.."N", "WMoveresMode.move(_, 0, 1)"),
337 -- Menu definitions
341 -- Main menu
342 defmenu("mainmenu", {
343 menuentry("Run...", "mod_query.query_exec(_)"),
344 menuentry("Terminal", "mod_query.exec_on_merr(_, XTERM or 'xterm')"),
345 menuentry("Lock screen",
346 "notioncore.exec_on(_, notioncore.lookup_script('notion-lock'))"),
347 menuentry("Help", "mod_query.query_man(_)"),
348 menuentry("About Notion", "mod_query.show_about_ion(_)"),
349 submenu("Styles", "stylemenu"),
350 submenu("Session", "sessionmenu"),
354 -- Session control menu
355 defmenu("sessionmenu", {
356 menuentry("Save", "ioncore.snapshot()"),
357 menuentry("Restart", "ioncore.restart()"),
358 menuentry("Restart TWM", "ioncore.restart_other('twm')"),
359 menuentry("Exit", "ioncore.shutdown()"),
363 -- Context menu (frame actions etc.)
364 defctxmenu("WFrame", "Frame", {
365 -- Note: this propagates the close to any subwindows; it does not
366 -- destroy the frame itself, unless empty. An entry to destroy tiled
367 -- frames is configured in cfg_tiling.lua.
368 menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"),
369 -- Low-priority entries
370 menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }),
371 menuentry("Clear tags", "ioncore.tagged_clear()", { priority = 0 }),
372 menuentry("Window info", "mod_query.show_tree(_, _sub)", { priority = 0 }),
376 -- Context menu for groups (workspaces, client windows)
377 defctxmenu("WGroup", "Group", {
378 menuentry("Toggle tag", "WRegion.set_tagged(_, 'toggle')"),
379 menuentry("De/reattach", "ioncore.detach(_, 'toggle')"),
383 -- Context menu for workspaces
384 defctxmenu("WGroupWS", "Workspace", {
385 menuentry("Close", "WRegion.rqclose(_)"),
386 menuentry("Rename", "mod_query.query_renameworkspace(nil, _)"),
387 menuentry("Attach tagged", "ioncore.tagged_attach(_)"),
391 -- Context menu for client windows
392 defctxmenu("WClientWin", "Client window", {
393 menuentry("Kill", "WClientWin.kill(_)"),