1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159
|
--
-- Ion bindings configuration file. Global bindings and bindings common
-- to screens and all types of frames only. See modules' configuration
-- files for other bindings.
--
-- 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. The functions given here
-- should accept WScreens as parameter.
--
-- The variable DEFAULT_MOD should contain a string of the form 'Mod1+'
-- where Mod1 maybe replaced with the modifier you want to use for most
-- of the bindings. Similarly SECOND_MOD may be redefined to add a
-- modifier to some of the F-key bindings.
global_bindings{
kpress(DEFAULT_MOD.."1", function(s) s:switch_nth(0) end),
kpress(DEFAULT_MOD.."2", function(s) s:switch_nth(1) end),
kpress(DEFAULT_MOD.."3", function(s) s:switch_nth(2) end),
kpress(DEFAULT_MOD.."4", function(s) s:switch_nth(3) end),
kpress(DEFAULT_MOD.."5", function(s) s:switch_nth(4) end),
kpress(DEFAULT_MOD.."6", function(s) s:switch_nth(5) end),
kpress(DEFAULT_MOD.."7", function(s) s:switch_nth(6) end),
kpress(DEFAULT_MOD.."8", function(s) s:switch_nth(7) end),
kpress(DEFAULT_MOD.."9", function(s) s:switch_nth(8) end),
kpress(DEFAULT_MOD.."0", function(s) s:switch_nth(9) end),
kpress(DEFAULT_MOD.."Left", WScreen.switch_prev),
kpress(DEFAULT_MOD.."Right", WScreen.switch_next),
submap(DEFAULT_MOD.."K", {
kpress("AnyModifier+K", goto_previous),
kpress("AnyModifier+T", clear_tags),
}),
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),
kpress(DEFAULT_MOD.."F1", function(scr)
-- Display Ion's manual page
local m=lookup_script("ion-man")
if m then
exec_in(scr, m.." ion2")
end
end),
kpress(SECOND_MOD.."F2", make_exec_fn("x-terminal-emulator")),
-- Create a new workspace with a default name.
kpress(DEFAULT_MOD.."F9",
function(scr)
scr:attach_new({ type=default_ws_type, switchto=true })
end),
-- Menus/queries
-- KEYF11 and KEYF12 are normally defined to be the strings "F11"
-- and "F12", respectively, but on SunOS, they're something else
-- (although the keys on the keyboard are the same).
kpress(SECOND_MOD..KEYF12, make_bigmenu_fn("mainmenu")),
mpress("Button2", make_pmenu_fn("windowlist")),
mpress("Button3", make_pmenu_fn("mainmenu")),
--kpress(DEFAULT_MOD.."Menu", make_bigmenu_fn("mainmenu")),
--kpress(SECOND_MOD..KEYF11, querylib.query_restart),
--kpress(SECOND_MOD..KEYF12, querylib.query_exit),
}
-- 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.)
--
-- The make_*_fn functions are used to call functions on the object currently
-- managed by the screen or frame or the frame itself. Essentially e.g.
-- make_mplex_clientwin_fn(fn) expands to
--
-- function(mplex, sub)
-- local reg=(sub or mplex:current())
-- if obj_is(reg, "WClientWin") then
-- fn(reg)
-- end
-- end
--
-- For details see the document "Ion: Configuring and extending with Lua".
mplex_bindings{
kpress_waitrel(DEFAULT_MOD.."C", WMPlex.close_sub_or_self),
kpress_waitrel(DEFAULT_MOD.."L",
make_mplex_clientwin_fn(WClientWin.broken_app_resize_kludge)),
kpress_waitrel(DEFAULT_MOD.."Return",
make_mplex_clientwin_fn(WClientWin.toggle_fullscreen)),
submap(DEFAULT_MOD.."K", {
kpress("AnyModifier+C",
make_mplex_clientwin_fn(WClientWin.kill)),
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{
-- Tag viewed object
kpress(DEFAULT_MOD.."T", make_mplex_sub_fn(WRegion.toggle_tag)),
submap(DEFAULT_MOD.."K", {
-- Selected object/tab switching
kpress("AnyModifier+N", WGenFrame.switch_next),
kpress("AnyModifier+P", WGenFrame.switch_prev),
kpress("AnyModifier+1", function(f) f:switch_nth(0) end),
kpress("AnyModifier+2", function(f) f:switch_nth(1) end),
kpress("AnyModifier+3", function(f) f:switch_nth(2) end),
kpress("AnyModifier+4", function(f) f:switch_nth(3) end),
kpress("AnyModifier+5", function(f) f:switch_nth(4) end),
kpress("AnyModifier+6", function(f) f:switch_nth(5) end),
kpress("AnyModifier+7", function(f) f:switch_nth(6) end),
kpress("AnyModifier+8", function(f) f:switch_nth(7) end),
kpress("AnyModifier+9", function(f) f:switch_nth(8) end),
kpress("AnyModifier+0", function(f) f:switch_nth(9) end),
-- Maximize
kpress("AnyModifier+H", WGenFrame.maximize_horiz),
kpress("AnyModifier+V", WGenFrame.maximize_vert),
-- Attach tagged objects
kpress("AnyModifier+A", WGenFrame.attach_tagged),
}),
-- Queries
kpress(DEFAULT_MOD.."A", querylib.query_attachclient),
kpress(DEFAULT_MOD.."G", querylib.query_gotoclient),
kpress(SECOND_MOD.."F1", querylib.query_man),
kpress(SECOND_MOD.."F3", querylib.query_exec),
kpress(DEFAULT_MOD.."F3", querylib.query_lua),
kpress(SECOND_MOD.."F4", querylib.query_ssh),
kpress(SECOND_MOD.."F5", querylib.query_editfile),
kpress(SECOND_MOD.."F6", querylib.query_runfile),
kpress(SECOND_MOD.."F9", querylib.query_workspace),
-- Menus
kpress(DEFAULT_MOD.."M", make_menu_fn("ctxmenu")),
mpress("Button3", make_pmenu_fn("ctxmenu"), "tab"),
}
|