MCPcopy
hub / github.com/paperwm/PaperWM / registerAction

Function registerAction

keybindings.js:396–429  ·  view source on GitHub ↗
(actionName, handler, options)

Source from the content-addressed store, hash-verified

394 * }
395 */
396export function registerAction(actionName, handler, options) {
397 options = impliedOptions(options);
398
399 const {
400 settings,
401 opensNavigator,
402 } = options;
403
404 let mutterName, keyHandler;
405 if (settings) {
406 Utils.assert(actionName, "Schema action must have a name");
407 mutterName = actionName;
408 keyHandler = opensNavigator
409 ? asKeyHandler(Navigator.preview_navigate)
410 : asKeyHandler(handler);
411 } else {
412 // actionId, mutterName and keyHandler will be set if/when the action is bound
413 }
414
415 const action = {
416 id: Meta.KeyBindingAction.NONE,
417 name: actionName,
418 mutterName,
419 keyHandler,
420 handler,
421 options,
422 };
423
424 actions.push(action);
425 if (actionName)
426 nameMap[actionName] = action;
427
428 return action;
429}
430
431/**
432 * Bind a key to an action (possibly creating a new action)

Callers 5

registerPaperActionFunction · 0.85
registerNavigatorActionFunction · 0.85
registerMinimapActionFunction · 0.85
setupActionsFunction · 0.85
bindkeyFunction · 0.85

Calls 2

impliedOptionsFunction · 0.85
asKeyHandlerFunction · 0.85

Tested by

no test coverage detected