binds

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT, MIT Imports: 9 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 binds maps typed input chords to window manager actions, with submaps and bind flags.

Index

Constants

This section is empty.

Variables

View Source
var ErrBadChord = errors.New("bad chord")
View Source
var ErrBadFlags = errors.New("bad bind flags")

Functions

func Duplicates

func Duplicates(binds []Bind) [][2]int

func FlagNames

func FlagNames() []string

func Relevant

func Relevant(r Resolver) (uint32, error)

Types

type Bind

type Bind struct {
	Submap      string
	Chord       Chord
	Text        string
	Description string
	Flags       Flags
	Action      wm.Action
}

func (Bind) Normalized

func (b Bind) Normalized() (Bind, error)

type Button

type Button struct{ Code uint32 }

func (Button) String

func (b Button) String() string

type Chord

type Chord struct {
	Mods    uint32
	Trigger Trigger
}

func ParseChord

func ParseChord(text string, r Resolver) (Chord, error)

type Drive

type Drive uint8
const (
	NoDrive Drive = iota
	DriveWorkspaces
	DriveZoom
	DriveOverview
	DriveView
	DriveMove
	DriveResize
)

type Edge

type Edge uint8
const (
	NoEdge Edge = iota
	EdgeTop
	EdgeBottom
	EdgeLeft
	EdgeRight
)

func (Edge) Inward

func (e Edge) Inward() GestureDirection

type Flags

type Flags struct {
	Locked       bool
	Repeating    bool
	Release      bool
	Pass         bool
	InhibitProof bool
	LongPress    time.Duration
	Cooldown     time.Duration
}

func (Flags) Names

func (f Flags) Names() []string

func (Flags) OnRelease

func (f Flags) OnRelease() bool

func (*Flags) Set

func (f *Flags) Set(name string) bool

type Gate

type Gate uint8
const (
	GateOpen Gate = iota
	GateInhibited
	GateLocked
)

type GestureBind

type GestureBind struct {
	Kind      backend.Gesture
	Fingers   uint32
	Direction GestureDirection
	Drive     Drive
	Action    wm.Action
	Modifiers ModifierSet
	Mods      uint32
	Edge      Edge
	Scope     wm.OverviewScope
}

func HeldFor

func HeldFor(dst, all []GestureBind, held uint32) []GestureBind

func ResolveGestures

func ResolveGestures(all []GestureBind, r Resolver) ([]GestureBind, error)

func (GestureBind) Overlaps

func (b GestureBind) Overlaps(o GestureBind) bool

type GestureDirection

type GestureDirection uint8
const (
	NoDirection GestureDirection = iota
	SwipeLeft
	SwipeRight
	SwipeUp
	SwipeDown
	SwipeHorizontal
	SwipeVertical
	PinchIn
	PinchOut
	PinchBoth
	SwipeAny
)

func (GestureDirection) Horizontal

func (d GestureDirection) Horizontal() bool

type Key

type Key struct{ Code uint32 }

func (Key) String

func (k Key) String() string

type Map

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

func NewMap

func NewMap(binds []Bind, relevant uint32) (Map, error)

func (Map) All

func (m Map) All() []Bind

func (Map) Any

func (m Map) Any(f func(Bind) bool) bool

func (Map) At

func (m Map) At(i int) Bind

func (Map) Held

func (m Map) Held(depressed uint32) uint32

func (Map) Len

func (m Map) Len() int

func (Map) Lookups

func (m Map) Lookups() uint64

func (Map) Match

func (m Map) Match(submap string, mods uint32, t Trigger, g Gate) (Bind, int, bool)

type ModifierSet

type ModifierSet uint8
const (
	ModShift ModifierSet = 1 << iota
	ModControl
	ModAlt
	ModSuper
)

func ParseModifiers

func ParseModifiers(text string) (ModifierSet, error)

func (ModifierSet) Mask

func (s ModifierSet) Mask(r Resolver) (uint32, error)

func (ModifierSet) String

func (s ModifierSet) String() string

type Recognizer

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

func (*Recognizer) Begin

func (r *Recognizer) Begin(binds []GestureBind, kind backend.Gesture, fingers uint32, allowed bool) Step

func (*Recognizer) Drives

func (r *Recognizer) Drives(d Drive) bool

func (*Recognizer) End

func (r *Recognizer) End(cancelled bool) Step

func (*Recognizer) Pinch

func (r *Recognizer) Pinch(scale float64) Step

func (*Recognizer) Swallow

func (r *Recognizer) Swallow()

func (*Recognizer) Swipe

func (r *Recognizer) Swipe(dx, dy float64) Step

type Resolver

type Resolver interface {
	Keycode(keysym string) (uint32, error)
	ModMask(name string) (uint32, error)
}

type Scroll

type Scroll struct{ Dir ScrollDir }

func (Scroll) String

func (s Scroll) String() string

type ScrollDir

type ScrollDir uint8
const (
	ScrollUp ScrollDir = iota + 1
	ScrollDown
)

type Step

type Step struct {
	Forward      bool
	CancelClient bool
	Claimed      bool
	Passed       bool
	Bind         GestureBind
	Fire         bool
	Travel       float64
}

type Tap

type Tap struct{ Modifier ModifierSet }

func TapOf

func TapOf(keysym uint32) (Tap, bool)

func (Tap) String

func (t Tap) String() string

type Trigger

type Trigger interface {
	fmt.Stringer
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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