Functions

auto_exclusive_zone_enable (window)

auto_exclusive_zone_is_enabled (window)

get_anchor (window, edge)

get_exclusive_zone (window)

get_keyboard_interactivity (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_interactivity (window, interactivity)

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

GtkLayerShell.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 gtk-layer-shell and not part of the underlying protocol

GtkLayerShell.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

New in version 0.5.

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

if this surface is anchored to the given edge.

Return type:

bool

New in version 0.5.

GtkLayerShell.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

New in version 0.5.

GtkLayerShell.get_keyboard_interactivity(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

if keyboard interactivity is enabled

Return type:

bool

New in version 0.5.

Deprecated since version 0.6: Use GtkLayerShell.get_keyboard_mode () instead.

GtkLayerShell.get_keyboard_mode(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

current keyboard interactivity mode for window.

Return type:

GtkLayerShell.KeyboardMode

New in version 0.6.

GtkLayerShell.get_layer(window)
Parameters:

window (Gtk.Window) – A layer surface.

Returns:

the current layer.

Return type:

GtkLayerShell.Layer

New in version 0.5.

GtkLayerShell.get_major_version()
Returns:

the major version number of the GTK Layer Shell library

Return type:

int

New in version 0.4.

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

the size of the margin for the given edge.

Return type:

int

New in version 0.5.

GtkLayerShell.get_micro_version()
Returns:

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

Return type:

int

New in version 0.4.

GtkLayerShell.get_minor_version()
Returns:

the minor version number of the GTK Layer Shell library

Return type:

int

New in version 0.4.

GtkLayerShell.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().

New in version 0.5.

GtkLayerShell.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 (“gtk-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.

New in version 0.5.

GtkLayerShell.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.

New in version 0.6.

GtkLayerShell.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

New in version 0.4.

GtkLayerShell.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.

GtkLayerShell.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

New in version 0.5.

GtkLayerShell.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.

New in version 0.5.

GtkLayerShell.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 GtkLayerShell.Edge

GtkLayerShell.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

GtkLayerShell.set_keyboard_interactivity(window, interactivity)
Parameters:
  • window (Gtk.Window) – A layer surface.

  • interactivity (bool) – Whether the layer surface should receive keyboard events.

Whether the window should receive keyboard events from the compositor.

Default is False

Deprecated since version 0.6: Use GtkLayerShell.set_keyboard_mode () instead.

GtkLayerShell.set_keyboard_mode(window, mode)
Parameters:

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

Default is GtkLayerShell.KeyboardMode.NONE

New in version 0.6.

GtkLayerShell.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 GtkLayerShell.Layer.TOP

GtkLayerShell.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 GtkLayerShell.Edge

GtkLayerShell.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

GtkLayerShell.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 “gtk-layer-shell” (which will be used if set to None)