Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BINDINGS FORMAT

Asciio processes external configuration files that dynamically define the application’s keybindings, keybindings structure, and context menus.

These files are valid Perl scripts, you can defined code to bind to in the files but we recommend you create a module instead.

Action Definition Commands

Use the following commands to define commands:

Subroutine NamePurposeData Format Expected
register_action_handlersDefines actions, and multi-level action groups.
register_action_handlers_with_overrideAs above but also deletes old shortcutslist of key-value pairs
TOP_LEVEL_GROUPDefines the content of the top-level grouping used for menu displayshortcut and a list of action
GROUPUsed to declare a nested, ordered, action group.
USE_GROUPbinds a shortcut with a group
CONTEXT_MENUDefines actions that are only accessible via a context menu

Action Definition Formats

The definitions passed to register_action_handlers can take two primary forms:

  • Single Action
  • Group Definition

Single Action Definition

Single action definition are declared within a pair of square brackets (a Perl array ref).

IndexDefinesTypePurpose
0SHORTCUTSScalar or ArrayRefThe keybindings that trigger the action
1CODECodeRefThe Perl subroutine reference to execute when the shortcut is pressed.
2ARGUMENTSScalar or ArrayRefOptional arguments to be passed to the CODE subroutine.
3OPTIONSHashRefOptional hash of flags or attributes for the binding

Example of Single Action:


register_action_handlers
(
'Undo' => 
    [ 
        ['C00-z', '000-u'],                      # [0] SHORTCUTS
        \&App::Asciio::Actions::Unsorted::undo,  # [1] CODE
        -1,                                      # [2] optional ARGUMENTS
        { ... },                                 # [3] optional BINDING OPTIONS
    ],

# ... more  bindings
);

Binding Options

  • HIDE => 1/0, controls if this binding is shown in the bindings help

GROUP Definition

Used for defining a collection of related commands.

The commands typically share a single shortcut that, when pressed, switches the application’s context to the commands defined within the group.

Group Control Keys

The definition must contain the following control keys at the top-level of the group:

KeyTypePurpose
SHORTCUTSScalar or ArrayRefThe keybinding(s) that activate/enter this group
ENTER_GROUPCodeRef,ArrayRef or undefOptional code to execute when the group is activated.
ESCAPE_KEYSScalar or ArrayRefOptional keybinding(s) that deactivate/exit the group
ESCAPE_GROUPCodeRefOptional code to execute when the group is exited.
CAPTURE_KEYSPass as sub to ENTER_GROUP if you just want to capture keys
HIDEScalar (0 or 1)Optional atrribute, the group is hidden from bindingsdisplays.

Group Actions

Following the control keys, an the ordered list of actions:

TypePurpose
ArrayRefA Single Action Definition
GROUPA Nested Group Definition
USE_GROUPCommand to switches to another group.

Example of Group Definition:

register_action_handlers
(
'grouping ->' => 
    GROUP # create a GROUP
        (
        # control keys
        SHORTCUTS   => '000-g',
        ESCAPE_KEYS => '000-Escape',

        # Single element
        'selected elements' => [ '000-g', \&App::Asciio::Actions::ElementsManipulation::group_selected_elements ],

        # Nested Group
        'Subgroup' => GROUP
                        ( 
                        SHORTCUTS => '000-a',
                        'Align top' => ['000-t', \&App::Asciio::Actions::Align::align, 'top'],
                        ),

        'Enter Other Group' => USE_GROUP('other_group_name'),
        ),

# ... other actions
);
        
'group_other_group_name' => GROUP ( ...), # note that 'group_' is needed in the declaration of groups referred to by USE_GROUP