package i3ipc

  1. Overview
  2. Docs

A pure OCaml implementation of the i3 IPC protocol.

type protocol_error =
  1. | No_IPC_socket
  2. | Bad_magic_string of string
  3. | Unexpected_eof
  4. | Unknown_type of Stdint.Uint32.t
  5. | 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 =
  1. | Workspace
  2. | Output
  3. | Mode
  4. | Window
  5. | BarConfig
  6. | 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.

OCaml

Innovation. Community. Security.