API Docs
I3.Connection
— TypeConnection
UNIX socket connection to a running i3 session. Connection()
will open a connection to the default i3 session conneciton obtained with the command i3 --get-socketpath
. In most use cases this is likely to be the only valid connection.
I3.Node
— TypeNode
A node in an i3 tree.
I3.Output
— TypeOutput
Data structure describing an output device.
I3.Rectangle
— TypeRectangle
A rectangle on a screen within an i3 session.
Fields
x
: $x$ position in pixels.y
: $y$ position in pixels.Δx
: Extent in $x$ in pixels. Referred to by i3 IPC aswidth
.Δy
: Extent in $y$ in pixels. Referred to by i3 IPC asheight
.
I3.Workspace
— TypeWorkspace
Data structure describing and i3 workspace.
AbstractTrees.children
— Methodchildren(n::Node)
Get the immediate children of the i3 tree node.
I3.child
— Methodchild(n::Node, i)
Get the child of n
at index i
.
I3.command
— Methodcommand([cnxn,] cmd)
Execute i3 command cmd
. If no connection is provided, the default will be used.
I3.config
— Functionconfig([cnxn])
Get the currently loaded i3 config file.
I3.criteria_string
— Methodcriteria_string(args)
Construct the string for specifying the command criteria to an i3 command. args
should be in iterable of key-value pairs or 2-tuples.
I3.defaultconnection!
— Methoddefaultconnection!()
Set the cached connection to the default i3 session. This sets a global variable which is accessible through defaultconnection()
.
I3.defaultconnection
— Methoddefaultconnection()
Get the cached connection to the default i3 session.
I3.descendants
— Methoddescendants(𝒻, n::Node)
Return the descendants of node n
for which f(n) == true
.
I3.descendants
— Methoddescendants(𝒻)
Get the descendants of the root node of the current tree for which 𝒻
returns true
.
I3.descendants
— Methoddescendants(n::Node)
Returns an iterator of all descendants of the i3
Node
.
I3.descendants
— Methoddescendants()
Gets all descendants of the current tree. This is just like tree()
, except that it returns the tree flattened.
I3.exec
— Methodexec([cnxn,] arg; no_startup_id=false)
Executes the command given by the string (or Cmd
) arg
. If no_startup_id
, the resulting new window may not open in the same workspace or move thet mouse cursor.
Note that the argument arg
will automatically be enclosed with quotes when sent to i3
, so outer quites are not necessary.
I3.exit
— Functionexit([cnxn])
Exit the i3 session.
I3.floating
— Functionfloating([cnxn])
Toggle the current window between floating and tiled.
I3.focus
— Methodfocus([cnxn, arg]; kwargs...)
Focus a window. arg
should be a string, valid options are "left", "right", "up", "down", "parent", "child", "next" "prev"
. Keyword arguments can be valid command criteria.
Examples
I3.focus("right") # moves focus to window to the right
I3.focus(class="firefox") # focuses the window in which firefox is running
I3.fullscreen
— Functionfullscreen_string([cnxn])
Toggle fullscreen of the current window.
I3.getfocused
— Methodgetfocused(cnxn::Connection)
Get the currently focused window. Returns nothing
if there isn't one.
I3.haschildren
— Methodhaschildren(n::Node)
Returns true
if the i3 tree node has immediate children, else false
.
I3.isfocused
— Methodisfocused(n)
Whether the node is the currently focused window.
I3.isleaf
— Methodisleaf(n)
Whether the node is a leaf, i.e. has no descendants other than itself.
I3.isnormalwindow
— Methodisnormalwindow(n)
Returns true if iswindwo(n)
and the window type is "normal"
. These are "normal" windows in (arguably) the most obvious sense and should exclude toolbars, notifications and docks.
Note: This does not find floating windows.
I3.iswindow
— Methodiswindow(n)
Determines whether a node is a "normal" window. This should imply that the node is drawn on screen provided the workspace containing it is visible. Determining whether the node is actually visible is more expensive, see isvisible
.
Note: This does not find floating windows.
I3.layout
— Methodlayout([cnxn,] arg; toggle=false)
Change the current window layout. Valid optiosn are "default", "tabbed", "stacking", "splitv", "splith"
.
I3.leaves
— Methodleaves(n::Node)
Get all leaves descended from the i3 tree node n
. That is, only nodes which are descended from n
but which do not themsleves have any children will appear in the returned list.
I3.mark
— Methodmark([cnxn,] arg)
Marks the current container with the name arg
.
I3.marks
— Functionmarks([cnxn])
Get list of marks.
I3.messagemeta
— Methodmessagemeta
Extract metadata from and i3 IPC message. Valid messages start with the bytes b"i3-ipc"
followed by the message body as dictionary parsed from JSON.
I3.move
— Functionmove([cnxn,] arg [, x])
Move the current window. Valid arguments are "up", "down", "left", "right"
. If an integer x
is provided, window will be moved by this many pixels.
I3.moveposition
— Methodmoveposition([cnxn,] arg [, x]; absolute=false)
moveposition(x, y)
Move the current window. Valid arguments are "up", "right", "left", "down", "center", "mouse"
.
I3.output
— Methodoutput([cnxn,] name)
Retrieve the output with name name
. Returns nothing
if it does not exist.
I3.outputs
— Methodoutputs([cnxn])
Retrieve a list of outputs on the i3 server accessible at connection cnxn
.
I3.pack
— Methodpack
Prepare a message to be sent to the i3 session via IPC.
I3.receive
— Methodreceive(cnxn)
Receive a message from the i3 session as a JSON. Returns type, v
where type
is the message type and v
is the message body.
I3.receivebytes
— Methodreceivebytes(cnxn)
Receive an IPC message from the i3 session as a Vector{UInt8}
. Returns type, v
where type
is the message type and v
is the message body.
I3.reload
— Functionreload([cnxn])
Reload the i3 session.
I3.restart
— Functionrestart([cnxn])
Restart the i3 session.
I3.send
— Methodsend
Send an IPC message to an i3 session.
I3.sendreceive
— Functionsendreceive(cnxn, mtype, x=nothing)
Send a message of type mtype
with body x
(no body will be included if isnothing(x)
) to the i3 session and wait for a response, returning the response as a dictionary parse from JSON.
I3.sendreceivebytes
— Functionsendreceivebytes(cnxn, mtype, x=nothing)
Send a message of type mtype
with body x
(no body will be included if isnothing(x)
) to the i3 session and wait for a response, returning the response as a Vector{UInt8}
.
I3.serve
— Methodserve(f, sockname)
Create a server at socket sockname
. Once the socket is created, the server will block the thread until a single connection is accepted. Once this occurs, the server will repeatedly execute the function f
on the IO stream from the socket.
To run this asyncronously use @async
. To run on a new CPU thread, use Threads.@spawn
.
I3.socketpath
— Methodsocketpath()
Get the i3 session socket path by calling i3 --get-socketpath
.
I3.split
— Methodsplit([cnxn,] arg)
Split the current window (i.e. so that new windows will be contained in the current windows area).
Valid arguments are "vertical", "horizontal", "toggle"
.
I3.tree
— Methodtree([cnxn])
Get the root node of the i3 session tree. The entire tree is descended from the root node.
I3.unmark
— Functionunmark([cnxn])
Unmark the current container.
I3.workspace
— Methodworkspace([cnxn,] name)
Retrieve the workspace with name name
. Returns nothing
if it does not exist.
I3.workspaces
— Methodworkspaces([cnxn])
Retrieve a list of workspaces on the i3 server accessible at connection cnxn
.