Documentation ¶
Overview ¶
library package wrapping swaymsg concerning monitor layout and some helper functions
Index ¶
- func GenericJSONDecode(rd io.Reader, pl interface{}) error
- func MsgSway(configFile string)
- func PrintConfig(cfg Config) string
- func PrintModes(screens []Screen)
- func ProcessMode(outputScreen *Screen, mode string, refresh float64) error
- func ProcessPosition(outputScreen *Screen, leftOf string, rightOf string, above string, ...) error
- func QuerySway(method string, pl interface{}) error
- func ReloadSway()
- func SwayVersion() string
- type Config
- type ConfigScreen
- type Inputs
- type LibInput
- type Screen
- type ScreenBg
- type ScreenMode
- type ScreenRect
- type SwayVer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenericJSONDecode ¶
helper function for demarshalling JSON generically
func PrintConfig ¶
Build the config-command-string (output and focus-commands) for writing into the monitor-config-file
func PrintModes ¶
func PrintModes(screens []Screen)
Print the available modes of all screens, similar to xrandr's default output
func ProcessMode ¶
sets the mode for a Screen; takes the refresh rate both from the mode and the refresh parameter to SwayRandr the parameter takes precedence
func ProcessPosition ¶
func ProcessPosition(outputScreen *Screen, leftOf string, rightOf string, above string, below string, screens []Screen) error
process positioning parameters to the SwayRandr program (left-of, right-of, above and below); sets the x and y options of the involved screens accordingly
func ReloadSway ¶
func ReloadSway()
tell sway to reload the configuration (i.e. reconfigure the monitor set-up, after the config-files where updated)
func SwayVersion ¶
func SwayVersion() string
read the version Information from swaymsg and return the human-readable version string
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Configurations are used for setting the outputs in the config-files for sway
func CreateConfig ¶
create config from updated screen-information
type ConfigScreen ¶
type ConfigScreen struct { Screen Screen // "Reference" to the screen-object Mode ScreenMode // the mode to be selected Rect ScreenRect // (only x,y used): describe the position of the screen Background ScreenBg // background image (not used atm) Scale float64 // scale the contents of the monitor Enabled bool // is the monitor enabled (i.e. on)? Focused bool // will it be focused on boot-up of sway? }
one ConfigScreen is used per Monitor to describe its _new_ configuration to be set in the config-files
type Inputs ¶
type Inputs struct { Identifier string Name string Vendor int Product int Type string XkbLayoutNames []string `json:'xkb_layout_names'` XkbActiveLayoutIndex int XkbActiveLayoutName string Libinput LibInput }
func ReadInputs ¶
type Screen ¶
type Screen struct { Id int // Id of that monitor Name string // Name (connection) like HDMI-1 Rect ScreenRect // Describes the rectangle of the monitor WindowRect ScreenRect // dunno DecoRect ScreenRect // dunno Geometry ScreenRect // dunno Border string // dunno CurrentBorderWidth int // dunno Layout string // dunno Orientation string // horizontally or vertically Percent float64 // dunno Window string // dunno -- mostly empty? Urgent bool // dunno Marks []struct{} // dunno FullscreenMode bool // dunno Nodes []struct{} // dunno FloatingNodes []struct{} // dunno Sticky bool // dunno Type string // dunno Active bool // is the monitor enabled or disabled= Dpms bool // dunno Primary bool // is it the primary monitor (different from focused on boot-up) Make string // the make of the monitor Model string // the model of the monitor Serial string // serial number of the monitor Scale float64 // float for scaling the monitor ScaleFilter string // describes the filter used for scaling the monitor Transform string // transformations on the output (rotation) AdaptiveSyncStatus string // duno CurrentWorkspace string // current workspace on that monitor Modes []ScreenMode // lists the available modes on the monitor; same resolutions may have differing refresh rates; rates are given in Hz CurrentMode ScreenMode `json:"current_mode"` // dunno MaxRenderTime int // dunno Focused bool // is the monitor focused on boot-up? SubpixelHinting string // dunno }
structre describing a monitor; wraps the return value of `swaymsg -t get_outputs -r`; the JSON-structure is probably used for more than output-objects in swaymsg
func FindScreen ¶
find screen-structure by the connection name (Screen.Name)
func ReadScreen ¶
read the screen information from swaymsg and return an Array of Screen-Structures
type ScreenMode ¶
type ScreenMode struct { Width int // width in pixel in that mode Height int // height in pixel Refresh int // refresh rate in that resolution in Hz }
structure for the modes of a monitor
type ScreenRect ¶
type ScreenRect struct { X int // x position for the monitor Y int // y position for the monitor Width int // Width in pixel Height int // Height in pixel }
structure describing the rectangle a monitor takes up in the whole virtual framebuffer
type SwayVer ¶
type SwayVer struct { HumanReadable string `json:"human_readable"` // human readable Version string (like v1.5) Variant string // dunno Major int // dunno, returns 0 Minor int // dunno, returns 0 Patch int // dunno, returns 0 LoadedConfigFileName string `json:"loaded_config_file_name"` // the loaded config file (main config; not listing its include-files) }
structure wrapping `swaymsg -t get_version -r`; only "HumanReadable" is used atm