i3

package
v0.0.0-...-d8427d5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveOutputsNum

func ActiveOutputsNum(outputs []Output) float64

ActiveOutputsNum counts the number of active outputs in the given slice of Outputs. This could be, but is unlikely to be 0.

func CurrentOutputNum

func CurrentOutputNum(workspaceNum float64, outputsNum float64) float64

CurrentOutputNum calculates the current "display number" that i3x3 uses internally based on the workspace number, and the number of outputs. We avoid trying to figure out the physical layout of displays because that will be both complicated, and error prone. This method works best if your only method of navigating workspaces is by using i3x3.

func CurrentWorkspaceNum

func CurrentWorkspaceNum(workspaces []Workspace) float64

CurrentWorkspaceNum gets the currently focused workspace number from the given workspaces.

func MaxWorkspaceNum

func MaxWorkspaceNum(workspaces []Workspace) float64

MaxWorkspaceNum finds the workspace with the highest number in the given slice of workspaces.

func MoveToWorkspace

func MoveToWorkspace(workspace float64) error

MoveToWorkspace tells i3 to move the current container to the given workspace. It does not also switch to the workspace. Any error running the i3-msg command will be returned.

func MoveWorkspaceToOutput

func MoveWorkspaceToOutput(workspaceNum float64, outputName string) error

MoveWorkspaceToOutput takes a given workspace, and moves it to the given output (used for re-arranging workspaces on differing numbers of outputs).

func SwitchToWorkspace

func SwitchToWorkspace(workspace float64) error

SwitchToWorkspace tells i3 to switch to the given workspace. Any error running the i3-msg command will be returned.

Types

type Output

type Output struct {
	Name             string `json:"name"`
	Active           bool   `json:"active"`
	Primary          bool   `json:"primary"`
	Rect             Rect   `json:"rect"`
	CurrentWorkspace string `json:"current_workspace"`
}

Output represents an i3 output (i.e. a display).

func ActiveOutputs

func ActiveOutputs(outputs []Output) []Output

ActiveOutputs returns the active outputs in the given slice of Outputs. This could be, but is unlikely to be empty.

func FindOutputs

func FindOutputs() ([]Output, error)

FindOutputs fetches an array of outputs from i3 via i3-msg. This will return all outputs, not just the active ones.

type Rect

type Rect struct {
	X      int `json:"x"`
	Y      int `json:"y"`
	Width  int `json:"width"`
	Height int `json:"height"`
}

Rect represents a generic rectangular shape.

type Workspace

type Workspace struct {
	Num     int    `json:"num"`
	Name    string `json:"name"`
	Visible bool   `json:"visible"`
	Focused bool   `json:"focused"`
	Rect    Rect   `json:"rect"`
	Output  string `json:"output"`
	Urgent  bool   `json:"urgent"`
}

Workspace represents an i3 workspace.

func FindWorkspaces

func FindWorkspaces() ([]Workspace, error)

FindWorkspaces fetches an array of workspaces from i3 via i3-msg. This will return all workspaces, not just the visible ones, or focused ones.

Jump to

Keyboard shortcuts

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