xcursor

package
v0.0.0-...-353441c Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadMagic = errors.New("bad magic")

ErrBadMagic indicates an unrecognized magic number when attempting to load a cursor.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	Subtype CommentSubtype
	Comment string
}

Comment is a comment section of an Xcursor file.

type CommentSubtype

type CommentSubtype uint32
const (
	CommentSubtypeCopyright CommentSubtype = 1 + iota
	CommentSubtypeLicense
	CommentSubtypeOther
)

type Cursor

type Cursor struct {
	Comments []*Comment
	Images   map[int][]*Image
}

Cursor contains information decoded from a Xcursor file.

func Decode

func Decode(r io.Reader) (*Cursor, error)

Decode decodes an Xcursor file from r.

func DecodeFile

func DecodeFile(path string) (*Cursor, error)

DecodeFile decodes the Xcursor file at path.

func (*Cursor) BestSize

func (c *Cursor) BestSize(size int) (best int)

BestSize searches the available sizes for the cursor and returns the one that is closest to the target size. If two are equidistant to size, the larger of the two is returned.

type Image

type Image struct {
	NominalSize int
	Delay       time.Duration
	Hot         image.Point
	Image       *format.Image
}

Image is an image section of an Xcursor file.

type Theme

type Theme struct {
	Name    string
	Cursors map[string]*Cursor
}

Theme is an Xcursor theme.

func LoadTheme

func LoadTheme(name string) (*Theme, error)

LoadTheme loads the named theme from the system search paths. It resepects the $XURSOR_PATH and $XDG_DATA_HOME environment variables when looking. If the theme has an index.theme file and that file lists other themes to inherit from, those themes are also loaded and their cursors are added to the returned theme.

func LoadThemeFromDir

func LoadThemeFromDir(path string) (*Theme, error)

LoadThemeFromDir loads a theme from the directory at path, ignoring the system search path completely. The returned theme's name is the basename of the given path.

Jump to

Keyboard shortcuts

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