Window#

class ignis.widgets.Widget.Window(namespace: str, monitor: int | None = None, anchor: list[str] | None = None, exclusivity: str = 'normal', layer: str = 'top', kb_mode: str = 'none', popup: bool = False, margin_bottom: int = 0, margin_left: int = 0, margin_right: int = 0, margin_top: int = 0, **kwargs)#

Bases: Gtk.Window

The top-level widget that contains everything.

Warning

Applying CSS styles directly to Widget.Window can cause various graphical glitches/bugs. It's highly recommended to set some container (for example, Widget.Box) or widget as a child and apply styles to it. For example:

from ignis.widgets import Widget

Widget.Window(
    namespace="some-window",
    # css_classes=['test-window'],  # don't do this!
    child=Widget.Box(
        css_classes=['test-window'],  # use this instead
        child=[...]
    )
)
Raises:

LayerShellNotSupportedError -- If the compositor does not support the Layer Shell protocol.

Widget.Window(
    namespace="example_window",
    child=Widget.Label(label='heh'),
    monitor=0,
    anchor=["top", "right"],
    exclusive=True,
    layer="top",
    kb_mode="none",
    popup=False
)
property namespace: str#
  • required, read-only

The name of the window, used to access it from the CLI and IgnisApp.

It must be unique. It is also the name of the layer.

property anchor: list[str] | None#
  • optional, read-write

A list of anchors. If the list is empty, the window will be centered on the screen. None will unset all anchors.

Default: None.

Anchors:
  • bottom

  • left

  • right

  • top

property exclusivity: str#
  • optional, read-write

Defines how the compositor should avoid occluding a window area with other surfaces/layers.

Default: normal.

Exclusivity:
  • ignore: Completely ignore other surfaces. This allows you to overlap other surfaces.

  • normal: The window will have no extra space and do not overlap other surfaces.

  • exclusive: The compositor will reserve extra space for this window.

property layer: str#
  • optional, read-write

The layer of the surface.

Default: top.

Layer:
  • background

  • bottom

  • top

  • overlay

property kb_mode: str#
  • optional, read-write

Whether the window should receive keyboard events from the compositor.

Default: none.

Keyboard mode:
  • none: This window should not receive keyboard events.

  • exclusive: This window should have exclusive focus if it is on the top or overlay layer.

  • on_demand: The user should be able to focus and unfocus this window.

property popup: bool#
  • optional, read-write

Whether the window should close on ESC.

Works only if kb_mode is set to exclusive or on_demand.

property input_width: int#
  • optional, read-write

The width at which the window can receive keyboard and mouse input. Must be > 0.

property input_height: int#
  • optional, read-write

The height at which the window can receive keyboard and mouse input. Must be > 0.

property margin_bottom: int#
  • optional, read-write

The bottom margin.

Default: 0.

property margin_left: int#
  • optional, read-write

The left margin.

Default: 0.

property margin_right: int#
  • optional, read-write

The right margin.

Default: 0.

property margin_top: int#
  • optional, read-write

The top margin.

Default: 0.