### Method

# Meta Display add_keybinding

#### Declaration [src]

    guint
    meta_display_add_keybinding (
      MetaDisplay* display,
      const char* name,
      GSettings* settings,
      MetaKeyBindingFlags flags,
      MetaKeyHandlerFunc handler,
      gpointer user_data,
      GDestroyNotify free_data
    )

#### Description [src]

Add a keybinding at runtime. The key `name` in `schema` needs to be of type `G_VARIANT_TYPE_STRING_ARRAY`, with each string describing a keybinding in the form of “<Control>a” or “<Shift><Alt>F1”. The parser is fairly liberal and allows lower or upper case, and also abbreviations such as “<Ctl>” and “<Ctrl>”. If the key is set to the empty list or a list with a single element of either “” or “disabled”, the keybinding is disabled.

Use `meta_display_remove_keybinding()` to remove the binding.

#### Parameters

`name`

  Type: `const char*`

  The binding’s name.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`settings`

  Type: `GSettings`

  The `GSettings` object where `name` is stored.

  The data is owned by the caller of the method.

`flags`

  Type: `MetaKeyBindingFlags`

  Flags to specify binding details.

`handler`

  Type: `MetaKeyHandlerFunc`

  Function to run when the keybinding is invoked.

`user_data`

  Type: `gpointer`

  The data to pass to `handler`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`free_data`

  Type: `GDestroyNotify`

  Function to free `user_data`.

#### Return value

Type: `guint`

The corresponding keybinding action if the keybinding was added successfully, otherwise `META_KEYBINDING_ACTION_NONE`.