mediakeys

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 1 Imported by: 0 modules, 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 mediakeys takes the keyboard's brightness and volume keys (F1, F2, F10, F11, F12 on a Mac without fn) from the system, for the external display. On macOS this takes an event tap, which needs the Accessibility permission; elsewhere it is not supported.

Index

Constants

View Source
const SettingsURL = ""

SettingsURL has no counterpart without the Accessibility permission.

View Source
const Supported = false

Supported says whether this system can take the keys.

Variables

View Source
var ErrNotTrusted = errors.New("mediakeys: no Accessibility permission")

ErrNotTrusted is Start's error without the Accessibility permission.

Functions

func RequestAccess

func RequestAccess()

func Running

func Running() bool

func Start

func Start(Handler) error

func Stop

func Stop()

func Trusted

func Trusted() bool

Types

type Handler

type Handler func(k Key, down bool) (take bool)

Handler gets each press (down) and release of a key, on the main thread, and says whether to take it from the system. It must return quickly: the system holds every key event until it does.

type Key

type Key int

Key is a brightness or volume key.

const (
	BrightnessUp Key = iota + 1
	BrightnessDown
	VolumeUp
	VolumeDown
	Mute
)

Jump to

Keyboard shortcuts

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