feedback

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

README

Haptic/visual/audio feedback for GNOME: Go bindings

go-feedback implements Go bindings for feedbackd, the Purism C library. It provides a means to create haptic, visual and audio feedback.

This package requires CGO_ENABLED=1 and libfeedback to be installed (apt install libfeedback-dev on Debian, pacman -S feedbackd on Arch).

Usage

Simple example without any error handling:

feedbacker, _ := feedback.NewFeedbacker("my.app.id")

event, _ := feedbacker.NewEvent("message-new-instant")

event.TriggerFeedback()

An full example of how to use this library can be found in examples/example.go.

Documentation

Overview

Package feedback implements Go bindings for libfeedback. Requires Cgo and feedbackd (libfeedback-dev) to be installed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FeedbackEvent

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

func (*FeedbackEvent) TriggerFeedback

func (e *FeedbackEvent) TriggerFeedback() (bool, error)

TriggerFeedback triggers the feedback for the event. If the same event is triggered twice, an error is returned. If the program is terminated immediately after calling this function, the result might not be noticeable. That is because feedbackd terminates feedback from clients that disconnect from DBus, to avoid feedback not being stopped.

func (*FeedbackEvent) TriggerFeedbackAsync

func (e *FeedbackEvent) TriggerFeedbackAsync() error

TriggerFeedbackAsync triggers feedback for the event asynchronously. See the sync version of this function for more details.

type Feedbacker

type Feedbacker struct {
}

Feedbacker is the main struct to interact with. It encapsulates a single feedback event.

func NewFeedbacker

func NewFeedbacker(appID string) (*Feedbacker, error)

NewFeedbacker inits the underlying libfeedback.

func (*Feedbacker) NewEvent

func (f *Feedbacker) NewEvent(name string) (*FeedbackEvent, error)

NewEvent creates a new feedback event. This needs to be called before calling TriggerFeedback.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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