2 -- PWM bindings configuration file. Global bindings and bindings common
3 -- to screens and all types of frames only. See modules' configuration
4 -- files for other bindings.
7 -- Load a library to create menu display callbacks.
9 -- Load a library to create common queries.
10 --include("querylib.lua")
15 -- Global bindings are available all the time. The functions given here
16 -- should accept WScreens as parameter.
18 -- The variable DEFAULT_MOD should contain a string of the form 'Mod1+'
19 -- where Mod1 maybe replaced with the modifier you want to use for most
20 -- of the bindings. Similarly SECOND_MOD may be redefined to add a
21 -- modifier to some of the F-key bindings.
24 kpress(DEFAULT_MOD.."1", function(s) s:switch_nth(0) end),
25 kpress(DEFAULT_MOD.."2", function(s) s:switch_nth(1) end),
26 kpress(DEFAULT_MOD.."3", function(s) s:switch_nth(2) end),
27 kpress(DEFAULT_MOD.."4", function(s) s:switch_nth(3) end),
28 kpress(DEFAULT_MOD.."5", function(s) s:switch_nth(4) end),
29 kpress(DEFAULT_MOD.."6", function(s) s:switch_nth(5) end),
30 kpress(DEFAULT_MOD.."7", function(s) s:switch_nth(6) end),
31 kpress(DEFAULT_MOD.."8", function(s) s:switch_nth(7) end),
32 kpress(DEFAULT_MOD.."9", function(s) s:switch_nth(8) end),
33 kpress(DEFAULT_MOD.."0", function(s) s:switch_nth(9) end),
34 kpress(DEFAULT_MOD.."Left", WScreen.switch_prev),
35 kpress(DEFAULT_MOD.."Right", WScreen.switch_next),
37 submap(DEFAULT_MOD.."K", {
38 kpress("AnyModifier+K", goto_previous),
39 kpress("AnyModifier+T", clear_tags),
42 kpress(DEFAULT_MOD.."Shift+1", function() goto_nth_screen(0) end),
43 kpress(DEFAULT_MOD.."Shift+2", function() goto_nth_screen(1) end),
44 kpress(DEFAULT_MOD.."Shift+Left", goto_next_screen),
45 kpress(DEFAULT_MOD.."Shift+Right", goto_prev_screen),
47 kpress(DEFAULT_MOD.."F1", function(scr)
48 -- Display PWM manual page
49 local m=lookup_script("ion-man")
51 exec_in(scr, m.." pwm")
54 kpress("F2", make_exec_fn("xterm")),
56 -- Create a new workspace with a default name.
57 kpress(DEFAULT_MOD.."F9",
59 scr:attach_new({ type=default_ws_type, switchto=true })
64 -- KEYF11 and KEYF12 are normally defined to be the strings "F11"
65 -- and "F12", respectively, but on SunOS, they're something else
66 -- (although the keys on the keyboard are the same).
67 kpress(SECOND_MOD..KEYF12, make_bigmenu_fn("mainmenu")),
68 mpress("Button2", make_pmenu_fn("windowlist")),
69 mpress("Button3", make_pmenu_fn("mainmenu")),
75 -- These bindings work in frames and on screens. The innermost of such
76 -- objects always gets to handle the key press. Essentially these bindings
77 -- are used to define actions on client windows. (Remember that client
78 -- windows can be put in fullscreen mode and therefore may not have a
81 -- The make_*_fn functions are used to call functions on the object currently
82 -- managed by the screen or frame or the frame itself. Essentially e.g.
83 -- make_mplex_clientwin_fn(fn) expands to
85 -- function(mplex, sub)
86 -- local reg=(sub or mplex:current())
87 -- if obj_is(reg, "WClientWin") then
92 -- For details see the document "Ion: Configuring and extending with Lua".
95 kpress_waitrel(DEFAULT_MOD.."C", WMPlex.close_sub_or_self),
96 kpress_waitrel(DEFAULT_MOD.."L",
97 make_mplex_clientwin_fn(WClientWin.broken_app_resize_kludge)),
98 kpress_waitrel(DEFAULT_MOD.."Return",
99 make_mplex_clientwin_fn(WClientWin.toggle_fullscreen)),
101 submap(DEFAULT_MOD.."K", {
102 kpress("AnyModifier+C",
103 make_mplex_clientwin_fn(WClientWin.kill)),
104 kpress("AnyModifier+Q",
105 make_mplex_clientwin_fn(WClientWin.quote_next)),
112 -- These bindings are common to all types of frames. The rest of frame
113 -- bindings that differ between frame types are defined in the modules'
114 -- configuration files.
118 kpress(DEFAULT_MOD.."T", make_mplex_sub_fn(WRegion.toggle_tag)),
120 submap(DEFAULT_MOD.."K", {
121 -- Selected object/tab switching
122 kpress("AnyModifier+N", WGenFrame.switch_next),
123 kpress("AnyModifier+P", WGenFrame.switch_prev),
124 kpress("AnyModifier+1", function(f) f:switch_nth(0) end),
125 kpress("AnyModifier+2", function(f) f:switch_nth(1) end),
126 kpress("AnyModifier+3", function(f) f:switch_nth(2) end),
127 kpress("AnyModifier+4", function(f) f:switch_nth(3) end),
128 kpress("AnyModifier+5", function(f) f:switch_nth(4) end),
129 kpress("AnyModifier+6", function(f) f:switch_nth(5) end),
130 kpress("AnyModifier+7", function(f) f:switch_nth(6) end),
131 kpress("AnyModifier+8", function(f) f:switch_nth(7) end),
132 kpress("AnyModifier+9", function(f) f:switch_nth(8) end),
133 kpress("AnyModifier+0", function(f) f:switch_nth(9) end),
135 kpress("AnyModifier+H", WGenFrame.maximize_horiz),
136 kpress("AnyModifier+V", WGenFrame.maximize_vert),
137 -- Attach tagged objects
138 kpress("AnyModifier+A", WGenFrame.attach_tagged),
143 kpress(DEFAULT_MOD.."A", querylib.query_attachclient),
144 kpress(DEFAULT_MOD.."G", querylib.query_gotoclient),
145 kpress(SECOND_MOD.."F1", querylib.query_man),
146 kpress(SECOND_MOD.."F3", querylib.query_exec),
147 kpress(DEFAULT_MOD.."F3", querylib.query_lua),
148 kpress(SECOND_MOD.."F4", querylib.query_ssh),
149 kpress(SECOND_MOD.."F5", querylib.query_editfile),
150 kpress(SECOND_MOD.."F6", querylib.query_runfile),
151 kpress(SECOND_MOD.."F9", querylib.query_workspace),
154 kpress(DEFAULT_MOD.."M", make_menu_fn("ctxmenu")),
155 mpress("Button3", make_pmenu_fn("ctxmenu"), "tab"),