katnip

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 16 Imported by: 0

README

katnip

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnvKey

func GetEnvKey(name string) string

Returns "{envname}_{name}".

envname is KATNIP by default

func GetEnvPair

func GetEnvPair(name, value string) string

Returns "{key}={value}".

key is the returned value from GetEnvKey function with name as argument

func Launch

func Launch(name string, config Config)

func Register

func Register(name string, panel PanelHandler)

func RegisterFunc

func RegisterFunc(name string, panel PanelFunc)

Types

type Config

type Config struct {
	Position    Vector
	Size        Vector
	Layer       Layer
	FocusPolicy FocusPolicy
	Edge        Edge

	OutputName      string
	Class           string
	HideOnFocusLoss bool
	StartAsHidden   bool

	SingleInstance bool
	InstanceGroup  string

	ConfigFile string

	// appended to the last, can be used to add unspecified options
	Overrides map[string]string

	// Easier way to add -o options
	KittyOverrides []string

	// kitty command to be invoked, default: kitty
	//
	// one usecase: when multiple versions of kitty are installed and maintained using symlinks
	KittyCmd string
}

type Edge

type Edge int
const (
	EdgeBackground  Edge = iota + 1 // background
	EdgeBottom                      // bottom
	EdgeCenter                      // center
	EdgeCenterSized                 // center-sized
	EdgeLeft                        // left
	EdgeNone                        // none
	EdgeRight                       // right
	EdgeTop                         // top
)

func (Edge) String

func (i Edge) String() string

type FocusPolicy

type FocusPolicy int
const (
	FocusExclusive  FocusPolicy = iota + 1 // exclusive
	FocusNotAllowed                        // not-allowed
	FocusOnDemand                          // on-demand
)

func (FocusPolicy) String

func (i FocusPolicy) String() string

type Kitty

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

func NewKitty

func NewKitty(socketPath string) *Kitty

func (*Kitty) Close

func (k *Kitty) Close() error

func (*Kitty) Command

func (k *Kitty) Command(cmd string, payload any) (map[string]any, error)

Like Dispatch but response is returned.

func (*Kitty) Dispatch

func (k *Kitty) Dispatch(cmd string, payload any) error

For dispatching commands only, no response is assumed. For $(kitty --version) > v0.42.0

func (*Kitty) Hide

func (k *Kitty) Hide() error

func (*Kitty) Move

func (k *Kitty) Move(x, y int) error

func (*Kitty) Resize

func (k *Kitty) Resize(columns, lines int) error

func (*Kitty) SetFontSize

func (k *Kitty) SetFontSize(size int) error

func (*Kitty) SetOpacity

func (k *Kitty) SetOpacity(opacity float64) error

func (*Kitty) Show

func (k *Kitty) Show() error

func (*Kitty) ToggleVisibility

func (k *Kitty) ToggleVisibility() error

type Layer

type Layer int
const (
	LayerBackground Layer = iota + 1 // background
	LayerBottom                      // bottom
	LayerTop                         // top
	LayerOverlay                     // overlay
)

func (Layer) String

func (i Layer) String() string

type Margins

type Margins struct {
	Top, Bottom, Left, Right int
}

type NotificationWriter

type NotificationWriter struct{}

func (*NotificationWriter) Write

func (w *NotificationWriter) Write(p []byte) (n int, err error)

type Panel

type Panel struct {
	// pointer to underlying exec.Cmd, can be used to set Env
	// or directly interface with exec.Cmd
	Cmd *exec.Cmd
	// contains filtered or unexported fields
}

func BackgroundPanel

func BackgroundPanel(name string) *Panel

BackgroundPanel creates a background/wallpaper panel

func BottomPanel

func BottomPanel(name string, lines int) *Panel

BottomPanel creates a bottom-edge panel

func FloatingPanel

func FloatingPanel(name string, lines, columns int) *Panel

FloatingPanel creates a centered floating panel

func NewPanel

func NewPanel(name string, config Config) *Panel

func NewPanelContext

func NewPanelContext(ctx context.Context, name string, config Config) *Panel

func TopPanel

func TopPanel(name string, lines int) *Panel

TopPanel creates a top-edge panel

func (*Panel) Kill

func (p *Panel) Kill() error

func (*Panel) ReadOutput

func (p *Panel) ReadOutput() ([]byte, error)

ReadOutput reads all available output from the panel Returns empty slice if no shared memory reader is available

func (*Panel) ReadWriter

func (p *Panel) ReadWriter() io.ReadWriter

func (*Panel) Reader

func (p *Panel) Reader() io.Reader

func (*Panel) Run

func (p *Panel) Run() error

func (*Panel) Start

func (p *Panel) Start() error

func (*Panel) Stop

func (p *Panel) Stop() error

func (*Panel) Wait

func (p *Panel) Wait() error

func (*Panel) Writer

func (p *Panel) Writer() io.Writer

type PanelFunc

type PanelFunc func(k *Kitty, rw io.ReadWriter) int

func (PanelFunc) Run

func (f PanelFunc) Run(k *Kitty, rw io.ReadWriter) int

type PanelHandler

type PanelHandler interface {
	Run(k *Kitty, rw io.ReadWriter) int
}

type Vector

type Vector struct {
	X, Y int
}

Jump to

Keyboard shortcuts

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