Functions

auto_exclusive_zone_enable (window)

auto_exclusive_zone_is_enabled (window)

get_anchor (window, edge)

get_exclusive_zone (window)

get_keyboard_mode (window)

get_layer (window)

get_major_version ()

get_margin (window, edge)

get_micro_version ()

get_minor_version ()

get_monitor (window)

get_namespace (window)

get_protocol_version ()

get_zwlr_layer_surface_v1 (window)

init_for_window (window)

is_layer_window (window)

is_supported ()

set_anchor (window, edge, anchor_to_edge)

set_exclusive_zone (window, exclusive_zone)

set_keyboard_mode (window, mode)

set_layer (window, layer)

set_margin (window, edge, margin_size)

set_monitor (window, monitor)

set_namespace (window, name_space)

Details

Gtk4LayerShell.auto_exclusive_zone_enable(window)
Parameters:

window (Gtk.Window) – A layer surface.

When auto exclusive zone is enabled, exclusive zone is automatically set to the size of the window + relevant margin. To disable auto exclusive zone, just set the exclusive zone to 0 or any other fixed value.

NOTE: you can control the auto exclusive zone by changing the margin on the non-anchored edge. This behavior is specific to gtk4-layer-shell and not part of the underlying protocol

Gtk4LayerShell.auto_exclusive_zone_is_enabled(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

if the surface’s exclusive zone is set to change based on the window’s size

Return type:

bool

Gtk4LayerShell.get_anchor(window, edge)
Parameters:
Returns:

if this surface is anchored to the given edge.

Return type:

bool

Gtk4LayerShell.get_exclusive_zone(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

the window’s exclusive zone (which may have been set manually or automatically)

Return type:

int

Gtk4LayerShell.get_keyboard_mode(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

current keyboard interactivity mode for window.

Return type:

Gtk4LayerShell.KeyboardMode

Gtk4LayerShell.get_layer(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

the current layer.

Return type:

Gtk4LayerShell.Layer

Gtk4LayerShell.get_major_version()
Returns:

the major version number of the GTK Layer Shell library

Return type:

int

Gtk4LayerShell.get_margin(window, edge)
Parameters:
Returns:

the size of the margin for the given edge.

Return type:

int

Gtk4LayerShell.get_micro_version()
Returns:

the micro/patch version number of the GTK Layer Shell library

Return type:

int

Gtk4LayerShell.get_minor_version()
Returns:

the minor version number of the GTK Layer Shell library

Return type:

int

Gtk4LayerShell.get_monitor(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

the monitor this surface will/has requested to be on, can be None.

Return type:

Gdk.Monitor

NOTE: To get which monitor the surface is actually on, use gdk_display_get_monitor_at_window().

Gtk4LayerShell.get_namespace(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

a reference to the namespace property. If namespace is unset, returns the default namespace (“gtk4-layer-shell”). Never returns None.

Return type:

str

NOTE: this function does not return ownership of the string. Do not free the returned string. Future calls into the library may invalidate the returned string.

Gtk4LayerShell.get_protocol_version()
Returns:

version of the zwlr_layer_shell_v1 protocol supported by the compositor or 0 if the protocol is not supported.

Return type:

int

May block for a Wayland roundtrip the first time it’s called.

Gtk4LayerShell.get_zwlr_layer_surface_v1(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

The underlying layer surface Wayland object

Return type:

object or None

Gtk4LayerShell.init_for_window(window)
Parameters:

window (Gtk.Window) – A Gtk.Window to be turned into a layer surface.

Set the window up to be a layer surface once it is mapped. this must be called before the window is realized.

Gtk4LayerShell.is_layer_window(window)
Parameters:

window (Gtk.Window) – A Gtk.Window that may or may not have a layer surface.

Returns:

if window has been initialized as a layer surface.

Return type:

bool

Gtk4LayerShell.is_supported()
Returns:

True if the platform is Wayland and Wayland compositor supports the zwlr_layer_shell_v1 protocol.

Return type:

bool

May block for a Wayland roundtrip the first time it’s called.

Gtk4LayerShell.set_anchor(window, edge, anchor_to_edge)
Parameters:

Set whether window should be anchored to edge.

  • If two perpendicular edges are anchored, the surface with be anchored to that corner

  • If two opposite edges are anchored, the window will be stretched across the screen in that direction

Default is False for each Gtk4LayerShell.Edge

Gtk4LayerShell.set_exclusive_zone(window, exclusive_zone)
Parameters:
  • window (Gtk.Window) – A layer surface.

  • exclusive_zone (int) – The size of the exclusive zone.

Has no effect unless the surface is anchored to an edge. Requests that the compositor does not place other surfaces within the given exclusive zone of the anchored edge. For example, a panel can request to not be covered by maximized windows. See wlr-layer-shell-unstable-v1.xml for details.

Default is 0

Gtk4LayerShell.set_keyboard_mode(window, mode)
Parameters:

Sets if/when window should receive keyboard events from the compositor, see Gtk4LayerShell.KeyboardMode for details.

Default is Gtk4LayerShell.KeyboardMode.NONE

Gtk4LayerShell.set_layer(window, layer)
Parameters:

Set the “layer” on which the surface appears (controls if it is over top of or below other surfaces). The layer may be changed on-the-fly in the current version of the layer shell protocol, but on compositors that only support an older version the window is remapped so the change can take effect.

Default is Gtk4LayerShell.Layer.TOP

Gtk4LayerShell.set_margin(window, edge, margin_size)
Parameters:

Set the margin for a specific edge of a window. Effects both surface’s distance from the edge and its exclusive zone size (if auto exclusive zone enabled).

Default is 0 for each Gtk4LayerShell.Edge

Gtk4LayerShell.set_monitor(window, monitor)
Parameters:
  • window (Gtk.Window) – A layer surface.

  • monitor (Gdk.Monitor) – The output this layer surface will be placed on (None to let the compositor decide).

Set the output for the window to be placed on, or None to let the compositor choose. If the window is currently mapped, it will get remapped so the change can take effect.

Default is None

Gtk4LayerShell.set_namespace(window, name_space)
Parameters:
  • window (Gtk.Window) – A layer surface.

  • name_space (str) – The namespace of this layer surface.

Set the “namespace” of the surface.

No one is quite sure what this is for, but it probably should be something generic (“panel”, “osk”, etc). The name_space string is copied, and caller maintains ownership of original. If the window is currently mapped, it will get remapped so the change can take effect.

Default is “gtk4-layer-shell” (which will be used if set to None)