portal

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 10 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 portal is the xdg-desktop-portal client side lys-shell needs: the Request/Response handshake and the ScreenCast session the recorder captures through (wayle-recorder portal.rs, which uses ashpd).

Index

Constants

View Source
const (
	BusName      = "org.freedesktop.portal.Desktop"
	ObjectPath   = dbus.ObjectPath("/org/freedesktop/portal/desktop")
	RequestIface = "org.freedesktop.portal.Request"
	SessionIface = "org.freedesktop.portal.Session"
)

Portal bus identity.

View Source
const (
	ResponseSuccess   uint32 = 0
	ResponseCancelled uint32 = 1
	ResponseOther     uint32 = 2
)

Response codes of org.freedesktop.portal.Request.Response.

View Source
const (
	SourceMonitor       uint32 = 1
	CursorHidden        uint32 = 1
	CursorEmbedded      uint32 = 2
	PersistUntilRevoked uint32 = 2
)

ScreenCast source types, cursor modes, and persist modes (the portal's bit values).

View Source
const FileChooserIface = "org.freedesktop.portal.FileChooser"

FileChooserIface is org.freedesktop.portal.FileChooser.

View Source
const ScreenCastIface = "org.freedesktop.portal.ScreenCast"

ScreenCastIface is org.freedesktop.portal.ScreenCast.

Variables

View Source
var ErrCancelled = errors.New("portal: request cancelled")

ErrCancelled is a request the user dismissed.

Functions

func OpenFile

func OpenFile(ctx context.Context, conn *dbus.Conn, title string, filters ...FileFilter) (string, error)

OpenFile asks the user for one file (GTK's FileDialog.open through the portal) and returns its local path. A dismissed chooser is ErrCancelled.

Types

type FileFilter

type FileFilter struct {
	Name     string
	Patterns []string
}

FileFilter is one named filter of glob patterns.

type Stream

type Stream struct {
	// Remote is the PipeWire remote the stream plays on; the caller
	// owns it and keeps it open for the capture's lifetime.
	Remote *os.File
	// Node is the PipeWire node id of the monitor.
	Node uint32
	// Width and Height are the stream size, zero when not reported.
	Width, Height int32
	// contains filtered or unexported fields
}

Stream is one negotiated ScreenCast stream.

func OpenScreenCast

func OpenScreenCast(ctx context.Context, conn *dbus.Conn, showCursor bool, stateDir string) (*Stream, error)

OpenScreenCast is open_screencast: one monitor, the cursor embedded or hidden, persisted until revoked with the restore token kept in stateDir (so the picker shows only on the first capture). stateDir "" keeps no token.

func (*Stream) Close

func (s *Stream) Close()

Close ends the portal session and the PipeWire remote.

Jump to

Keyboard shortcuts

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