Skip to content

Gtk.ShortcutsShortcut

class — extends Widget, Accessible, Buildable, ConstraintTarget

:::warning Deprecated since 4.18 This API is deprecated. :::

A GtkShortcutsShortcut represents a single keyboard shortcut or gesture with a short text.

This widget is only meant to be used with GtkShortcutsWindow.

Properties

accel_size_group

accel_size_group: SizeGroup  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The size group for the accelerator portion of this shortcut.

This is used internally by GTK, and must not be modified by applications.

accelerator

accelerator: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The accelerator(s) represented by this object.

This property is used if ShortcutsShortcut.shortcut-type is set to ShortcutType.ACCELERATOR.

The syntax of this property is (an extension of) the syntax understood by accelerator_parse. Multiple accelerators can be specified by separating them with a space, but keep in mind that the available width is limited.

It is also possible to specify ranges of shortcuts, using ... between the keys. Sequences of keys can be specified using a + or & between the keys.

Examples:

  • A single shortcut: <ctl><alt>delete
  • Two alternative shortcuts: <shift>a Home
  • A range of shortcuts: <alt>1...<alt>9
  • Several keys pressed together: Control_L&Control_R
  • A sequence of shortcuts or keys: <ctl>c+<ctl>x

Use "+" instead of "&" when the keys may (or have to be) pressed sequentially (e.g use "t+t" for 'press the t key twice').

Note that <, > and & need to be escaped as &lt;, &gt; and &amp; when used in .ui files.

action_name

action_name: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

A detailed action name.

If this is set for a shortcut of type ShortcutType.ACCELERATOR, then GTK will use the accelerators that are associated with the action via Application.set_accels_for_action, and setting ShortcutsShortcut.accelerator is not necessary.

direction

direction: TextDirection | int  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The text direction for which this shortcut is active.

If the shortcut is used regardless of the text direction, set this property to TextDirection.NONE.

icon

icon: Gio.Icon  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

An icon to represent the shortcut or gesture.

This property is used if ShortcutsShortcut.shortcut-type is set to ShortcutType.GESTURE.

For the other predefined gesture types, GTK provides an icon on its own.

icon_set

icon_set: bool  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

True if an icon has been set.

shortcut_type

shortcut_type: ShortcutType | int  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The type of shortcut that is represented.

subtitle

subtitle: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The subtitle for the shortcut or gesture.

This is typically used for gestures and should be a short, one-line text that describes the gesture itself. For the predefined gesture types, GTK provides a subtitle on its own.

subtitle_set

subtitle_set: bool  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

True if a subtitle has been set.

title

title: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The textual description for the shortcut or gesture represented by this object.

This should be a short string that can fit in a single line.

title_size_group

title_size_group: SizeGroup  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The size group for the textual portion of this shortcut.

This is used internally by GTK, and must not be modified by applications.