Documentation
¶
Overview ¶
Package osd is the on-screen display (lys-shell osd/): one layer surface on the configured monitor flashing volume, microphone, brightness, and lock-key events and the toasts `lys-shell toast` pushes, styled by the stylesheet's .osd rules and dismissed after osd.duration.
Index ¶
Constants ¶
const BrightnessIcon = "ld-sun-symbolic"
BrightnessIcon is the brightness slider's glyph.
const LayoutIcon = "ld-keyboard-symbolic"
LayoutIcon is the keyboard layout notice's glyph.
const MediaIcon = "ld-music-symbolic"
MediaIcon stands in for a track without art.
Variables ¶
This section is empty.
Functions ¶
func MicrophoneIcon ¶
MicrophoneIcon is the input slider's glyph.
func VolumeIcon ¶
VolumeIcon is the output slider's glyph.
Types ¶
type Deps ¶
type Deps struct {
// Open maps a layer surface.
Open func(app.LayerConfig) (Window, error)
// Outputs lists the connected outputs, the primary first.
Outputs func() []*app.Output
// Invoke runs fn on the UI loop.
Invoke func(fn func())
// After runs fn once d has passed, off the loop.
After func(d time.Duration, fn func())
// Sheet styles the surface: the labels and icons take their ink
// from its cascade. Font is the labels' face.
Sheet *widget.Stylesheet
Font render.Font
}
Deps are the OSD's collaborators.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is one OSD flash: a slider (volume, microphone, brightness), a lock-key toggle, or a toast pushed over the widget socket. Build one with Slider, Toggle, or from a toast request.
func NowPlaying ¶
func NowPlaying(c mpris.TrackChange) Event
NowPlaying is the active player's new track: its art, title and artist.
type Layouts ¶
type Layouts interface {
Layout() (string, error)
Subscribe(ctx context.Context) (<-chan struct{}, func(), error)
}
Layouts is the compositor's keyboard layout: Layout reads the active one, and each tick from Subscribe is the cue to read it again.
type LockKeys ¶
type LockKeys func(fn func(keytoggles.Event)) (stop func(), err error)
LockKeys follows the lock keys: it calls fn for each key that turns on or off until stop, which waits for the last call.
type Osd ¶
type Osd struct {
// contains filtered or unexported fields
}
Osd is the display. Its exported methods may be called from any goroutine; its state lives on the UI loop.
func (*Osd) DetachOutput ¶
DetachOutput drops the surface on an unplugged output; the next event maps it on the configured monitor again.
func (*Osd) ShowToast ¶
func (o *Osd) ShowToast(req widgetipc.ToastRequest)
ShowToast flashes a `lys-shell toast` request.
func (*Osd) Watch ¶
func (o *Osd) Watch(ctx context.Context, audio pulse.Source, light brightness.Source, layouts Layouts, tracks Tracks, locks LockKeys)
Watch follows the audio, brightness, keyboard layout, track change, and lock-key sources until ctx ends. A nil source is skipped. The levels at start seed the dedupe without flashing. The lock-key source runs only while the OSD is enabled, since it holds input devices open.
type Tracks ¶
type Tracks interface {
TrackChanges() (<-chan mpris.TrackChange, func())
}
Tracks is the media service's track changes: each one is offered to the OSD, which osd.media filters.