1.216 <GtkWindow>

Class: <GtkWindow>

It derives from <GtkWidget>.

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,...).

GtkWindow as GtkBuildable

The <GtkWindow> implementation of the <GtkBuildable> interface supports setting a child as the titlebar by specifying “titlebar” as the “type” attribute of a <child> element.

Shortcuts and Gestures

<GtkWindow> supports the following keyboard shortcuts:

  • F10 activates the menubar, if present.
  • Alt makes the mnemonics visible while pressed.

The following signals have default keybindings:

Actions

<GtkWindow> defines a set of built-in actions:

  • default.activate activates the default widget.
  • window.minimize minimizes the window.
  • window.toggle-maximized maximizes or restores the window.
  • window.close closes the window.

CSS nodes

window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled]
├── <child>
╰── <titlebar child>.titlebar [.default-decoration]

<GtkWindow> has a main CSS node with name window and style class .background.

Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also represents window states with the following style classes on the main node: .maximized, .fullscreen, .tiled (when supported, also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom).

<GtkWindow> subclasses often add their own discriminating style classes, such as .dialog, .popup or .tooltip.

Generally, some CSS properties don’t make sense on the toplevel window node, such as margins or padding. When client-side decorations without invisible borders are in use (i.e. the .solid-csd style class is added to the main window node), the CSS border of the toplevel window is used for resize drags. In the .csd case, the shadow area outside of the window can be used to resize it.

<GtkWindow> adds the .titlebar and .default-decoration style classes to the widget that is added as a titlebar child.

Accessibility

<GtkWindow> uses the Gtk.AccessibleRole.window role.

From GTK 4.12 to 4.18, it used the Gtk.AccessibleRole.application role.

Fields

parent-instance

Properties

Property: window:application self

The <GtkApplication> associated with the window.

The application will be kept alive for at least as long as it has any windows associated with it (see application:hold for a way to keep it alive without windows).

Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the this property to NULL.

Its value is a <GtkApplication>, or #f.

Set it with (set! (window:application self) value).

Property: window:child self

The child widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (window:child self) value).

Property: window:decorated self

Whether the window should have a frame (also known as decorations).

Its value is a boolean.

Set it with (set! (window:decorated self) value).

Property: window:default-height self

The default height of the window.

Its value is a 32-bit integer.

Set it with (set! (window:default-height self) value).

Property: window:default-widget self

The default widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (window:default-widget self) value).

Property: window:default-width self

The default width of the window.

Its value is a 32-bit integer.

Set it with (set! (window:default-width self) value).

Property: window:deletable self

Whether the window frame should have a close button.

Its value is a boolean.

Set it with (set! (window:deletable self) value).

Property: window:destroy-with-parent self

If this window should be destroyed when the parent is destroyed.

Its value is a boolean.

Set it with (set! (window:destroy-with-parent self) value).

Property: window:display self

The display that will display this window.

Its value is a <GdkDisplay>, or #f.

Set it with (set! (window:display self) value).

Property: window:focus-visible self

Whether ’focus rectangles’ are currently visible in this window.

This property is maintained by GTK based on user input and should not be set by applications.

Its value is a boolean.

Set it with (set! (window:focus-visible self) value).

Property: window:focus-widget self

The focus widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (window:focus-widget self) value).

Property: window:fullscreened self

Whether the window is fullscreen.

Setting this property is the equivalent of calling window:fullscreen or window:unfullscreen; either operation is asynchronous, which means you will need to connect to the ::notify signal in order to know whether the operation was successful.

Its value is a boolean.

Set it with (set! (window:fullscreened self) value).

Property: window:gravity self

The gravity to use when resizing the window programmatically.

Gravity describes which point of the window we want to keep fixed (meaning that the window will grow in the opposite direction). For example, a gravity of top-right means that we want the to fix top right corner of the window.

Its value is a <GtkWindowGravity> (or, to set it, one of its symbols).

