-- -- Ion bindings configuration file. Global bindings and bindings common -- to screens and all types of frames only. See modules' configuration -- files for other bindings. -- -- The philosophy behind these is pretty simple. Almost everything uses Alt+Z -- as a prefix, much like screen's prefix key. This keeps the ion keybindings -- from interfering with other programs, most notably emacs. Stuff that's -- really useful is bound to Alt+, like moving among frames -- in a workspace. -- Load a library to create common queries. include("querylib") -- Load a library to create menu display callbacks. include("menulib") -- global_bindings -- -- Global bindings are available all the time. global_bindings{ -- Alt+Fn goes to specific workspaces. kpress(DEFAULT_MOD.."F1", function(s) s:switch_nth(0) end), kpress(DEFAULT_MOD.."F2", function(s) s:switch_nth(1) end), kpress(DEFAULT_MOD.."F3", function(s) s:switch_nth(2) end), kpress(DEFAULT_MOD.."F4", function(s) s:switch_nth(3) end), kpress(DEFAULT_MOD.."F5", function(s) s:switch_nth(4) end), kpress(DEFAULT_MOD.."F6", function(s) s:switch_nth(5) end), kpress(DEFAULT_MOD.."F7", function(s) s:switch_nth(6) end), kpress(DEFAULT_MOD.."F8", function(s) s:switch_nth(7) end), kpress(DEFAULT_MOD.."F9", function(s) s:switch_nth(8) end), kpress(DEFAULT_MOD.."F10", function(s) s:switch_nth(9) end), kpress(DEFAULT_MOD.."F11", function(s) s:switch_nth(10) end), kpress(DEFAULT_MOD.."F12", function(s) s:switch_nth(11) end), submap(DEFAULT_MOD.."Z", { -- I use AnyModifier so I can be lazy and hold down Alt or not, at my -- leisure. "]" was pretty much arbitrary, though it makes nice -- symmetry with using "[" for the window menu. kpress("AnyModifier+bracketright", make_bigmenu_fn("mainmenu")), -- Switching between monitors. kpress("AnyModifier+Left", goto_next_screen), kpress("AnyModifier+Right", goto_prev_screen), -- Very much based on screen. Alt+Z Alt+Z switches to the last used -- window. kpress("AnyModifier+Z", goto_previous), kpress("Control+T", clear_tags), }), -- Just so I can have Alt+Tab, too. kpress(DEFAULT_MOD.."Tab", goto_previous), -- For multimonitor stuff. These are the default keybindings; I haven't -- bothered with them because I only use one monitor. Some of these would -- even interfere with other bindings I'm using. --kpress(DEFAULT_MOD.."Shift+1", function() goto_nth_screen(0) end), --kpress(DEFAULT_MOD.."Shift+2", function() goto_nth_screen(1) end), --kpress(DEFAULT_MOD.."Shift+Left", goto_next_screen), --kpress(DEFAULT_MOD.."Shift+Right", goto_prev_screen), -- Generic shortcut bindings. submap(DEFAULT_MOD.."Z", { -- Create a new workspace with a default name. kpress("F9", function(scr) scr:attach_new({ type=default_ws_type, switchto=true }) end), -- Create a floating workspace. kpress("F10", function(scr) scr:attach_new({ type="WFloatWS", switchto=true }) end), kpress(KEYF11, querylib.query_restart), kpress(KEYF12, querylib.query_exit), }), -- Just in case I ever want to use a mouse. mpress("Button2", make_pmenu_fn("windowlist")), mpress("Button3", make_pmenu_fn("mainmenu")), -- No menu key on my keyboard, but it's a good idea, so I'll leave it in. --kpress(DEFAULT_MOD.."Menu", make_bigmenu_fn("mainmenu")), } -- mplex_bindings -- -- These bindings work in frames and on screens. The innermost of such -- objects always gets to handle the key press. Essentially these bindings -- are used to define actions on client windows. (Remember that client -- windows can be put in fullscreen mode and therefore may not have a -- frame.) mplex_bindings{ -- Fillscreen is nice sometimes. kpress_waitrel(DEFAULT_MOD.."Return", make_mplex_clientwin_fn(WClientWin.toggle_fullscreen)), submap(DEFAULT_MOD.."Z", { -- (C)lose kpress("AnyModifier+C", WMPlex.close_sub_or_self), -- Resize. Based on screen. kpress("Shift+F", make_mplex_clientwin_fn(WClientWin.broken_app_resize_kludge)), -- (K)ill kpress("AnyModifier+K", make_mplex_clientwin_fn(WClientWin.kill)), -- (Q)uote -- sends the next keypress through unmolested. Wish screen -- could do this. kpress("AnyModifier+Q", make_mplex_clientwin_fn(WClientWin.quote_next)), }), } -- genframe_bindings -- -- These bindings are common to all types of frames. The rest of frame -- bindings that differ between frame types are defined in the modules' -- configuration files. genframe_bindings{ -- Next and previous tab within a frame. I use these a lot. kpress(DEFAULT_MOD.."Shift+Right", WGenFrame.switch_next), kpress(DEFAULT_MOD.."Shift+Left", WGenFrame.switch_prev), -- Jump to a specific tab. Not one I use a lot, but occasionally useful. kpress(DEFAULT_MOD.."Shift+F1", function(f) f:switch_nth(0) end), kpress(DEFAULT_MOD.."Shift+F2", function(f) f:switch_nth(1) end), kpress(DEFAULT_MOD.."Shift+F3", function(f) f:switch_nth(2) end), kpress(DEFAULT_MOD.."Shift+F4", function(f) f:switch_nth(3) end), kpress(DEFAULT_MOD.."Shift+F5", function(f) f:switch_nth(4) end), kpress(DEFAULT_MOD.."Shift+F6", function(f) f:switch_nth(5) end), kpress(DEFAULT_MOD.."Shift+F7", function(f) f:switch_nth(6) end), kpress(DEFAULT_MOD.."Shift+F8", function(f) f:switch_nth(7) end), kpress(DEFAULT_MOD.."Shift+F9", function(f) f:switch_nth(8) end), kpress(DEFAULT_MOD.."Shift+F10", function(f) f:switch_nth(9) end), kpress(DEFAULT_MOD.."Shift+F11", function(f) f:switch_nth(9) end), kpress(DEFAULT_MOD.."Shift+F12", function(f) f:switch_nth(9) end), submap(DEFAULT_MOD.."Z", { -- The default bindings for maximize are annoying. Use a prefix and it -- goes one direction. No prefix and it goes the other way. My -- approach makes more sense, I think. Alt+Z M H for (M)aximize -- (H)orizontally and Alt+Z M V for (M)aximize (V)ertically. submap("M", { kpress("AnyModifier+H", WGenFrame.maximize_horiz), kpress("AnyModifier+V", WGenFrame.maximize_vert), }), -- (T)ag window. kpress("AnyModifier+T", make_mplex_sub_fn(WRegion.toggle_tag)), -- (A)ttach tagged windows to current frame. kpress("AnyModifier+A", WGenFrame.attach_tagged), -- Compliment to the main menu. kpress("bracketleft", make_menu_fn("ctxmenu")), }), -- Right-clicking on a tab will get you a window menu, too. mpress("Button3", make_pmenu_fn("ctxmenu"), "tab"), }