gmtry

package module
v0.0.0-...-fa4a1b9 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 8 Imported by: 3

README

gmtry

gmtry is a Go library that allows to store and restore the geometry of windows on the screen.

Protobuf

To generate the Go-code related to Protobuf, use the following command:

go generate ./...

This will generate the Go-code into the packge pb.

Disclaimer

I develop this tool for myself and just for fun in my free time. If you find it useful, I'm happy to hear about that. If you have trouble using it, you have all the source code to fix the problem yourself (although pull requests are welcome).

License

This tool is published under the MIT License.

Copyright Florian Thienel 2019

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Applyable

type Applyable interface {
	Move(x, y int)
	Resize(width, height int)
	Maximize()
}

Applyable represents anything that window geometry can be applied to.

type Connectable

type Connectable interface {
	Applyable
	Observable
}

Connectable describes anything that is both an Applyable and an Observable.

type Connectables

type Connectables map[ID]Connectable

Connectables contains connectables mapped by their ID.

func NewConnectables

func NewConnectables() Connectables

NewConnectables instance.

type Geometry

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

func NewGeometry

func NewGeometry(filename string) *Geometry

func (*Geometry) Add

func (g *Geometry) Add(id ID, connectable Connectable)

func (*Geometry) Get

func (g *Geometry) Get(id ID) *Window

func (*Geometry) Restore

func (g *Geometry) Restore() error

func (*Geometry) Store

func (g *Geometry) Store() error

type ID

type ID string

ID of a window.

type Observable

type Observable interface {
	GetPosition() (x, y int)
	GetSize() (width, height int)
	IsMaximized() bool
}

Observable represents anything that window geometry can be retireved from.

type Window

type Window struct {
	ID        ID
	X         int
	Y         int
	Width     int
	Height    int
	Maximized bool
	Visible   bool
}

Window contains all data about a window.

func (*Window) Apply

func (w *Window) Apply(a Applyable)

Apply the window geometry to the given target.

func (*Window) SetMaximized

func (w *Window) SetMaximized(maximized bool)

SetMaximized flag of this window.

func (*Window) SetPosition

func (w *Window) SetPosition(x, y int)

SetPosition of this window.

func (*Window) SetSize

func (w *Window) SetSize(width, height int)

SetSize of this window.

func (*Window) SetVisible

func (w *Window) SetVisible(visible bool)

SetVisible flag of this window.

func (*Window) String

func (w *Window) String() string

type Windows

type Windows map[ID]*Window

Windows contains windows mapped by their ID.

func LoadWindows

func LoadWindows(r io.Reader) (Windows, error)

LoadWindows from the given reader.

func NewWindows

func NewWindows() Windows

NewWindows instance.

func (Windows) Get

func (w Windows) Get(id ID) *Window

Get the window with the given ID.

func (Windows) Store

func (w Windows) Store(writer io.Writer) error

Store windows to the given writer.

func (Windows) String

func (w Windows) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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