Adw.OverlaySplitView

g Adw.OverlaySplitView Adw.OverlaySplitView Adw.Swipeable Adw.Swipeable Adw.Swipeable->Adw.OverlaySplitView GObject.GInterface GObject.GInterface GObject.GInterface->Adw.Swipeable Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget 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.Widget->Adw.OverlaySplitView

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1), Adw.Swipeable (5)

Structs:

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

class

new ()

get_collapsed ()

get_content ()

get_enable_hide_gesture ()

get_enable_show_gesture ()

get_max_sidebar_width ()

get_min_sidebar_width ()

get_pin_sidebar ()

get_show_sidebar ()

get_sidebar ()

get_sidebar_position ()

get_sidebar_width_fraction ()

get_sidebar_width_unit ()

set_collapsed (collapsed)

set_content (content)

set_enable_hide_gesture (enable_hide_gesture)

set_enable_show_gesture (enable_show_gesture)

set_max_sidebar_width (width)

set_min_sidebar_width (width)

set_pin_sidebar (pin_sidebar)

set_show_sidebar (show_sidebar)

set_sidebar (sidebar)

set_sidebar_position (position)

set_sidebar_width_fraction (fraction)

set_sidebar_width_unit (unit)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Adw.Swipeable (5)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

collapsed

bool

r/w/en

content

Gtk.Widget

r/w/en

enable-hide-gesture

bool

r/w/en

enable-show-gesture

bool

r/w/en

max-sidebar-width

float

r/w/en

min-sidebar-width

float

r/w/en

pin-sidebar

bool

r/w/en

show-sidebar

bool

r/w/en

sidebar

Gtk.Widget

r/w/en

sidebar-position

Gtk.PackType

r/w/en

sidebar-width-fraction

float

r/w/en

sidebar-width-unit

Adw.LengthUnit

r/w/en

Signals

Inherited:

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

Fields

Inherited:

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

Class Details

class Adw.OverlaySplitView(**kwargs)
Bases:

Gtk.Widget, Adw.Swipeable

Abstract:

No

Structure:

Adw.OverlaySplitViewClass

A widget presenting sidebar and content side by side or as an overlay.

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

AdwOverlaySplitView has two children: sidebar and content, and displays them side by side.

When [property`OverlaySplitView`:py:data::collapsed<Adw.OverlaySplitView.props.collapsed>] is set to TRUE, the sidebar is instead shown as an overlay above the content widget.

The sidebar can be hidden or shown using the [property`OverlaySplitView`:py:data::show-sidebar<Adw.OverlaySplitView.props.show_sidebar>] property.

Sidebar can be displayed before or after the content, this can be controlled with the [property`OverlaySplitView`:py:data::sidebar-position<Adw.OverlaySplitView.props.sidebar_position>] property.

Collapsing the split view automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If this behavior is not desired, the [property`OverlaySplitView`:py:data::pin-sidebar<Adw.OverlaySplitView.props.pin_sidebar>] property can be used to override it.

AdwOverlaySplitView supports an edge swipe gesture for showing the sidebar, and a swipe from the sidebar for hiding it. Gestures are only supported on touchscreen, but not touchpad. Gestures can be controlled with the [property`OverlaySplitView`:py:data::enable-show-gesture<Adw.OverlaySplitView.props.enable_show_gesture>] and [property`OverlaySplitView`:py:data::enable-hide-gesture<Adw.OverlaySplitView.props.enable_hide_gesture>] properties.

See also [class`NavigationSplitView`].

AdwOverlaySplitView is typically used together with an [class`Breakpoint`] setting the collapsed property to TRUE on small widths, as follows:

``xml <object class=”AdwWindow”>

<property name=”width-request”>360</property> <property name=”height-request”>200</property> <property name=”default-width”>800</property> <property name=”default-height”>800</property> <child>

<object class=”AdwBreakpoint”>

<condition>max-width: 400sp</condition> <setter object=”split_view” property=”collapsed”>True</setter>

</object>

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

<object class=”AdwOverlaySplitView” id=”split_view”>
<property name=”sidebar”>

<!– … –>

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

<!– … –>

</property>

</object>

</property>

</object> ``

AdwOverlaySplitView is often used for implementing the utility pane pattern.

Sizing

When not collapsed, AdwOverlaySplitView changes the sidebar width depending on its own width.

If possible, it tries to allocate a fraction of the total width, controlled with the [property`OverlaySplitView`:py:data::sidebar-width-fraction<Adw.OverlaySplitView.props.sidebar_width_fraction>] property.

