Documentation ¶
Overview ¶
Package i3ipc implements interprocess communication facilities with the i3 window manager.
Index ¶
- func StartEventListener()
- func Subscribe(eventType EventType) (subs chan Event, err error)
- type Colors
- type CommandError
- type Event
- type EventType
- type I3Bar
- type I3Node
- func (self *I3Node) Descendents() []*I3Node
- func (self *I3Node) FindByID(ID int64) *I3Node
- func (self *I3Node) FindByWindow(window int32) *I3Node
- func (self *I3Node) FindFocused() *I3Node
- func (self *I3Node) FindNamed(name string) []*I3Node
- func (self *I3Node) Leaves() (leaves []*I3Node)
- func (self *I3Node) Root() *I3Node
- func (self *I3Node) Workspace() *I3Node
- func (self *I3Node) Workspaces() (workspaces []*I3Node)
- type I3Version
- type IPCSocket
- func (socket *IPCSocket) Close() error
- func (socket *IPCSocket) Command(action string) (success bool, err error)
- func (socket *IPCSocket) GetBarConfig(id string) (bar I3Bar, err error)
- func (socket *IPCSocket) GetBarIds() (ids []string, err error)
- func (socket *IPCSocket) GetMarks() (marks []string, err error)
- func (socket *IPCSocket) GetOutputs() (outputs []Output, err error)
- func (socket *IPCSocket) GetTree() (root I3Node, err error)
- func (socket *IPCSocket) GetVersion() (version I3Version, err error)
- func (socket *IPCSocket) GetWorkspaces() (workspaces []Workspace, err error)
- func (socket *IPCSocket) Raw(messageType MessageType, args string) (jsonReply []byte, err error)
- type Message
- type MessageError
- type MessageType
- type MessageTypeError
- type Output
- type Rect
- type SubscribeError
- type Workspace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartEventListener ¶
func StartEventListener()
StartEventListener makes the library listen to events on the i3 socket
Types ¶
type Colors ¶
type Colors struct { Background string Statusline string Separator string FocusedBackground string `json:"focused_background"` FocusedStatusline string `json:"focused_statusline"` FocusedSeparator string `json:"focused_separator"` FocusedWorkspaceBg string `json:"focused_workspace_bg"` FocusedWorkspaceBorder string `json:"focused_workspace_border"` FocusedWorkspaceText string `json:"focused_workspace_text"` ActiveWorkspaceBg string `json:"active_workspace_bg"` ActiveWorkspaceBorder string `json:"active_workspace_border"` ActiveWorkspaceText string `json:"active_workspace_text"` InactiveWorkspaceBg string `json:"inactive_workspace_bg"` InactiveWorkspaceBorder string `json:"inactive_workspace_border"` InactiveWorkspaceText string `json:"inactive_workspace_text"` UrgentWorkspaceBg string `json:"urgent_workspace_bg"` UrgentWorkspaceBorder string `json:"urgent_workspace_border"` UrgentWorkspaceText string `json:"urgent_workspace_text"` BindingModeBg string `json:"binding_mode_bg"` BindingModeBorder string `json:"binding_mode_border"` BindingModeText string `json:"binding_mode_text"` }
Colors represents colors as used in I3Bar.
type CommandError ¶
type CommandError string
CommandError for replies from a command to i3.
func (CommandError) Error ¶
func (error CommandError) Error() string
type Event ¶
type Event struct { Type EventType // "change" is the name of the single field of the JSON map that i3 sends // when an event occurs, describing what happened. Change string }
Event describes an event reply from i3.
type EventType ¶
type EventType int32
EventType for subscribable events.
const ( I3WorkspaceEvent EventType = iota I3OutputEvent I3ModeEvent I3WindowEvent I3BarConfigUpdateEvent I3BindingEvent )
Enumeration of currently available event types.
func AddEventType ¶
AddEventType dynamically adds an event type by defining a name for it. Just in case i3 adds a new one and this library hasn't been updated yet. Returns the EventType which gets assigned to it.
XXX: If you use this to add more than one new event type, add them in the RIGHT ORDER. I hope this case never pops up (because that would mean that this library is severely outdated), but I thought I'd warn you anyways.
type I3Bar ¶
type I3Bar struct { ID string Mode string Position string StatusCommand string `json:"status_command"` Font string WorkspaceButtons bool `json:"workspace_buttons"` BindingModeIndicator bool `json:"binding_mode_indicator"` Verbose bool Colors Colors }
I3Bar represents the configuration of a bar. For documentation of the fields, refer to http://i3wm.org/docs/ipc.html#_bar_config_reply.
type I3Node ¶
type I3Node struct { //int32 isn't large enough to hold all the ids ID int64 Name string Type string Border string CurrentBorderWidth int32 `json:"current_border_width"` Layout string Orientation string Percent float64 Rect Rect WindowRect Rect DecoRect Rect `json:"deco_rect"` Geometry Rect Window int32 Urgent bool Focused bool Floating_Nodes []I3Node Nodes []I3Node Parent *I3Node // Properties, not listed in docs: Window_Properties struct { // Transient_for ? Title string Instance string Class string } // Swallows []I3Node ? Sticky bool Floating string Last_Split_Layout string // Focus []I3Node ? Fullscreen_Mode int32 Scratchpad_State string Workspace_Layout string }
I3Node represents a Node in the i3 tree. For documentation of the fields, refer to http://i3wm.org/docs/ipc.html#_tree_reply.
func (*I3Node) Descendents ¶
Returns a slice of all descendent nodes.
func (*I3Node) FindByWindow ¶
Returns a node that has given window id.
func (*I3Node) FindFocused ¶
Returns a node that is being focused now.
func (*I3Node) Workspaces ¶
Returns all nodes of workspace type.
type I3Version ¶
type I3Version struct { Major int32 Minor int32 Patch int32 HumanReadable string `json:"human_readable"` LoadedConfigFileName string `json:"loaded_config_file_name"` }
I3Version represents the version of i3. For documentation of the fields, refer to http://i3wm.org/docs/ipc.html#_version_reply.
type IPCSocket ¶
type IPCSocket struct {
// contains filtered or unexported fields
}
IPCSocket represents a Unix socket to communicate with i3.
func GetIPCSocket ¶
GetIPCSocket creates a new IPC socket.
func (*IPCSocket) Command ¶
Command sends a command to i3. FIXME: Doesn't support chained commands yet.
func (*IPCSocket) GetBarConfig ¶
GetBarConfig returns the configuration of the bar with the given ID.
func (*IPCSocket) GetOutputs ¶
GetOutputs fetches the list of current outputs.
func (*IPCSocket) GetVersion ¶
GetVersion fetches the version of i3.
func (*IPCSocket) GetWorkspaces ¶
GetWorkspaces fetches a list of all current workspaces.
type MessageError ¶
type MessageError string
MessageError for communication failures.
func (MessageError) Error ¶
func (error MessageError) Error() string
type MessageType ¶
type MessageType int32
A MessageType that Raw() accepts.
const ( I3Command MessageType = iota I3GetWorkspaces I3Subscribe I3GetOutputs I3GetTree I3GetMarks I3GetBarConfig I3GetVersion )
type MessageTypeError ¶
type MessageTypeError string
MessageTypeError for unknown message types.
func (MessageTypeError) Error ¶
func (error MessageTypeError) Error() string
type Output ¶
type Output struct { Name string Active bool CurrentWorkspace string `json:"current_workspace"` Rect Rect }
Output represents an output. For documentation of the fields, refer to http://i3wm.org/docs/ipc.html#_outputs_reply.
type SubscribeError ¶
type SubscribeError string
SubscribeError represents a subscription-related error.
func (SubscribeError) Error ¶
func (subscribeError SubscribeError) Error() string