v2026.5.3
All Bundles
Bundle GTK3 GUI toolkit bindings for building native desktop applications on Linux. Wraps GtkApplication and GtkWindow lifecycle, focus management, and window relationships. Compile with -lib gtk3.

GtkWindow

A GtkWindow is a toplevel window which can contain other widgets. Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,...)

Operations

ActivateFocus #

Activates the current focused widget within the window

method : public : ActivateFocus() ~ Bool

Return

TypeDescription
Booltrue if a widget was focused and activated

GetDefaultWidget #

Gets the default widget for the window — the widget activated when the user presses Enter

method : public : GetDefaultWidget() ~ GtkWidget

Return

TypeDescription
GtkWidgetdefault GtkWidget

GetFocus #

Gets the widget that currently has keyboard focus within the window

method : public : GetFocus() ~ GtkWidget

Return

TypeDescription
GtkWidgetfocused GtkWidget, Nil if no widget has focus

GetRole #

Returns the role of the window. See gtk_window_set_role() for further explanation

method : public : GetRole() ~ String

Return

TypeDescription
Stringthe role of the window if set, or Nil

GetTitle #

Retrieves the title of the window

method : public : GetTitle() ~ String

Return

TypeDescription
Stringthe title of the window, or Nil if none has

New # constructor

Creates a new #GtkWindow, which is a toplevel window that can contain other widgets

New(type:GtkWindowType)

Parameters

NameTypeDescription
typeGtkWindowTypewindow type

RemoveAccelGroup #

Removes the accelerator group

method : public : RemoveAccelGroup(accel_group:GtkAccelGroup) ~ Nil

Parameters

NameTypeDescription
accel_groupGtkAccelGroupthe GtkAccelGroup

SetAttachedTo #

Attaches the window to a specific widget, used for popup-style windows

method : public : SetAttachedTo(attach_widget:GtkWidget) ~ Nil

Parameters

NameTypeDescription
attach_widgetGtkWidgetwidget to attach to

SetRole #

This function is only useful on X11, not with other GTK+ targets. In combination with the window title, the window role allows a [window manager][gtk-X11-arch] to identify "the same" window when an application is restarted.

method : public : SetRole(role:String) ~ Nil

Parameters

NameTypeDescription
roleStringunique identifier for the window to be used when restoring a session

SetTransientFor #

Sets the transient parent window. A transient window is kept above its parent and minimized/destroyed with it.

method : public : SetTransientFor(parent:GtkWindow) ~ Nil

Parameters

NameTypeDescription
parentGtkWindowparent GtkWindow