The sidebar also has minimum and maximum sizes, controlled with the [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>] properties.

The minimum and maximum sizes are using the length unit specified with the [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].

By default, sidebar is using 25% of the total width, with 180sp as the minimum size and 280sp as the maximum size.

When collapsed, the preferred width fraction is ignored and the sidebar uses [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>] when possible.

Header Bar Integration

When used inside AdwOverlaySplitView, [class`HeaderBar`] will automatically hide the window buttons in the middle.

Adw.OverlaySplitView as Gtk.Buildable

The AdwOverlaySplitView implementation of the [iface`Gtk`.Buildable] interface supports setting the sidebar widget by specifying “sidebar” as the “type” attribute of a <child> element, Specifying “content” child type or omitting it results in setting the content widget.

CSS nodes

AdwOverlaySplitView has a single CSS node with the name overlay-split-view.

It contains two nodes with the name widget, containing the sidebar and content children.

When not collapsed, they have the .sidebar-view and .content-view style classes respectively.

`` overlay-split-view ├── widget.sidebar-pane │ ╰── [sidebar child] ╰── widget.content-pane

╰── [content child]

``

When collapsed, the one containing the sidebar child has the .background style class and the other one has no style classes.

`` overlay-split-view ├── widget.background │ ╰── [sidebar child] ╰── widget

╰── [content child]

``

Accessibility

AdwOverlaySplitView uses the GTK_ACCESSIBLE_ROLE_GROUP role.

New in version 1.4.

classmethod new()
Returns:

the newly created AdwOverlaySplitView

Return type:

Gtk.Widget

Creates a new AdwOverlaySplitView.

New in version 1.4.

get_collapsed()
Returns:

whether self is collapsed

Return type:

bool

Gets whether self is collapsed.

New in version 1.4.

get_content()
Returns:

the content widget for self

Return type:

Gtk.Widget or None

Gets the content widget for self.

New in version 1.4.

get_enable_hide_gesture()
Returns:

TRUE if self can be closed with a swipe gesture

Return type:

bool

Gets whether self can be closed with a swipe gesture.

New in version 1.4.

get_enable_show_gesture()
Returns:

TRUE if self can be opened with a swipe gesture

Return type:

bool

Gets whether self can be opened with an edge swipe gesture.

New in version 1.4.

get_max_sidebar_width()
Returns:

the maximum width

Return type:

float

Gets the maximum sidebar width for self.

New in version 1.4.

get_min_sidebar_width()
Returns:

the minimum width

Return type:

float

Gets the minimum sidebar width for self.

New in version 1.4.

get_pin_sidebar()
Returns:

whether if the sidebar widget is pinned

Return type:

bool

Gets whether the sidebar widget is pinned for self.

New in version 1.4.

get_show_sidebar()
Returns:

TRUE if the sidebar widget is shown

Return type:

bool

Gets whether the sidebar widget is shown for self.

New in version 1.4.

get_sidebar()
Returns:

the sidebar widget for self

Return type:

Gtk.Widget or None

Gets the sidebar widget for self.

New in version 1.4.

get_sidebar_position()
Returns:

the sidebar position for self

Return type:

Gtk.PackType

Gets the sidebar position for self.

New in version 1.4.

get_sidebar_width_fraction()
Returns:

the preferred width fraction

Return type:

float

Gets the preferred sidebar width fraction for self.

New in version 1.4.

get_sidebar_width_unit()
Returns:

the length unit

Return type:

Adw.LengthUnit

Gets the length unit for minimum and maximum sidebar widths.

New in version 1.4.

set_collapsed(collapsed)
Parameters:

collapsed (bool) – whether self is collapsed

Sets whether self view is collapsed.

When collapsed, the sidebar widget is presented as an overlay above the content widget, otherwise they are displayed side by side.

New in version 1.4.

set_content(content)
Parameters:

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

Sets the content widget for self.

New in version 1.4.

set_enable_hide_gesture(enable_hide_gesture)
Parameters:

enable_hide_gesture (bool) – whether self can be closed with a swipe gesture

Sets whether self can be closed with a swipe gesture.

Only touchscreen swipes are supported.

New in version 1.4.

set_enable_show_gesture(enable_show_gesture)
Parameters:

enable_show_gesture (bool) – whether self can be opened with a swipe gesture

Sets whether self can be opened with an edge swipe gesture.

Only touchscreen swipes are supported.

New in version 1.4.

set_max_sidebar_width(width)
Parameters:

width (float) – the maximum width

Sets the maximum sidebar width for self.

Maximum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

New in version 1.4.

