i3ipc

A pure OCaml implementation of the i3 IPC protocol
Library i3ipc
Module I3ipc
type protocol_error =
| No_IPC_socket
| Bad_magic_string of string
| Unexpected_eof
| Unknown_type of Stdint.Uint32.t
| Bad_reply of string

The different errors that may be raised.

exception Protocol_error of protocol_error
module Reply : sig ... end

Type definitions for the command replies.

module Event : sig ... end

Type definitions for the events that can be subscribed to.

Connection to i3

type connection

Type describing a connection to the i3 IPC endpoint.

val connect : unit -> connection Lwt.t

Connect to a running i3 instance.

val disconnect : connection -> unit Lwt.t

Close a connection.

Event subscription

type subscription =
| Workspace
| Output
| Mode
| Window
| BarConfig
| Binding

Subscribe to certain events.

val next_event : connection -> Event.t Lwt.t

Wait for the next event, among those subscribed to.

Commands and queries

val command : connection -> string -> Reply.command_outcome list Lwt.t

Run an i3 command. See http://i3wm.org/docs/userguide.html#_list_of_commands for a list of valid commands.

val get_workspaces : connection -> Reply.workspace list Lwt.t

Get the list of current workspaces.

val get_outputs : connection -> Reply.output list Lwt.t

Get the list of current outputs.

val get_tree : connection -> Reply.node Lwt.t

Get the layout tree. i3 uses a tree data-structure to represent the layout of windows in a workspace.

val get_marks : connection -> Reply.mark list Lwt.t

Get a list of marks (identifiers of containers).

val get_bar_ids : connection -> Reply.bar_id list Lwt.t

Get the list of IDs of all configured bars.

val get_bar_config : connection -> Reply.bar_id -> Reply.bar_config Lwt.t

Get the configuration of the workspace bar with given ID.

val get_version : connection -> Reply.version Lwt.t

Get the version of i3.