ShortcutsWindow


Object Hierarchy:

Gtk.ShortcutsWindow Gtk.ShortcutsWindow Gtk.ShortcutsWindow Gtk.Window Gtk.Window Gtk.Window->Gtk.ShortcutsWindow Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Window GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.ShortcutsWindow Gtk.Accessible->Gtk.Window Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.ShortcutsWindow Gtk.Buildable->Gtk.Window Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.ShortcutsWindow Gtk.ConstraintTarget->Gtk.Window Gtk.ConstraintTarget->Gtk.Widget Gtk.Native Gtk.Native Gtk.Native->Gtk.ShortcutsWindow Gtk.Native->Gtk.Window Gtk.Root Gtk.Root Gtk.Root->Gtk.ShortcutsWindow Gtk.Root->Gtk.Window Gtk.ShortcutManager Gtk.ShortcutManager Gtk.ShortcutManager->Gtk.ShortcutsWindow Gtk.ShortcutManager->Gtk.Window

Description:

[ CCode ( type_id = "gtk_shortcuts_window_get_type ()" ) ]
public sealed class ShortcutsWindow : Window, Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager

A `GtkShortcutsWindow` shows information about the keyboard shortcuts and gestures of an application.

The shortcuts can be grouped, and you can have multiple sections in this window, corresponding to the major modes of your application.

Additionally, the shortcuts can be filtered by the current view, to avoid showing information that is not relevant in the current application context.

The recommended way to construct a `GtkShortcutsWindow` is with [class@Gtk.Builder], by using the `<child>` tag to populate a `GtkShortcutsWindow` with one or more [class@Gtk.ShortcutsSection] objects, which contain one or more [class@Gtk.ShortcutsGroup] instances, which, in turn, contain [class@Gtk.ShortcutsShortcut] instances.

If you need to add a section programmatically, use [method@Gtk.ShortcutsWindow.add_section] instead of [method@Gtk.Window.set_child], as the shortcuts window manages its children directly.

A simple example:

![](gedit-shortcuts.png)

This example has as single section. As you can see, the shortcut groups are arranged in columns, and spread across several pages if there are too many to find on a single page.

The .ui file for this example can be found here.

An example with multiple views:

![](clocks-shortcuts.png)

This example shows a `GtkShortcutsWindow` that has been configured to show only the shortcuts relevant to the "stopwatch" view.

The .ui file for this example can be found here.

An example with multiple sections:

![](builder-shortcuts.png)

This example shows a `GtkShortcutsWindow` with two sections, "Editor Shortcuts" and "Terminal Shortcuts".

The .ui file for this example can be found here.

CSS nodes

`GtkShortcutsWindow` has a single CSS node with the name `window` and style class `.shortcuts`.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from interface Gtk.Native
All known members inherited from interface Gtk.Root
All known members inherited from interface Gtk.ShortcutManager