Set it with (set! (window:gravity self) value).

Property: window:handle-menubar-accel self

Whether the window frame should handle F10 for activating menubars.

Its value is a boolean.

Set it with (set! (window:handle-menubar-accel self) value).

Property: window:hide-on-close self

If this window should be hidden instead of destroyed when the user clicks the close button.

Its value is a boolean.

Set it with (set! (window:hide-on-close self) value).

Property: window:icon-name self

Specifies the name of the themed icon to use as the window icon.

See <GtkIconTheme> for more details.

Its value is a string, or #f.

Set it with (set! (window:icon-name self) value).

Property: window:is-active self

Whether the toplevel is the currently active window.

Its value is a boolean.

It is read only.

Property: window:maximized self

Whether the window is maximized.

Setting this property is the equivalent of calling window:maximize or window:unmaximize; either operation is asynchronous, which means you will need to connect to the ::notify signal in order to know whether the operation was successful.

Its value is a boolean.

Set it with (set! (window:maximized self) value).

Property: window:mnemonics-visible self

Whether mnemonics are currently visible in this window.

This property is maintained by GTK based on user input, and should not be set by applications.

Its value is a boolean.

Set it with (set! (window:mnemonics-visible self) value).

Property: window:modal self

If true, the window is modal.

Its value is a boolean.

Set it with (set! (window:modal self) value).

Property: window:resizable self

If true, users can resize the window.

Its value is a boolean.

Set it with (set! (window:resizable self) value).

Property: window:startup-id self

A write-only property for setting window’s startup notification identifier.

Its value is a string, or #f.

It can only be set, with (set! (window:startup-id self) value).

Property: window:suspended self

Whether the window is suspended.

See window:is-suspended? for details about what suspended means.

Its value is a boolean.

It is read only.

Property: window:title self

The title of the window.

Its value is a string, or #f.

Set it with (set! (window:title self) value).

Property: window:titlebar self

The titlebar widget.

Its value is a <GtkWidget>, or #f.

Set it with (set! (window:titlebar self) value).

Property: window:transient-for self

The transient parent of the window.

Its value is a <GtkWindow>, or #f.

Set it with (set! (window:transient-for self) value).

Procedures

Method: window:close self
Method: close self

Requests that the window is closed.

This is similar to what happens when a window manager close button is clicked.

This function can be used with close buttons in custom titlebars.

self

Passed: a <GtkWindow>.

a window

Method: window:destroy self
Method: destroy self

Drops the internal reference GTK holds on toplevel windows.

self

Passed: a <GtkWindow>.

the window to destroy

Method: window:fullscreen self
Method: fullscreen self

Asks to place the window in the fullscreen state.

Note that you shouldn’t assume the window is definitely fullscreen afterward, because other entities (e.g. the user or window manager) unfullscreen it again, and not all window managers honor requests to fullscreen windows.

If a window is not explicitly fullscreened or unfullscreened before it is shown, the initial state is at the window managers discretion.

You can track the result of this operation via the toplevel:state property, or by listening to notifications of the window:fullscreened property.

self

Passed: a <GtkWindow>.

a window

Method: window:fullscreen-on-monitor self monitor
Method: fullscreen-on-monitor self monitor

Asks to place the window in the fullscreen state on the given monitor.

Note that you shouldn’t assume the window is definitely fullscreen afterward, or that the windowing system allows fullscreen windows on any given monitor.

You can track the result of this operation via the toplevel:state property, or by listening to notifications of the window:fullscreened property.

self

Passed: a <GtkWindow>.

a window

monitor

Passed: a <GdkMonitor>.

which monitor to go fullscreen on

Method: window:get-application self ⇒ %return
Method: get-application self ⇒ %return

Gets the application object associated with the window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkApplication>, or #f.

the application

Method: window:get-child self ⇒ %return
Method: get-child self ⇒ %return

Gets the child widget of the window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWidget>, or #f.