set_min_sidebar_width(width)
Parameters:

width (float) – the minimum width

Sets the minimum sidebar width for self.

Minimum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

New in version 1.4.

set_pin_sidebar(pin_sidebar)
Parameters:

pin_sidebar (bool) – whether to pin the sidebar widget

Sets whether the sidebar widget is pinned for self.

By default, collapsing self automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If set to TRUE, sidebar visibility never changes on its own.

New in version 1.4.

set_show_sidebar(show_sidebar)
Parameters:

show_sidebar (bool) – whether to show the sidebar widget

Sets whether the sidebar widget is shown for self.

New in version 1.4.

set_sidebar(sidebar)
Parameters:

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

Sets the sidebar widget for self.

New in version 1.4.

set_sidebar_position(position)
Parameters:

position (Gtk.PackType) – the new position

Sets the sidebar position for self.

If it’s set to GTK_PACK_START, the sidebar is displayed before the content, if GTK_PACK_END, it’s displayed after the content.

New in version 1.4.

set_sidebar_width_fraction(fraction)
Parameters:

fraction (float) – the preferred width fraction

Sets the preferred sidebar width as a fraction of the total width of self.

The preferred width is additionally limited by [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].

The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.

New in version 1.4.

set_sidebar_width_unit(unit)
Parameters:

unit (Adw.LengthUnit) – the length unit

Sets the length unit for minimum and maximum sidebar widths.

See [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].

New in version 1.4.

Property Details

Adw.OverlaySplitView.props.collapsed
Name:

collapsed

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the split view is collapsed.

When collapsed, the sidebar widget is presented as an overlay above the content widget, otherwise they are displayed side by side.

New in version 1.4.

Adw.OverlaySplitView.props.content
Name:

content

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The content widget.

New in version 1.4.

Adw.OverlaySplitView.props.enable_hide_gesture
Name:

enable-hide-gesture

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the sidebar can be closed with a swipe gesture.

Only touchscreen swipes are supported.

New in version 1.4.

Adw.OverlaySplitView.props.enable_show_gesture
Name:

enable-show-gesture

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the sidebar can be opened with an edge swipe gesture.

Only touchscreen swipes are supported.

New in version 1.4.

Adw.OverlaySplitView.props.max_sidebar_width
Name:

max-sidebar-width

Type:

float

Default Value:

280.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The maximum sidebar width.

Maximum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

New in version 1.4.

Adw.OverlaySplitView.props.min_sidebar_width
Name:

min-sidebar-width

Type:

float

Default Value:

180.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The minimum sidebar width.

Minimum width is affected by [property`OverlaySplitView`:py:data::sidebar-width-unit<Adw.OverlaySplitView.props.sidebar_width_unit>].

The sidebar widget can still be allocated with larger width if its own minimum width exceeds it.

New in version 1.4.

Adw.OverlaySplitView.props.pin_sidebar
Name:

pin-sidebar

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the sidebar widget is pinned.

By default, collapsing self automatically hides the sidebar widget, and uncollapsing it shows the sidebar. If set to TRUE, sidebar visibility never changes on its own.

New in version 1.4.

Adw.OverlaySplitView.props.show_sidebar
Name:

show-sidebar

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the sidebar widget is shown.

New in version 1.4.

Adw.OverlaySplitView.props.sidebar
Name:

sidebar

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The sidebar widget.

New in version 1.4.

Adw.OverlaySplitView.props.sidebar_position
Name:

sidebar-position

Type:

Gtk.PackType

Default Value:

Gtk.PackType.START

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The sidebar position.

If it’s set to GTK_PACK_START, the sidebar is displayed before the content, if GTK_PACK_END, it’s displayed after the content.

New in version 1.4.

Adw.OverlaySplitView.props.sidebar_width_fraction
Name:

sidebar-width-fraction

Type:

float

Default Value:

0.25

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The preferred sidebar width as a fraction of the total width.

The preferred width is additionally limited by [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].

The sidebar widget can be allocated with larger width if its own minimum width exceeds the preferred width.

New in version 1.4.

Adw.OverlaySplitView.props.sidebar_width_unit
Name:

sidebar-width-unit

Type:

Adw.LengthUnit

Default Value:

Adw.LengthUnit.SP

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The length unit for minimum and maximum sidebar widths.

See [property`OverlaySplitView`:py:data::min-sidebar-width<Adw.OverlaySplitView.props.min_sidebar_width>] and [property`OverlaySplitView`:py:data::max-sidebar-width<Adw.OverlaySplitView.props.max_sidebar_width>].

New in version 1.4.