Adw.Window

g Adw.Window Adw.Window GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Native Gtk.Native GObject.GInterface->Gtk.Native Gtk.Root Gtk.Root GObject.GInterface->Gtk.Root Gtk.ShortcutManager Gtk.ShortcutManager GObject.GInterface->Gtk.ShortcutManager GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Window Gtk.Window Gtk.Native->Gtk.Window Gtk.Root->Gtk.Window Gtk.ShortcutManager->Gtk.Window Gtk.Widget->Gtk.Window Gtk.Window->Adw.Window

Subclasses:

Adw.AboutWindow, Adw.PreferencesWindow

Methods

Inherited:

Gtk.Window (62), Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Gtk.Native (6), Gtk.Root (3)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

add_breakpoint (breakpoint)

get_adaptive_preview ()

get_content ()

get_current_breakpoint ()

get_dialogs ()

get_visible_dialog ()

set_adaptive_preview (adaptive_preview)

set_content (content)

Virtual Methods

Inherited:

Gtk.Window (5), Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Gtk.ShortcutManager (2)

Properties

Inherited:

Gtk.Window (25), Gtk.Widget (35), Gtk.Accessible (1)

Name

Type

Flags

Short Description

adaptive-preview

bool

r/w/en

content

Gtk.Widget

r/w/en

current-breakpoint

Adw.Breakpoint

r

dialogs

Gio.ListModel

r

visible-dialog

Adw.Dialog

r

Signals

Inherited:

Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Window (5), Gtk.Widget (13), GObject.Object (1)

Name

Type

Access

Description

parent_instance

Gtk.Window

r

Class Details

class Adw.Window(*args, **kwargs)
Bases:

Gtk.Window

Abstract:

No

Structure:

Adw.WindowClass

A freeform window.

<picture> <source srcset=”window-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”window.png” alt=”window”> </picture>

The AdwWindow widget is a subclass of [class`Gtk`.Window] which has no titlebar area. Instead, [class`ToolbarView`] can be used together with [class`HeaderBar`] or [class`Gtk`.HeaderBar] as follows:

``xml <object class=”AdwWindow”>

<property name=”content”>
<object class=”AdwToolbarView”>
<child type=”top”>

<object class=”AdwHeaderBar”/>

</child> <property name=”content”>

<!– … –>

</property>

</object>

</property>

</object> ``

Using [property`Gtk`.Window:titlebar] or [property`Gtk`.Window:child] is not supported and will result in a crash. Use [property`Window`:py:data::content<Adw.Window.props.content>] instead.

Dialogs

AdwWindow can contain [class`Dialog`]. Use [method`Dialog`.present] with the window or a widget within a window to show a dialog.

Breakpoints

AdwWindow can be used with [class`Breakpoint`] the same way as [class`BreakpointBin`]. Refer to that widget’s documentation for details.

Example:

``xml <object class=”AdwWindow”>

<property name=”content”>
<object class=”AdwToolbarView”>
<child type=”top”>

<object class=”AdwHeaderBar”/>

</child> <property name=”content”>

<!– … –>

</property> <child type=”bottom”>

<object class=”GtkActionBar” id=”bottom_bar”>

<property name=”revealed”>True</property> <property name=”visible”>False</property>

</object>

</child>

</object>

</property> <child>

<object class=”AdwBreakpoint”>

<condition>max-width: 500px</condition> <setter object=”bottom_bar” property=”visible”>True</setter>

</object>

</child>

</object> ``

When breakpoints are used, the minimum size must be larger than the smallest UI state. AdwWindow defaults to the minimum size of 360×200 px. If that’s too small, set the [property`Gtk`.Widget:width-request] and [property`Gtk`.Widget:height-request] properties manually.

Adaptive Preview

AdwWindow has a debug tool called adaptive preview. It can be opened from GTK Inspector or by pressing <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>M</kbd>, and controlled via the [property`Window`:py:data::adaptive-preview<Adw.Window.props.adaptive_preview>] property.

classmethod new()
Returns:

the newly created AdwWindow

Return type:

Gtk.Widget

Creates a new AdwWindow.

add_breakpoint(breakpoint)
Parameters:

breakpoint (Adw.Breakpoint) – the breakpoint to add

Adds breakpoint to self.

New in version 1.4.

get_adaptive_preview()
Returns:

whether adaptive preview is open.

Return type:

bool

Gets whether adaptive preview for self is currently open.

New in version 1.7.

get_content()
Returns:

the content widget of self

Return type:

Gtk.Widget or None

Gets the content widget of self.

This method should always be used instead of [method`Gtk`.Window.get_child].

get_current_breakpoint()
Returns:

the current breakpoint

Return type:

Adw.Breakpoint or None

Gets the current breakpoint.

New in version 1.4.

get_dialogs()
Returns:

a list model for the dialogs of self

Return type:

Gio.ListModel

Returns a [iface`Gio`.ListModel] that contains the open dialogs of self.

This can be used to keep an up-to-date view.

New in version 1.5.

get_visible_dialog()
Returns:

the visible dialog

Return type:

Adw.Dialog or None

Returns the currently visible dialog in self, if there’s one.

New in version 1.5.

set_adaptive_preview(adaptive_preview)
Parameters:

adaptive_preview (bool) – whether to open adaptive preview

Sets whether adaptive preview for self is currently open.

Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.

Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.

Most applications should not use this function.

New in version 1.7.

set_content(content)
Parameters:

content (Gtk.Widget or None) – the content widget

Sets the content widget of self.

This method should always be used instead of [method`Gtk`.Window.set_child].

Property Details

Adw.Window.props.adaptive_preview
Name:

adaptive-preview

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether adaptive preview is currently open.

Adaptive preview is a debugging tool used for testing the window contents at specific screen sizes, simulating mobile environment.

Adaptive preview can always be accessed from inspector. This function allows applications to open it manually.

Most applications should not use this property.

New in version 1.7.

Adw.Window.props.content
Name:

content

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The content widget.

This property should always be used instead of [property`Gtk`.Window:child].

Adw.Window.props.current_breakpoint
Name:

current-breakpoint

Type:

Adw.Breakpoint

Default Value:

None

Flags:

READABLE

The current breakpoint.

New in version 1.4.

Adw.Window.props.dialogs
Name:

dialogs

Type:

Gio.ListModel

Default Value:

None

Flags:

READABLE

The open dialogs.

New in version 1.5.

Adw.Window.props.visible_dialog
Name:

visible-dialog

Type:

Adw.Dialog

Default Value:

None

Flags:

READABLE

The currently visible dialog

New in version 1.5.