sway/node.go

167 lines
5.0 KiB
Go

package sway
type Node struct {
ID NodeID `json:"id"`
Type NodeType `json:"type"`
Orientation Orientation `json:"orientation"`
Percentage *float64 `json:"percent"`
Urgent bool `json:"urgent"`
Marks []string `json:"marks"`
Focused bool `json:"focused"`
Layout string `json:"layout"`
Border BorderStyle `json:"border"`
CurrentBorderWidth int `json:"current_border_width"`
Rect Rect `json:"rect"`
DecoRect Rect `json:"deco_rect"`
WindowRect Rect `json:"window_rect"`
Geometry Rect `json:"geometry"`
Name string `json:"name"`
Nodes []Node `json:"nodes"`
FloatingNodes []Node `json:"floating_nodes"`
Focus []NodeID `json:"focus"`
FullscreenMode FullscreenMode `json:"fullscreen_mode"`
Sticky bool `json:"sticky"`
PID int64 `json:"pid"`
AppID string `json:"app_id"`
Visible bool `json:"visible"`
MaxRenderTimeMilli int64 `json:"max_render_time"`
Shell string `json:"shell"`
InhibitIdle bool `json:"inhibit_idle"`
IdleInhibitors IdleInhibitors `json:"idle_inhibitors"`
// Xorg compatibility
XorgWindowID *int64 `json:"window"`
XorgProperties *XorgProperties `json:"window_properties"`
// NodeTypeOutput only
Primary bool `json:"primary"`
Make string `json:"make"`
Model string `json:"model"`
Serial string `json:"serial"`
Modes []OutputMode `json:"modes"`
NonDesktop bool `json:"non_desktop"`
Active bool `json:"active"`
DPMS bool `json:"dpms"`
Power bool `json:"power"`
Scale float64 `json:"scale"`
ScaleFilter ScaleFilter `json:"scale_filter"`
Transform Transform `json:"transform"`
AdaptiveSync string `json:"adaptive_sync_status"`
LayerShellSurfaces []LayerShellSurface `json:"layer_shell_surfaces"`
CurrentWorkspace string `json:"current_workspace"`
CurrentMode OutputMode `json:"current_mode"`
// NodeTypeWorkspace only
WorkspaceNumber int `json:"num"`
Output string `json:"output"`
Representation string `json:"representation"`
}
type NodeID int64
type NodeType string
const (
NodeTypeRoot NodeType = "root"
NodeTypeOutput NodeType = "output"
NodeTypeCon NodeType = "con"
NodeTypeFloatingCon NodeType = "floating_con"
NodeTypeWorkspace NodeType = "workspace"
NodeTypeDockarea NodeType = "dockarea"
)
type Rect struct {
Y int `json:"y"`
X int `json:"x"`
Width int `json:"width"`
Height int `json:"height"`
}
type BorderStyle string
const (
BorderStyleNormal BorderStyle = "normal"
BorderStyleNo BorderStyle = "none"
BorderStylePixel BorderStyle = "pixel"
)
type Layout string
const (
LayoutSplitH Layout = "splith"
LayoutSplitV Layout = "splitv"
LayoutStacked Layout = "stacked"
LayoutTabbed Layout = "tabbed"
LayoutDockarea Layout = "dockarea"
LayoutOutput Layout = "output"
)
type FullscreenMode int64
const (
FullscreenNone FullscreenMode = 0
FullscreenOutput FullscreenMode = 1
FullscreenGlobal FullscreenMode = 2
)
type IdleInhibitors struct {
User string `json:"user"`
Application string `json:"application"`
}
type OutputMode struct {
Width int `json:"width"`
Height int `json:"height"`
RefreshRate int `json:"refresh"`
AspectRatio string `json:"picture_aspect_ratio"`
}
type ScaleFilter string
const (
ScaleFilterNearest ScaleFilter = "nearest"
ScaleFilterLinear ScaleFilter = "linear"
ScaleFilterSmart ScaleFilter = "smart"
)
type Transform string
const (
TransformNormal Transform = "normal"
Transform90 Transform = "90"
Transform180 Transform = "180"
Transform270 Transform = "270"
TransformFlipped Transform = "flipped"
TransformFlipped90 Transform = "flipped-90"
TransformFlipped180 Transform = "flipped-180"
TransformFlipped270 Transform = "flipped-270"
)
type LayerShellSurface struct {
Namespace string `json:"namespace"`
Layer string `json:"layer"`
Extent Rect `json:"extenct"`
Effects []Effect `json:"effects"`
}
type Effect string
const (
EffectBlur Effect = "blur"
)
type Orientation string
const (
OrientationHorizontal Orientation = "horizontal"
OrientationVertical Orientation = "vertical"
)
type XorgProperties struct {
Title string `json:"title"`
Instance string `json:"instance"`
Class string `json:"class"`
Role string `json:"window_role"`
Transient NodeID `json:"transient_for"`
}