the child widget of self

Method: window:get-decorated? self ⇒ %return
Method: get-decorated? self ⇒ %return

Returns whether the window has been set to have decorations.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window has been set to have decorations

Procedure: window:get-default-icon-name ⇒ %return

Returns the fallback icon name for windows.

The returned string is owned by GTK and should not be modified. It is only valid until the next call to window:set-default-icon-name.

%return

Returned: a string, or #f.

the fallback icon name for windows

Method: window:get-default-size self ⇒ width height
Method: get-default-size self ⇒ width height

Gets the default size of the window.

A value of 0 for the width or height indicates that a default size has not been explicitly set for that dimension, so the “natural” size of the window will be used.

This function is the recommended way for [saving window state across restarts of applications](https://developer.gnome.org/documentation/tutorials/save-state.html).

self

Passed: a <GtkWindow>.

a window

width

Returned: a 32-bit integer.

location to store the default width

height

Returned: a 32-bit integer.

location to store the default height

Method: window:get-default-widget self ⇒ %return
Method: get-default-widget self ⇒ %return

Returns the default widget for self.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWidget>, or #f.

the default widget

Method: window:get-deletable? self ⇒ %return
Method: get-deletable? self ⇒ %return

Returns whether the window has been set to have a close button.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window has been set to have a close button

Method: window:get-destroy-with-parent? self ⇒ %return
Method: get-destroy-with-parent? self ⇒ %return

Returns whether the window will be destroyed with its transient parent.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window will be destroyed with its transient parent

Method: window:get-focus self ⇒ %return
Method: get-focus self ⇒ %return

Retrieves the current focused widget within the window.

Note that this is the widget that would have the focus if the toplevel window focused; if the toplevel window is not focused then gtk_widget_has_focus (widget) will not be false for the widget.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWidget>, or #f.

the currently focused widget

Method: window:get-focus-visible? self ⇒ %return
Method: get-focus-visible? self ⇒ %return

Gets whether “focus rectangles” are supposed to be visible.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if “focus rectangles” are supposed to be visible in this window

Method: window:get-gravity self ⇒ %return
Method: get-gravity self ⇒ %return

Returns the gravity that is used when changing the window size programmatically.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWindowGravity>.

the gravity

Method: window:get-group self ⇒ %return
Method: get-group self ⇒ %return

Returns the group for the window.

If the window has no group, then the default group is returned.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWindowGroup>.

the window group for self or the default group

Method: window:get-handle-menubar-accel? self ⇒ %return
Method: get-handle-menubar-accel? self ⇒ %return

Returns whether this window reacts to F10 presses by activating a menubar it contains.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window handles F10

Method: window:get-hide-on-close? self ⇒ %return
Method: get-hide-on-close? self ⇒ %return

Returns whether the window will be hidden instead of destroyed when the close button is clicked.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window will be hidden

Method: window:get-icon-name self ⇒ %return
Method: get-icon-name self ⇒ %return

Returns the name of the themed icon for the window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a string, or #f.

the icon name

Method: window:get-mnemonics-visible? self ⇒ %return
Method: get-mnemonics-visible? self ⇒ %return

Gets whether mnemonics are supposed to be visible.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if mnemonics are supposed to be visible in this window

Method: window:get-modal? self ⇒ %return
Method: get-modal? self ⇒ %return

Returns whether the window is modal.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window is set to be modal and establishes a grab when shown

Method: window:get-resizable? self ⇒ %return
Method: get-resizable? self ⇒ %return

Gets whether the user can resize the window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the user can resize the window

Method: window:get-title self ⇒ %return
Method: get-title self ⇒ %return

Retrieves the title of the window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a string, or #f.

the title

Method: window:get-titlebar self ⇒ %return
Method: get-titlebar self ⇒ %return

Returns the titlebar that has been set with window:set-titlebar.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWidget>, or #f.

the titlebar

Procedure: window:get-toplevels ⇒ %return

Returns the list of all existing toplevel windows.

If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets or add new ones, be aware that the list of toplevels will change and emit the "items-changed" signal.

%return

Returned: a <GListModel>.

the list of toplevel widgets

Method: window:get-transient-for self ⇒ %return
Method: get-transient-for self ⇒ %return

Fetches the transient parent for this window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a <GtkWindow>, or #f.

the transient parent

Method: window:has-group? self ⇒ %return
Method: has-group? self ⇒ %return

Returns whether the window has an explicit window group.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if self has an explicit window group

Method: window:is-active? self ⇒ %return
Method: is-active? self ⇒ %return

Returns whether the window is part of the current active toplevel.

The active toplevel is the window receiving keystrokes.

The return value is #t if the window is active toplevel itself. You might use this function if you wanted to draw a widget differently in an active window from a widget in an inactive window.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

true if the window part of the current active window.

Method: window:is-fullscreen? self ⇒ %return
Method: is-fullscreen? self ⇒ %return

Retrieves the current fullscreen state of the window.

Note that since fullscreening is ultimately handled by the window manager and happens asynchronously to an application request, you shouldn’t assume the return value of this function changing immediately (or at all), as an effect of calling window:fullscreen or window:unfullscreen.

If the window isn’t yet mapped, the value returned will whether the initial requested state is fullscreen.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

whether the window is fullscreen

Method: window:is-maximized? self ⇒ %return
Method: is-maximized? self ⇒ %return

Retrieves the current maximized state of the window.

Note that since maximization is ultimately handled by the window manager and happens asynchronously to an application request, you shouldn’t assume the return value of this function changing immediately (or at all), as an effect of calling window:maximize or window:unmaximize.

If the window isn’t yet mapped, the value returned will whether the initial requested state is maximized.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

whether the window is maximized

Method: window:is-suspended? self ⇒ %return
Method: is-suspended? self ⇒ %return

Retrieves the current suspended state of the window.

A window being suspended means it’s currently not visible to the user, for example by being on a inactive workspace, minimized, obstructed.

self

Passed: a <GtkWindow>.

a window

%return

Returned: a boolean.

whether the window is suspended

Procedure: window:list-toplevels ⇒ %return

Returns the list of all existing toplevel windows.

The widgets in the list are not individually referenced. If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets, you must call g_list_foreach (result, (GFunc)g_object_ref, NULL) first, and then unref all the widgets afterwards.

%return

Returned: a list, each a <GtkWidget>.

list of toplevel widgets

Method: window:maximize self
Method: maximize self

Asks to maximize the window, so that it fills the screen.

Note that you shouldn’t assume the window is definitely maximized afterward, because other entities (e.g. the user or window manager) could unmaximize it again, and not all window managers support maximization.

It’s permitted to call this function before showing a window, in which case the window will be maximized when it appears onscreen initially.

If a window is not explicitly maximized or unmaximized before it is shown, the initial state is at the window managers discretion. For example, it might decide to maximize a window that almost fills the screen.

You can track the result of this operation via the toplevel:state property, or by listening to notifications on the window:maximized property.

self

Passed: a <GtkWindow>.

a window

Method: window:minimize self
Method: minimize self

Asks to minimize the window.

Note that you shouldn’t assume the window is definitely minimized afterward, because the windowing system might not support this functionality; other entities (e.g. the user or the window manager) could unminimize it again, or there may not be a window manager in which case minimization isn’t possible, etc.

It’s permitted to call this function before showing a window, in which case the window will be minimized before it ever appears onscreen.

You can track result of this operation via the toplevel:state property.

self

Passed: a <GtkWindow>.

a window

Procedure: window:new ⇒ %return

Creates a new <GtkWindow>.

To get an undecorated window (without window borders), use window:set-decorated.

All top-level windows created by this function are stored in an internal top-level window list. This list can be obtained from window:list-toplevels. Due to GTK keeping a reference to the window internally, this function does not return a reference to the caller.

To delete a <GtkWindow>, call window:destroy.

%return

Returned: a <GtkWidget>.

a new <GtkWindow>

Method: window:present self
Method: present self

Presents a window to the user.

This may mean raising the window in the stacking order, unminimizing it, moving it to the current desktop and/or giving it the keyboard focus (possibly dependent on the user’s platform, window manager and preferences).

If self is hidden, this function also makes it visible.

self

Passed: a <GtkWindow>.

a window

Method: window:present-with-time self timestamp
Method: present-with-time self timestamp

Presents a window to the user in response to an user interaction.

See window:present for more details.

The timestamp should be gathered when the window was requested to be shown (when clicking a link for example), rather than once the window is ready to be shown.

self

Passed: a <GtkWindow>.

a window

timestamp

Passed: an unsigned 32-bit integer.

the timestamp of the user interaction (typically a button or key press event) which triggered this call

Method: window:set-application self [application]
Method: set-application self [application]

Sets or unsets the application object associated with the window.

The application will be kept alive for at least as long as it has any windows associated with it (see application:hold for a way to keep it alive without windows).

Normally, the connection between the application and the window will remain until the window is destroyed, but you can explicitly remove it by setting the application to #f.

This is equivalent to calling application:remove-window and/or application:add-window on the old/new applications as relevant.

self

Passed: a <GtkWindow>.

a window

application

Passed, or left out: a <GtkApplication>, or #f.

a <GtkApplication>

Procedure: window:set-auto-startup-notification setting

Sets whether the window should request startup notification.

By default, after showing the first window, GTK calls toplevel:set-startup-id. Call this function to disable the automatic startup notification. You might do this if your first window is a splash screen, and you want to delay notification until after your real main window has been shown, for example.

In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.

setting

Passed: a boolean.

true to automatically do startup notification

Method: window:set-child self [child]
Method: set-child self [child]

Sets the child widget of the window.

self

Passed: a <GtkWindow>.

a window

child

Passed, or left out: a <GtkWidget>, or #f.

the child widget

Method: window:set-decorated self setting
Method: set-decorated self setting

Sets whether the window should be decorated.

By default, windows are decorated with a title bar, resize controls, etc. Some window managers allow GTK to disable these decorations, creating a borderless window. If you set the decorated property to false using this function, GTK will do its best to convince the window manager not to decorate the window. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling widget:show.

On Windows, this function always works, since there’s no window manager policy involved.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

true to decorate the window

Procedure: window:set-default-icon-name name

Sets an icon to be used as fallback.

The fallback icon is used for windows that haven’t had window:set-icon-name called on them.

name

Passed: a string.

the name of the themed icon

Method: window:set-default-size self width height
Method: set-default-size self width height

Sets the default size of a window.

The default size of a window is the size that will be used if no other constraints apply.

The default size will be updated whenever the window is resized to reflect the new size, unless the window is forced to a size, like when it is maximized or fullscreened.

If the window’s minimum size request is larger than the default, the default will be ignored.

Setting the default size to a value <= 0 will cause it to be ignored and the natural size request will be used instead. It is possible to do this while the window is showing to "reset" it to its initial size.

Unlike widget:set-size-request, which sets a size request for a widget and thus would keep users from shrinking the window, this function only sets the initial size, just as if the user had resized the window themselves. Users can still shrink the window again as they normally would. Setting a default size of -1 means to use the “natural” default size (the size request of the window).

If you use this function to reestablish a previously saved window size, note that the appropriate size to save is the one returned by window:get-default-size. Using the window allocation directly will not work in all circumstances and can lead to growing or shrinking windows.

self

Passed: a <GtkWindow>.

a window

width

Passed: a 32-bit integer.

width in pixels, or -1 to unset the default width

height

Passed: a 32-bit integer.

height in pixels, or -1 to unset the default height

Method: window:set-default-widget self [default-widget]
Method: set-default-widget self [default-widget]

Sets the default widget.

The default widget is the widget that is activated when the user presses Enter in a dialog (for example).

self

Passed: a <GtkWindow>.

a window

default-widget

Passed, or left out: a <GtkWidget>, or #f.

widget to be the default

Method: window:set-deletable self setting
Method: set-deletable self setting

Sets whether the window should be deletable.

By default, windows have a close button in the window frame. Some window managers allow GTK to disable this button. If you set the deletable property to false using this function, GTK will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible, so you should call it before calling widget:show.

On Windows, this function always works, since there’s no window manager policy involved.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

true to decorate the window as deletable

Method: window:set-destroy-with-parent self setting
Method: set-destroy-with-parent self setting

Sets whether to destroy the window when the transient parent is destroyed.

This is useful for dialogs that shouldn’t persist beyond the lifetime of the main window they are associated with, for example.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

whether to destroy the window with its transient parent

Method: window:set-display self display
Method: set-display self display

Sets the display where the window is displayed.

If the window is already mapped, it will be unmapped, and then remapped on the new display.

self

Passed: a <GtkWindow>.

a window

display

Passed: a <GdkDisplay>.

a display

Method: window:set-focus self [focus]
Method: set-focus self [focus]

Sets the focus widget.

If focus is not the current focus widget, and is focusable, sets it as the focus widget for the window. If focus is #f, unsets the focus widget for this window. To set the focus to a particular widget in the toplevel, it is usually more convenient to use widget:grab-focus? instead of this function.

self

Passed: a <GtkWindow>.

a window

focus

Passed, or left out: a <GtkWidget>, or #f.

the new focus widget

Method: window:set-focus-visible self setting
Method: set-focus-visible self setting

Sets whether “focus rectangles” are supposed to be visible.

This property is maintained by GTK based on user input, and should not be set by applications.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

the new value

Method: window:set-gravity self gravity
Method: set-gravity self gravity

Sets the gravity that is used when changing the window size programmatically.

self

Passed: a <GtkWindow>.

a window

gravity

Passed: a <GtkWindowGravity>, or one of its symbols.

the new gravity

Method: window:set-handle-menubar-accel self handle-menubar-accel
Method: set-handle-menubar-accel self handle-menubar-accel

Sets whether this window should react to F10 presses by activating a menubar it contains.

self

Passed: a <GtkWindow>.

a window

handle-menubar-accel

Passed: a boolean.

true to make self handle F10

Method: window:set-hide-on-close self setting
Method: set-hide-on-close self setting

Sets whether clicking the close button will hide the window instead of destroying it.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

whether to hide the window when it is closed

Method: window:set-icon-name self [name]
Method: set-icon-name self [name]

Sets the icon for the window from a named themed icon.

See the docs for <GtkIconTheme> for more details. On some platforms, the window icon is not used at all.

Note that this has nothing to do with the WM_ICON_NAME property which is mentioned in the ICCCM.

self

Passed: a <GtkWindow>.

a window

name

Passed, or left out: a string, or #f.

the name of the themed icon

Procedure: window:set-interactive-debugging enable

Opens or closes the interactive debugger.

The debugger offers access to the widget hierarchy of the application and to useful debugging tools.

This function allows applications that already use Ctrl+Shift+I (or Ctrl+Shift+D) for their own key shortcuts to add a different shortcut to open the Inspector.

If you are not overriding the default key shortcuts for the Inspector, you should not use this function.

enable

Passed: a boolean.

true to enable interactive debugging

Method: window:set-mnemonics-visible self setting
Method: set-mnemonics-visible self setting

Sets whether mnemonics are supposed to be visible.

This property is maintained by GTK based on user input, and should not be set by applications.

self

Passed: a <GtkWindow>.

a window

setting

Passed: a boolean.

the new value

Method: window:set-modal self modal
Method: set-modal self modal

Sets a window modal or non-modal.

Modal windows prevent interaction with other windows in the same application. To keep modal dialogs on top of main application windows, use window:set-transient-for to make the dialog transient for the parent; most window managers will then disallow lowering the dialog below the parent.

self

Passed: a <GtkWindow>.

a window

modal

Passed: a boolean.

whether the window is modal

Method: window:set-resizable self resizable
Method: set-resizable self resizable

Sets whether the user can resize a window.

Windows are user resizable by default.

self

Passed: a <GtkWindow>.

a window

resizable

Passed: a boolean.

true if the user can resize this window

Method: window:set-startup-id self startup-id
Method: set-startup-id self startup-id

Sets the startup notification ID.

Startup notification identifiers are used by desktop environment to track application startup, to provide user feedback and other features. This function changes the corresponding property on the underlying <GdkSurface>.

Normally, startup identifier is managed automatically and you should only use this function in special cases like transferring focus from other processes. You should use this function before calling window:present or any equivalent function generating a window map event.

This function is only useful on Wayland or X11, not with other GDK backends.

self

Passed: a <GtkWindow>.

a window

startup-id

Passed: a string.

a string with startup-notification identifier

Method: window:set-title self [title]
Method: set-title self [title]

Sets the title of the window.

The title of a window will be displayed in its title bar; on the X Window System, the title bar is rendered by the window manager so exactly how the title appears to users may vary according to a user’s exact configuration. The title should help a user distinguish this window from other windows they may have open. A good title might include the application name and current document filename, for example.

Passing NULL does the same as setting the title to an empty string.

self

Passed: a <GtkWindow>.

a window

title

Passed, or left out: a string, or #f.

title of the window

Method: window:set-titlebar self [titlebar]
Method: set-titlebar self [titlebar]

Sets a custom titlebar for the window.

A typical widget used here is <GtkHeaderBar>, as it provides various features expected of a titlebar while allowing the addition of child widgets to it.

If you set a custom titlebar, GTK will do its best to convince the window manager not to put its own titlebar on the window. Depending on the system, this function may not work for a window that is already visible, so you set the titlebar before calling widget:show.

self

Passed: a <GtkWindow>.

a window

titlebar

Passed, or left out: a <GtkWidget>, or #f.

the widget to use as titlebar

Method: window:set-transient-for self [parent]
Method: set-transient-for self [parent]

Sets a transient parent for the window.

Dialog windows should be set transient for the main application window they were spawned from. This allows window managers to e.g. keep the dialog on top of the main window, or center the dialog over the main window. Gtk.Dialog.new_with_buttons and other convenience functions in GTK will sometimes call this function on your behalf.

Passing NULL for parent unsets the current transient window.

On Windows, this function puts the child window on top of the parent, much as the window manager would have done on X.

self

Passed: a <GtkWindow>.

a window

parent

Passed, or left out: a <GtkWindow>, or #f.

parent window

Method: window:unfullscreen self
Method: unfullscreen self

Asks to remove the fullscreen state for the window, and return to its previous state.

Note that you shouldn’t assume the window is definitely not fullscreen afterward, because other entities (e.g. the user or window manager) could fullscreen it again, and not all window managers honor requests to unfullscreen windows; normally the window will end up restored to its normal state. Just don’t write code that crashes if not.

If a window is not explicitly fullscreened or unfullscreened before it is shown, the initial state is at the window managers discretion.

You can track the result of this operation via the toplevel:state property, or by listening to notifications of the window:fullscreened property.

self

Passed: a <GtkWindow>.

a window

Method: window:unmaximize self
Method: unmaximize self

Asks to unmaximize the window.

Note that you shouldn’t assume the window is definitely unmaximized afterward, because other entities (e.g. the user or window manager) maximize it again, and not all window managers honor requests to unmaximize.

If a window is not explicitly maximized or unmaximized before it is shown, the initial state is at the window managers discretion. For example, it might decide to maximize a window that almost fills the screen.

You can track the result of this operation via the toplevel:state property, or by listening to notifications on the window:maximized property.

self

Passed: a <GtkWindow>.

a window

Method: window:unminimize self
Method: unminimize self

Asks to unminimize the window.

Note that you shouldn’t assume the window is definitely unminimized afterward, because the windowing system might not support this functionality; other entities (e.g. the user or the window manager) could minimize it again, or there may not be a window manager in which case minimization isn’t possible, etc.

You can track result of this operation via the toplevel:state property.

self

Passed: a <GtkWindow>.

a window

Signals

Signal: window:activate-default

Connect a handler with (connect object window:activate-default handler). It is called as (handler self).

Emitted when the user activates the default widget.

This is a keybinding signal.

The keybindings for this signal are all forms of the Enter key.

self

Passed: a <GtkWindow>.

Signal: window:activate-focus

Connect a handler with (connect object window:activate-focus handler). It is called as (handler self).

Emitted when the user activates the currently focused widget of window.

This is a keybinding signal.

The default binding for this signal is ␣.

self

Passed: a <GtkWindow>.

Signal: window:close-request

Connect a handler with (connect object window:close-request handler). It is called as (handler self) ⇒ %return.

Emitted when the user clicks on the close button of the window.

self

Passed: a <GtkWindow>.

%return

Returned: a boolean.

true to stop other handlers from being invoked for the signal

Signal: window:enable-debugging

Connect a handler with (connect object window:enable-debugging handler). It is called as (handler self toggle) ⇒ %return.

Emitted when the user enables or disables interactive debugging.

When toggle is true, interactive debugging is toggled on or off, when it is false, the debugger will be pointed at the widget under the pointer.

This is a keybinding signal.

The default bindings for this signal are Ctrl+Shift+I and Ctrl+Shift+D.

self

Passed: a <GtkWindow>.

toggle

Passed: a boolean.

toggle the debugger

%return

Returned: a boolean.

true if the key binding was handled

Signal: window:keys-changed

Connect a handler with (connect object window:keys-changed handler). It is called as (handler self).

Emitted when the set of accelerators or mnemonics that are associated with the window changes.

self

Passed: a <GtkWindow>.

Virtual methods

Virtual method: window:do-activate-default implementor self

Activates the default widget for the window.

To override it in a new class, give register-type #:vfuncs `((activate-default . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkWindow>, or a class that derives from it, or its GType number.

self

Passed: a <GtkWindow>.

Virtual method: window:do-activate-focus implementor self

Activates the current focused widget within the window.

To override it in a new class, give register-type #:vfuncs `((activate-focus . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkWindow>, or a class that derives from it, or its GType number.

self

Passed: a <GtkWindow>.

Virtual method: window:do-close-request implementor self ⇒ %return

Class handler for the "close-request" signal.

To override it in a new class, give register-type #:vfuncs `((close-request . ,procedure)). The procedure is called as (procedure self) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkWindow>, or a class that derives from it, or its GType number.

self

Passed: a <GtkWindow>.

%return

Returned: a boolean.

Whether the window should be destroyed

Virtual method: window:do-enable-debugging implementor self toggle ⇒ %return

Class handler for the window:enable-debugging keybinding signal.

To override it in a new class, give register-type #:vfuncs `((enable-debugging . ,procedure)). The procedure is called as (procedure self toggle) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkWindow>, or a class that derives from it, or its GType number.

self

Passed: a <GtkWindow>.

toggle

Passed: a boolean.

%return

Returned: a boolean.

Virtual method: window:do-keys-changed implementor self

Signal gets emitted when the set of accelerators or mnemonics that are associated with window changes.

To override it in a new class, give register-type #:vfuncs `((keys-changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkWindow>, or a class that derives from it, or its GType number.

self

Passed: a <GtkWindow>.