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 dialog 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 ¶
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
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 (*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 (*Daemon) Export ¶
Export exports the object and claims the well-known name; the returned release drops the name.
func (*Daemon) Pick ¶
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 ¶
func New(a *app.Application, d Deps, gate *regionoverlay.Gate, region *regionoverlay.Overlay, windows *regionoverlay.WindowPick) *Picker
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 ¶
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 ¶
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
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
ParseTarget reads one payload; anything malformed is no target.
func ParseTargets ¶ added in v0.2.0
ParseTargets reads `<payload>[;<payload>...]`; any malformed piece rejects them all.
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.