sharepicker

package
v0.3.25 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 29 Imported by: 1 module, 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 sharepicker is the screencast source picker (crates/lys-shell/src/shell/share_picker) the portal pops over dev.stubbe.lys.SharePicker1: a layer surface with Windows, Outputs, Region and, where the compositor offers its cast target, Dynamic pages. A card or region confirms at once in single-select mode; in multi-select mode cards toggle into a pending set the Share button confirms. The keyboard drives all of it: the opened page's first card holds the focus, Ctrl+PageUp/PageDown switch pages, the arrows move to the nearest card that way, and Enter or Space chooses. The reply is the XDPH selection suffix - `[r]/window:<id>`, `/screen:<name>`, `/region:<out>@x,y,w,h`, `/dynamic`, several payloads joined by `;` - or empty on cancel.

Index

Constants

View Source
const (
	ServiceName = "dev.stubbe.lys.SharePicker1"
	ServicePath = "/dev/stubbe/lys/SharePicker"
)

D-Bus identity (wayle-ipc's share_picker proxy).

Variables

This section is empty.

Functions

func JoinTargets added in v0.2.0

func JoinTargets(targets []Target) string

JoinTargets writes targets as ParseTargets reads them.

Types

type Client

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

Client calls the daemon: the `lys-shell portal share-picker` stub XDPH execs, and the portal backend's ScreenCast source selection.

func NewClient

func NewClient(conn *dbus.Conn) *Client

NewClient addresses the daemon over conn.

func (*Client) Dismiss

func (c *Client) Dismiss(ctx context.Context, handle string) error

Dismiss cancels the picker showing for the request at handle.

func (*Client) Pick

func (c *Client) Pick(ctx context.Context, caller portaldialogs.Caller, r Request) (string, error)

Pick asks the shell to show the picker; see Daemon.Pick.

func (*Client) PickWindow added in v0.3.14

func (c *Client) PickWindow(ctx context.Context, caller portaldialogs.Caller, r WindowRequest) (string, error)

PickWindow asks the shell for the click-to-pick overlay; see Daemon.PickWindow.

type Daemon

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

Daemon exports a Picker as dev.stubbe.lys.SharePicker1.

func NewDaemon

func NewDaemon(p *Picker) *Daemon

NewDaemon wraps the picker for export.

func (*Daemon) Dismiss

func (d *Daemon) Dismiss(handle string) *dbus.Error

Dismiss cancels the picker showing for the request at handle.

func (*Daemon) Export

func (d *Daemon) Export(conn *dbus.Conn) (func(), error)

Export exports the object and claims the well-known name; the returned release drops the name.

func (*Daemon) Pick

func (d *Daemon) Pick(c portaldialogs.Caller, r Request) (string, *dbus.Error)

Pick shows the picker and blocks until the user selects or cancels, replying the XDPH selection suffix (printed after `[SELECTION]`), or an empty string on cancel. A request offering no kind of source is refused.

func (*Daemon) PickWindow added in v0.3.14

func (d *Daemon) PickWindow(c portaldialogs.Caller, r WindowRequest) (string, *dbus.Error)

PickWindow opens the click-to-pick overlay and blocks until a click picks a window, replying /window:<id>, or Enter shares the screen, replying /screen:<name>; Escape replies an empty string, which cancels, as Pick's does. A request offering nothing to pick is refused, and an overlay that cannot open fails, so the caller asks the picker.

type Deps

type Deps struct {
	// Config is the live config: each request reads [share-picker],
	// the styling scale, and the animations afresh.
	Config func() *config.Config
	// Font shapes the labels; Sheet styles the surface.
	Font  render.Font
	Sheet *widget.Stylesheet
	// Describe names the app asking to share (desktopentry.Describe);
	// nil for a request no portal app makes (the XDPH plugin).
	Describe func(appID string) (name, icon string)
}

Deps are the picker's collaborators.

type Picker

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

Picker is the share picker component. Pick is its entry point; the rest runs on the lys-ui loop goroutine.

func New

New builds the picker on the application; region is the live region overlay the Region page opens and windows the click-to-pick overlay PickWindow opens (nil for none), on the shell's one capture gate.

func (*Picker) Dismiss

func (p *Picker) Dismiss(handle string)

Dismiss cancels the request at handle: the window pick or the picker showing for it, with the region overlay it opened, is taken down; a waiting one never shows. Another request's picker stays.

func (*Picker) Pick

func (p *Picker) Pick(c portaldialogs.Caller, r Request) string

Pick shows the picker for one portal request and blocks until the user selects or cancels. The request's window list is the raw XDPH_WINDOW_SHARING_LIST; its sources are the pages shown; its token flag seeds the restore-token box; multiple enables multi-select. A request arriving while one is open waits its turn. Call it from any goroutine but the loop's.

func (*Picker) PickWindow added in v0.3.14

func (p *Picker) PickWindow(c portaldialogs.Caller, r WindowRequest) (string, error)

PickWindow opens the click-to-pick overlay for one portal request and blocks until a click picks a window, replying /window:<id>, or Enter shares the request's screen, replying /screen:<name>. Escape or a dismissal replies "". An overlay that cannot open (none built, or another capture session holds the gate) is an error, so the request goes on to the picker. Call it from any goroutine but the loop's.

type Request

type Request struct {
	WindowList string
	Sources    Sources
	AllowToken bool
	Multiple   bool
}

Request is one pick, (subb): the XDPH window list ("" without one), the kinds of source offered, whether a restore token may be granted, and whether several sources may be picked.

type Sources

type Sources uint32

Sources are the kinds of source a request may pick, a bit set.

const (
	SourceOutputs Sources = 1 << iota
	SourceWindows
	SourceRegions
	SourceDynamic
	AllSources = SourceOutputs | SourceWindows | SourceRegions | SourceDynamic
)

The kinds of source; a region is part of an output, and the dynamic source is the compositor's cast target.

type Target added in v0.2.0

type Target struct {
	Kind TargetKind
	// Name is the output connector, or the window identifier.
	Name                string
	X, Y, Width, Height int32
}

Target is one source the user picked: an output by connector name, a window by its ext-foreign-toplevel identifier (or XDPH id), a region of an output in its logical coordinates, or the compositor's cast target, which names nothing itself.

func ParseReply added in v0.2.0

func ParseReply(reply string) (allowToken bool, targets []Target, ok bool)

ParseReply reads the picker's answer: `[r]/<payload>[;<payload>...]`, r granting a restore token. Empty is a cancel; any malformed piece rejects the whole reply.

func ParseTarget added in v0.2.0

func ParseTarget(payload string) (Target, bool)

ParseTarget reads one payload; anything malformed is no target.

func ParseTargets added in v0.2.0

func ParseTargets(payload string) ([]Target, bool)

ParseTargets reads `<payload>[;<payload>...]`; any malformed piece rejects them all.

func (Target) Payload added in v0.2.0

func (t Target) Payload() string

Payload is the target as the picker replies it (and a restore token keeps it): screen:<name>, window:<id>, region:<out>@x,y,w,h, dynamic.

type TargetKind added in v0.2.0

type TargetKind uint8

TargetKind is what a Target names.

const (
	TargetOutput TargetKind = iota
	TargetWindow
	TargetRegion
	TargetDynamic
)

The kinds of target.

type WindowRequest added in v0.3.14

type WindowRequest struct {
	Windows []regionoverlay.Window
	Screen  string
}

WindowRequest is one click-to-pick, (a(ssiiii)s): the windows a click can pick, front to back on each output, and the output Enter shares, "" for none.

Jump to

Keyboard shortcuts

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