system

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package system provides desktop integration for media controls and notifications.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetReadArtworkFn

func SetReadArtworkFn(fn func(string) ([]byte, string, error))

SetReadArtworkFn sets the function used to read artwork from media files.

Types

type MPRIS

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

MPRIS provides MPRIS2 D-Bus integration for Forte.

func NewMPRIS

func NewMPRIS(player PlayerControl) (*MPRIS, error)

NewMPRIS creates and registers the MPRIS2 service on the session bus.

func (*MPRIS) ClearMetadata

func (m *MPRIS) ClearMetadata()

ClearMetadata resets metadata to empty (when stopped).

func (*MPRIS) Close

func (m *MPRIS) Close()

Close releases the D-Bus connection and cleans up temp files.

func (*MPRIS) UpdateLoopStatus

func (m *MPRIS) UpdateLoopStatus(mode string)

UpdateLoopStatus pushes repeat mode to D-Bus.

func (*MPRIS) UpdateMetadata

func (m *MPRIS) UpdateMetadata(title, artist, album, filePath string, durationMs int, trackID int64)

UpdateMetadata pushes track metadata to D-Bus.

func (*MPRIS) UpdatePlaybackStatus

func (m *MPRIS) UpdatePlaybackStatus(state string)

UpdatePlaybackStatus pushes a playback state change to D-Bus.

func (*MPRIS) UpdatePosition

func (m *MPRIS) UpdatePosition(seconds float64)

UpdatePosition updates the Position property (no signal emitted per spec).

func (*MPRIS) UpdateShuffle

func (m *MPRIS) UpdateShuffle(enabled bool)

UpdateShuffle pushes shuffle state to D-Bus.

func (*MPRIS) UpdateVolume

func (m *MPRIS) UpdateVolume(percent int)

UpdateVolume pushes volume to D-Bus (0-100 -> 0.0-1.0).

type Notifier

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

Notifier sends desktop notifications via D-Bus.

func NewNotifier

func NewNotifier() (*Notifier, error)

NewNotifier connects to the session bus for sending notifications.

func (*Notifier) Close

func (n *Notifier) Close()

Close releases the D-Bus connection and cleans up temp files.

func (*Notifier) Enabled

func (n *Notifier) Enabled() bool

Enabled returns whether notifications are enabled.

func (*Notifier) Notify

func (n *Notifier) Notify(title, body string, artwork []byte)

Notify sends a desktop notification. If artwork is non-nil, it is used as the notification icon. Each call replaces the previous notification.

func (*Notifier) SetEnabled

func (n *Notifier) SetEnabled(enabled bool)

SetEnabled enables or disables notifications.

type PlayerControl

type PlayerControl interface {
	Pause()
	Resume()
	Stop()
	Next()
	Previous()
	Seek(seconds float64)
	SetVolume(percent int)
	Volume() int
	Position() float64
	Duration() float64
	State() string
	MediaPath() string
	SetShuffle(enabled bool)
	GetShuffle() bool
	SetRepeat(mode string)
	GetRepeat() string
}

PlayerControl is the interface that desktop media integrations use to control the player.

Jump to

Keyboard shortcuts

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