screenshot

package
v0.0.0-...-3d35af2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatARGB8888 = shm.FormatARGB8888
	FormatXRGB8888 = shm.FormatXRGB8888
	FormatABGR8888 = shm.FormatABGR8888
	FormatXBGR8888 = shm.FormatXBGR8888
	FormatRGB888   = shm.FormatRGB888
	FormatBGR888   = shm.FormatBGR888
)
View Source
const (
	TransformNormal     = shm.TransformNormal
	Transform90         = shm.Transform90
	Transform180        = shm.Transform180
	Transform270        = shm.Transform270
	TransformFlipped    = shm.TransformFlipped
	TransformFlipped90  = shm.TransformFlipped90
	TransformFlipped180 = shm.TransformFlipped180
	TransformFlipped270 = shm.TransformFlipped270
)

Variables

View Source
var DefaultOverlayStyle = OverlayStyle{
	BackgroundR: 30, BackgroundG: 30, BackgroundB: 30, BackgroundA: 220,
	TextR: 255, TextG: 255, TextB: 255,
	AccentR: 100, AccentG: 180, AccentB: 255,
}

Functions

func BufferToImage

func BufferToImage(buf *ShmBuffer) *image.RGBA

func BufferToImageWithFormat

func BufferToImageWithFormat(buf *ShmBuffer, format uint32) *image.RGBA

func EncodeJPEG

func EncodeJPEG(w io.Writer, img image.Image, quality int) error

func EncodePNG

func EncodePNG(w io.Writer, img image.Image) error

func EncodePPM

func EncodePPM(w io.Writer, img *image.RGBA) error

func GenerateFilename

func GenerateFilename(format Format) string

func GetFocusedMonitor

func GetFocusedMonitor() string

func GetHyprlandMonitorGeometry

func GetHyprlandMonitorGeometry(name string) (x, y, w, h int32, ok bool)

func GetHyprlandMonitorScale

func GetHyprlandMonitorScale(name string) float64

func GetOutputDir

func GetOutputDir() string

func InverseTransform

func InverseTransform(transform int32) int32

func RunNotifyActionListener

func RunNotifyActionListener(args []string)

func SaveLastRegion

func SaveLastRegion(r Region) error

func SaveState

func SaveState(state *PersistentState) error

func SendNotification

func SendNotification(result NotifyResult)

func SetCompositorDWL

func SetCompositorDWL()

func SetDWLActiveOutput

func SetDWLActiveOutput(name string)

func WriteToFile

func WriteToFile(buf *ShmBuffer, path string, format Format, quality int) error

func WriteToFileWithFormat

func WriteToFileWithFormat(buf *ShmBuffer, path string, format Format, quality int, pixelFormat uint32) error

Types

type CaptureResult

type CaptureResult struct {
	Buffer    *ShmBuffer
	Region    Region
	YInverted bool
	Format    uint32
}

type ColorScheme

type ColorScheme struct {
	Dark  ThemeColors `json:"dark"`
	Light ThemeColors `json:"light"`
}

type ColorsFile

type ColorsFile struct {
	Colors ColorScheme `json:"colors"`
}

type Compositor

type Compositor int
const (
	CompositorUnknown Compositor = iota
	CompositorHyprland
	CompositorSway
	CompositorNiri
	CompositorDWL
	CompositorScroll
	CompositorMiracle
)

func DetectCompositor

func DetectCompositor() Compositor

type Config

type Config struct {
	Mode          Mode
	OutputName    string
	IncludeCursor bool
	Format        Format
	Quality       int
	OutputDir     string
	Filename      string
	Clipboard     bool
	SaveFile      bool
	Notify        bool
	Stdout        bool
}

func DefaultConfig

func DefaultConfig() Config

type Format

type Format int
const (
	FormatPNG Format = iota
	FormatJPEG
	FormatPPM
)

type Mode

type Mode int
const (
	ModeRegion Mode = iota
	ModeWindow
	ModeFullScreen
	ModeAllScreens
	ModeOutput
	ModeLastRegion
)

type NotifyResult

type NotifyResult struct {
	FilePath  string
	Clipboard bool
	ImageData []byte
	Width     int
	Height    int
}

type Output

type Output struct {
	Name            string
	X, Y            int32
	Width           int32
	Height          int32
	Scale           int32
	FractionalScale float64
	Transform       int32
}

func ListOutputs

func ListOutputs() ([]Output, error)

type OutputSurface

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

type OverlayStyle

type OverlayStyle struct {
	BackgroundR, BackgroundG, BackgroundB, BackgroundA uint8
	TextR, TextG, TextB                                uint8
	AccentR, AccentG, AccentB                          uint8
}

func LoadOverlayStyle

func LoadOverlayStyle() OverlayStyle

type PersistentState

type PersistentState struct {
	LastRegion Region `json:"last_region"`
}

func LoadState

func LoadState() (*PersistentState, error)

type PixelFormat

type PixelFormat = shm.PixelFormat

type PreCapture

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

type Region

type Region struct {
	X      int32  `json:"x"`
	Y      int32  `json:"y"`
	Width  int32  `json:"width"`
	Height int32  `json:"height"`
	Output string `json:"output,omitempty"`
}

func GetLastRegion

func GetLastRegion() Region

func (Region) IsEmpty

func (r Region) IsEmpty() bool

type RegionSelector

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

func NewRegionSelector

func NewRegionSelector(s *Screenshoter) *RegionSelector

func (*RegionSelector) Run

func (r *RegionSelector) Run() (*CaptureResult, bool, error)

type RenderSlot

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

type Screenshoter

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

func New

func New(config Config) *Screenshoter

func (*Screenshoter) GetOutputs

func (s *Screenshoter) GetOutputs() []*WaylandOutput

func (*Screenshoter) Run

func (s *Screenshoter) Run() (*CaptureResult, error)

type SelectionState

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

type ShmBuffer

type ShmBuffer = shm.Buffer

func CreateShmBuffer

func CreateShmBuffer(width, height, stride int) (*ShmBuffer, error)

type ThemeColors

type ThemeColors struct {
	Background string `json:"surface"`
	OnSurface  string `json:"on_surface"`
	Primary    string `json:"primary"`
}

type WaylandOutput

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

type WindowGeometry

type WindowGeometry struct {
	X               int32
	Y               int32
	Width           int32
	Height          int32
	Output          string
	Scale           float64
	OutputX         int32
	OutputY         int32
	OutputTransform int32
}

func GetActiveWindow

func GetActiveWindow() (*WindowGeometry, error)

Jump to

Keyboard shortcuts

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