toplevels

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toplevels follows the compositor's windows over zwlr_foreign_toplevel_management_v1 on a private Wayland connection: each window's app id and whether it is the activated one. lys-ui keeps its own foreign-toplevel list internal, so this binds the protocol directly.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("toplevels: the compositor offers no " + managerIface)

ErrUnsupported is a compositor without the foreign-toplevel manager.

Functions

This section is empty.

Types

type Watcher

type Watcher struct {
	// contains filtered or unexported fields
}

Watcher follows the windows until Close or until the compositor goes away, which closes Ended. One goroutine reads the connection and alone closes it: Close asks the compositor to stop, and the read loop ends on its finished event.

func Watch

func Watch(changed func()) (*Watcher, error)

Watch connects to the compositor named by WAYLAND_DISPLAY and follows its windows; changed runs on the watcher's goroutine after every batch that changes what Windows reports.

func (*Watcher) Close

func (w *Watcher) Close()

Close stops following the windows and waits for the connection to close. When the stop cannot be sent the connection is already broken, and the read loop ends on that.

func (*Watcher) Ended

func (w *Watcher) Ended() <-chan struct{}

Ended closes once the connection is gone; Err then says why.

func (*Watcher) Err

func (w *Watcher) Err() error

Err is why the connection ended, nil before it has or after Close.

func (*Watcher) HandleDisplayDeleteId

func (w *Watcher) HandleDisplayDeleteId(ev wl.DisplayDeleteIdEvent)

HandleDisplayDeleteId frees a destroyed handle's id.

func (*Watcher) HandleRegistryGlobal

func (w *Watcher) HandleRegistryGlobal(ev wl.RegistryGlobalEvent)

HandleRegistryGlobal binds the manager.

func (*Watcher) HandleRegistryGlobalRemove

func (w *Watcher) HandleRegistryGlobalRemove(wl.RegistryGlobalRemoveEvent)

HandleRegistryGlobalRemove ignores globals going away; the manager's windows close on their own.

func (*Watcher) HandleZwlrForeignToplevelManagerV1Finished

func (w *Watcher) HandleZwlrForeignToplevelManagerV1Finished(wlr.ZwlrForeignToplevelManagerV1FinishedEvent)

HandleZwlrForeignToplevelManagerV1Finished ends the read loop: the compositor sends no more after it.

func (*Watcher) HandleZwlrForeignToplevelManagerV1Toplevel

func (w *Watcher) HandleZwlrForeignToplevelManagerV1Toplevel(ev wlr.ZwlrForeignToplevelManagerV1ToplevelEvent)

HandleZwlrForeignToplevelManagerV1Toplevel follows a new window.

func (*Watcher) Windows

func (w *Watcher) Windows() []Window

Windows is every open window, in the order they appeared.

type Window

type Window struct {
	AppID     string
	Activated bool
}

Window is one window as its latest done batch left it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL