2 -- Ion core configuration file
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", {
25 bdoc("Go to first region demanding attention or previously active one."),
26 kpress("K", "mod_menu.grabmenu(_, _sub, 'focuslist')"),
27 -- Alternative without (cyclable) menu
28 --kpress("K", "ioncore.goto_activity() or ioncore.goto_previous()"),
30 --bdoc("Go to previous active object."),
31 --kpress("K", "ioncore.goto_previous()"),
33 --bdoc("Go to first object on activity/urgency list."),
34 --kpress("I", "ioncore.goto_activity()"),
37 --bdoc("Go to n:th screen on multihead setup."),
38 --kpress(META.."Shift+1", "ioncore.goto_nth_screen(0)"),
39 --kpress(META.."Shift+2", "ioncore.goto_nth_screen(1)"),
41 --bdoc("Go to next/previous screen on multihead setup."),
42 --kpress(META.."Shift+comma", "ioncore.goto_prev_screen()"),
43 --kpress(META.."Shift+period", "ioncore.goto_next_screen()"),
45 bdoc("Create a new workspace of chosen default type."),
46 kpress(META.."F9", "ioncore.create_ws(_)"),
48 bdoc("Display the main menu."),
49 --kpress(ALTMETA.."F12", "mod_query.query_menu(_, _sub, 'mainmenu', 'Main menu:')"),
50 --kpress(ALTMETA.."F12", "mod_menu.menu(_, _sub, 'mainmenu', {big=true})"),
51 mpress("Button3", "mod_menu.pmenu(_, _sub, 'mainmenu')"),
53 bdoc("Display the window list menu."),
54 mpress("Button2", "mod_menu.pmenu(_, _sub, 'windowlist')"),
56 bdoc("Forward-circulate focus."),
57 -- '_chld' used here stands to for an actual child window that may not
58 -- be managed by the screen itself, unlike '_sub', that is likely to be
59 -- the managing group of that window. The right/left directions are
60 -- used instead of next/prev, because they work better in conjunction
62 kpress(META.."Tab", "ioncore.goto_next(_chld, 'right')",
65 bdoc("Backward-circulate focus."),
66 kpress("AnyModifier+Tab", "ioncore.goto_next(_chld, 'left')",
69 bdoc("Raise focused object, if possible."),
70 kpress("AnyModifier+R", "WRegion.rqorder(_chld, 'front')",
77 -- Client window bindings
79 -- These bindings affect client windows directly.
81 defbindings("WClientWin", {
82 bdoc("Nudge the client window. This might help with some "..
83 "programs' resizing problems."),
84 kpress_wait(META.."L", "WClientWin.nudge(_)"),
87 bdoc("Kill client owning the client window."),
88 kpress("C", "WClientWin.kill(_)"),
90 bdoc("Send next key press to the client window. "..
91 "Some programs may not allow this by default."),
92 kpress("Q", "WClientWin.quote_next(_)"),
97 -- Client window group bindings
99 defbindings("WGroupCW", {
100 bdoc("Toggle client window group full-screen mode"),
101 kpress_wait(META.."Return", "WGroup.set_fullscreen(_, 'toggle')"),
105 -- WMPlex context bindings
107 -- These bindings work in frames and on screens. The innermost of such
108 -- contexts/objects always gets to handle the key press.
110 defbindings("WMPlex", {
111 bdoc("Close current object."),
112 kpress_wait(META.."C", "WRegion.rqclose_propagate(_, _sub)"),
115 bdoc("Detach (float) or reattach an object to its previous location."),
116 -- By using _chld instead of _sub, we can detach/reattach queries
117 -- attached to a group. The detach code checks if the parameter
118 -- (_chld) is a group 'bottom' and detaches the whole group in that
120 kpress("D", "ioncore.detach(_chld, 'toggle')", "_chld:non-nil"),
124 -- Frames for transient windows ignore this bindmap
126 defbindings("WMPlex.toplevel", {
127 bdoc("Toggle tag of current object."),
128 kpress(META.."T", "WRegion.set_tagged(_sub, 'toggle')", "_sub:non-nil"),
130 --bdoc("Query for manual page to be displayed."),
131 --kpress(ALTMETA.."F1", "mod_query.query_man(_, ':man')"),
133 --bdoc("Show the Ion manual page."),
134 --kpress(META.."F1", "ioncore.exec_on(_, ':man ion3')"),
136 --bdoc("Run a terminal emulator."),
137 --kpress(ALTMETA.."F2", "ioncore.exec_on(_, XTERM or 'x-terminal-emulator')"),
139 --bdoc("Query for command line to execute."),
140 --kpress(ALTMETA.."F3", "mod_query.query_exec(_)"),
142 --bdoc("Query for Lua code to execute."),
143 --kpress(META.."F3", "mod_query.query_lua(_)"),
145 --bdoc("Query for host to connect to with SSH."),
146 --kpress(ALTMETA.."F4", "mod_query.query_ssh(_, ':ssh')"),
148 --bdoc("Query for file to edit."),
149 --kpress(ALTMETA.."F5", "mod_query.query_editfile(_, 'run-mailcap --action=edit')"),
151 --bdoc("Query for file to view."),
152 --kpress(ALTMETA.."F6", "mod_query.query_runfile(_, 'run-mailcap --action=view')"),
154 --bdoc("Query for workspace to go to or create a new one."),
155 --kpress(ALTMETA.."F9", "mod_query.query_workspace(_)"),
157 bdoc("Query for a client window to go to."),
158 kpress(META.."G", "mod_query.query_gotoclient(_)"),
160 bdoc("Display context menu."),
161 kpress(META.."M", "mod_query.query_menu(_, _sub, 'ctxmenu', 'Context menu:')"),
162 kpress(META.."Shift+M", "mod_menu.menu(_, _sub, 'ctxmenu')"),
166 -- WFrame context bindings
168 -- These bindings are common to all types of frames. Some additional
169 -- frame bindings are found in some modules' configuration files.
171 defbindings("WFrame", {
173 bdoc("Maximize the frame horizontally/vertically."),
174 kpress("H", "WFrame.maximize_horiz(_)"),
175 kpress("V", "WFrame.maximize_vert(_)"),
178 bdoc("Display context menu."),
179 mpress("Button3", "mod_menu.pmenu(_, _sub, 'ctxmenu')"),
181 bdoc("Begin move/resize mode."),
182 kpress(META.."R", "WFrame.begin_kbresize(_)"),
184 bdoc("Switch the frame to display the object indicated by the tab."),
185 mclick("Button1@tab", "WFrame.p_switch_tab(_)"),
186 mclick("Button2@tab", "WFrame.p_switch_tab(_)"),
188 bdoc("Resize the frame."),
189 mdrag("Button1@border", "WFrame.p_resize(_)"),
190 mdrag(META.."Button3", "WFrame.p_resize(_)"),
192 bdoc("Move the frame."),
193 mdrag(META.."Button1", "WFrame.p_move(_)"),
195 bdoc("Move objects between frames by dragging and dropping the tab."),
196 mdrag("Button1@tab", "WFrame.p_tabdrag(_)"),
197 mdrag("Button2@tab", "WFrame.p_tabdrag(_)"),
201 -- Frames for transient windows ignore this bindmap
203 defbindings("WFrame.toplevel", {
204 bdoc("Query for a client window to attach."),
205 kpress(META.."A", "mod_query.query_attachclient(_)"),
207 bdoc("Switch to next/previous object within the frame."),
208 kpress(META.."Right", "WFrame.switch_next(_)"),
209 kpress(META.."Left", "WFrame.switch_prev(_)"),
211 bdoc("Move current object within the frame left/right."),
212 kpress(META.."Shift+Left", "WFrame.dec_index(_, _sub)", "_sub:non-nil"),
213 kpress(META.."Shift+Right", "WFrame.inc_index(_, _sub)", "_sub:non-nil"),
216 -- Display tab numbers when modifiers are released
217 submap_wait("ioncore.tabnum.show(_)"),
219 bdoc("Switch to n:th object within the frame."),
220 kpress("1", "WFrame.switch_nth(_, 0)"),
221 kpress("2", "WFrame.switch_nth(_, 1)"),
222 kpress("3", "WFrame.switch_nth(_, 2)"),
223 kpress("4", "WFrame.switch_nth(_, 3)"),
224 kpress("5", "WFrame.switch_nth(_, 4)"),
225 kpress("6", "WFrame.switch_nth(_, 5)"),
226 kpress("7", "WFrame.switch_nth(_, 6)"),
227 kpress("8", "WFrame.switch_nth(_, 7)"),
228 kpress("9", "WFrame.switch_nth(_, 8)"),
229 kpress("0", "WFrame.switch_nth(_, 9)"),
231 --bdoc("Switch to next/previous object within the frame."),
232 --kpress("N", "WFrame.switch_next(_)"),
233 --kpress("P", "WFrame.switch_prev(_)"),
235 --bdoc("Move current object within the frame left/right."),
236 --kpress("comma", "WFrame.dec_index(_, _sub)", "_sub:non-nil"),
237 --kpress("period", "WFrame.inc_index(_, _sub)", "_sub:non-nil"),
239 bdoc("Maximize the frame horizontally/vertically."),
240 kpress("H", "WFrame.maximize_horiz(_)"),
241 kpress("V", "WFrame.maximize_vert(_)"),
243 bdoc("Attach tagged objects to this frame."),
244 kpress("A", "ioncore.tagged_attach(_)"),
248 -- Bindings for floating frames.
250 defbindings("WFrame.floating", {
251 bdoc("Toggle shade mode"),
252 mdblclick("Button1@tab", "WFrame.set_shaded(_, 'toggle')"),
254 bdoc("Raise the frame."),
255 mpress("Button1@tab", "WRegion.rqorder(_, 'front')"),
256 mpress("Button1@border", "WRegion.rqorder(_, 'front')"),
257 mclick(META.."Button1", "WRegion.rqorder(_, 'front')"),
259 bdoc("Lower the frame."),
260 mclick(META.."Button3", "WRegion.rqorder(_, 'back')"),
262 bdoc("Move the frame."),
263 mdrag("Button1@tab", "WFrame.p_move(_)"),
267 -- WMoveresMode context bindings
269 -- These bindings are available keyboard move/resize mode. The mode
270 -- is activated on frames with the command begin_kbresize (bound to
271 -- META.."R" above by default).
273 defbindings("WMoveresMode", {
274 bdoc("Cancel the resize mode."),
275 kpress("AnyModifier+Escape","WMoveresMode.cancel(_)"),
277 bdoc("End the resize mode."),
278 kpress("AnyModifier+Return","WMoveresMode.finish(_)"),
280 bdoc("Grow in specified direction."),
281 kpress("Left", "WMoveresMode.resize(_, 1, 0, 0, 0)"),
282 kpress("Right", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
283 kpress("Up", "WMoveresMode.resize(_, 0, 0, 1, 0)"),
284 kpress("Down", "WMoveresMode.resize(_, 0, 0, 0, 1)"),
285 kpress("F", "WMoveresMode.resize(_, 1, 0, 0, 0)"),
286 kpress("B", "WMoveresMode.resize(_, 0, 1, 0, 0)"),
287 kpress("P", "WMoveresMode.resize(_, 0, 0, 1, 0)"),
288 kpress("N", "WMoveresMode.resize(_, 0, 0, 0, 1)"),
290 bdoc("Shrink in specified direction."),
291 kpress("Shift+Left", "WMoveresMode.resize(_,-1, 0, 0, 0)"),
292 kpress("Shift+Right", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
293 kpress("Shift+Up", "WMoveresMode.resize(_, 0, 0,-1, 0)"),
294 kpress("Shift+Down", "WMoveresMode.resize(_, 0, 0, 0,-1)"),
295 kpress("Shift+F", "WMoveresMode.resize(_,-1, 0, 0, 0)"),
296 kpress("Shift+B", "WMoveresMode.resize(_, 0,-1, 0, 0)"),
297 kpress("Shift+P", "WMoveresMode.resize(_, 0, 0,-1, 0)"),
298 kpress("Shift+N", "WMoveresMode.resize(_, 0, 0, 0,-1)"),
300 bdoc("Move in specified direction."),
301 kpress(META.."Left", "WMoveresMode.move(_,-1, 0)"),
302 kpress(META.."Right", "WMoveresMode.move(_, 1, 0)"),
303 kpress(META.."Up", "WMoveresMode.move(_, 0,-1)"),
304 kpress(META.."Down", "WMoveresMode.move(_, 0, 1)"),
305 kpress(META.."F", "WMoveresMode.move(_,-1, 0)"),
306 kpress(META.."B", "WMoveresMode.move(_, 1, 0)"),
307 kpress(META.."P", "WMoveresMode.move(_, 0,-1)"),
308 kpress(META.."N", "WMoveresMode.move(_, 0, 1)"),
318 defmenu("mainmenu", {
319 menuentry("Run...", "mod_query.query_exec(_)"),
320 menuentry("Terminal", "ioncore.exec_on(_, XTERM or 'x-terminal-emulator')"),
321 menuentry("Lock screen",
322 "ioncore.exec_on(_, ioncore.lookup_script('ion-lock'))"),
323 menuentry("Help", "mod_query.query_man(_)"),
324 menuentry("About Ion", "mod_query.show_about_ion(_)"),
325 submenu("Styles", "stylemenu"),
326 submenu("Debian", "Debian"),
327 submenu("Session", "sessionmenu"),
331 -- Session control menu
332 defmenu("sessionmenu", {
333 menuentry("Save", "ioncore.snapshot()"),
334 menuentry("Restart", "ioncore.restart()"),
335 menuentry("Restart TWM", "ioncore.restart_other('twm')"),
336 menuentry("Exit", "ioncore.shutdown()"),
340 -- Context menu (frame actions etc.)
341 defctxmenu("WFrame", "Frame", {
342 -- Note: this propagates the close to any subwindows; it does not
343 -- destroy the frame itself, unless empty. An entry to destroy tiled
344 -- frames is configured in cfg_tiling.lua.
345 menuentry("Close", "WRegion.rqclose_propagate(_, _sub)"),
346 -- Low-priority entries
347 menuentry("Attach tagged", "ioncore.tagged_attach(_)", { priority = 0 }),
348 menuentry("Clear tags", "ioncore.tagged_clear()", { priority = 0 }),
349 menuentry("Window info", "mod_query.show_tree(_, _sub)", { priority = 0 }),
353 -- Context menu for groups (workspaces, client windows)
354 defctxmenu("WGroup", "Group", {
355 menuentry("Toggle tag", "WRegion.set_tagged(_, 'toggle')"),
356 menuentry("De/reattach", "ioncore.detach(_, 'toggle')"),
360 -- Context menu for workspaces
361 defctxmenu("WGroupWS", "Workspace", {
362 menuentry("Close", "WRegion.rqclose(_)"),
363 menuentry("Rename", "mod_query.query_renameworkspace(nil, _)"),
364 menuentry("Attach tagged", "ioncore.tagged_attach(_)"),
368 -- Context menu for client windows
369 defctxmenu("WClientWin", "Client window", {
370 menuentry("Kill", "WClientWin.kill(_)"),
373 -- Auto-generated Debian menu definitions
374 if os and os.execute("test -x /usr/bin/update-menus") == 0 then
375 if ioncore.is_i18n() then
376 dopath("debian-menu-i18n")
378 dopath("debian-menu")