.\" Generated by scdoc 1.11.0 .\" Complete documentation for this program is not available as a GNU info page .ie \n(.g .ds Aq \(aq .el .ds Aq ' .nh .ad l .\" Begin generated content: .TH "sway-ipc" "7" "2020-11-05" .P .SH NAME .P sway-ipc - IPC protocol for sway .P .SH DESCRIPTION .P This details the interprocess communication (IPC) protocol for \fBsway\fR(1). This IPC protocol can be used to control or obtain information from a sway process. .P The IPC protocol uses a UNIX socket as the method of communication. The path to the socket is stored in the environment variable \fISWAYSOCK\fR and, for backwards compatibility with i3, \fII3SOCK\fR. You can also retrieve the socket path by calling \fIsway --get-socketpath\fR. .P .SH MESSAGE AND REPLY FORMAT .P The format for messages and replies is: .RS 4 .RE Where .br is \fIi3-ipc\fR, for compatibility with i3 .br is a 32-bit integer in native byte order .br is a 32-bit integer in native byte order .P For example, sending the \fIexit\fR command would look like the following hexdump: .nf .RS 4 00000000 | 69 33 2d 69 70 63 04 00 00 00 00 00 00 00 65 78 |i3-ipc\&.\&.\&.\&.\&.\&.\&.\&.ex| 00000010 | 69 74 |it | .fi .RE .P The payload for replies will be a valid serialized JSON data structure. .P .SH MESSAGES AND REPLIES .P The following message types and their corresponding reply types are currently supported. \fBFor all replies, any properties not listed are subject to removal.\fR .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBTYPE NUMBER\fR T} T{ \fBMESSAGE NAME\fR T} T{ \fBPURPOSE\fR T} T{ 0 T} T{ RUN_COMMAND T} T{ Runs the payload as sway commands T} T{ 1 T} T{ GET_WORKSPACES T} T{ Get the list of current workspaces T} T{ 2 T} T{ SUBSCRIBE T} T{ Subscribe the IPC connection to the events listed in the payload T} T{ 3 T} T{ GET_OUTPUTS T} T{ Get the list of current outputs T} T{ 4 T} T{ GET_TREE T} T{ Get the node layout tree T} T{ 5 T} T{ GET_MARKS T} T{ Get the names of all the marks currently set T} T{ 6 T} T{ GET_BAR_CONFIG T} T{ Get the specified bar config or a list of bar config names T} T{ 7 T} T{ GET_VERSION T} T{ Get the version of sway that owns the IPC socket T} T{ 8 T} T{ GET_BINDING_MODES T} T{ Get the list of binding mode names T} T{ 9 T} T{ GET_CONFIG T} T{ Returns the config that was last loaded T} T{ 10 T} T{ SEND_TICK T} T{ Sends a tick event with the specified payload T} T{ 11 T} T{ SYNC T} T{ Replies failure object for i3 compatibility T} T{ 12 T} T{ GET_BINDING_STATE T} T{ Request the current binding state, e.g. the currently active binding mode name. T} T{ 100 T} T{ GET_INPUTS T} T{ Get the list of input devices T} T{ 101 T} T{ GET_SEATS T} T{ Get the list of seats T} .TE .sp 1 .SS 0. RUN_COMMAND .P \fBMESSAGE\fR .br Parses and runs the payload as sway commands .P \fBREPLY\fR .br An array of objects corresponding to each command that was parsed. Each object has the property \fIsuccess\fR, which is a boolean indicating whether the command was successful. The object may also contain the property \fIerror\fR, which is a human readable error message. .P \fBExample Reply:\fR .nf .RS 4 [ { "success": true }, { "success": false, "error": "Invalid/unknown command" } ] .fi .RE .P .SS 1. GET_WORKSPACES .P \fBMESSAGE\fR .br Retrieves the list of workspaces. .P \fBREPLY\fR .br The reply is an array of objects corresponding to each workspace. Each object has the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ num T} T{ integer T} T{ The workspace number or -1 for workspaces that do not start with a number T} T{ name T} T{ string T} T{ The name of the workspace T} T{ visible T} T{ boolean T} T{ Whether the workspace is currently visible on any output T} T{ focused T} T{ boolean T} T{ Whether the workspace is currently focused by the default seat (\fIseat0\fR) T} T{ urgent T} T{ boolean T} T{ Whether a view on the workspace has the urgent flag set T} T{ rect T} T{ object T} T{ The bounds of the workspace. It consists of \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR T} T{ output T} T{ string T} T{ The name of the output that the workspace is on T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 [ { "num": 1, "name": "1", "visible": true, "focused": true, "rect": { "x": 0, "y": 23, "width": 1920, "height": 1057 }, "output": "eDP-1" }, ] .fi .RE .P .SS 2. SUBSCRIBE .P \fBMESSAGE\fR .br Subscribe this IPC connection to the event types specified in the message payload. The payload should be a valid JSON array of events. See the \fIEVENTS\fR section for the list of supported events. .P \fBREPLY\fR .br A single object that contains the property \fIsuccess\fR, which is a boolean value indicating whether the subscription was successful or not. .P \fBExample Reply:\fR .nf .RS 4 { "success": true } .fi .RE .P .SS 3. GET_OUTPUTS .P \fBMESSAGE\fR .br Retrieve the list of outputs .P \fBREPLY\fR .br An array of objects corresponding to each output. Each object has the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ name T} T{ string T} T{ The name of the output. On DRM, this is the connector T} T{ make T} T{ string T} T{ The make of the output T} T{ model T} T{ string T} T{ The model of the output T} T{ serial T} T{ string T} T{ The output's serial number as a hexadecimal string T} T{ active T} T{ boolean T} T{ Whether this output is active/enabled T} T{ dpms T} T{ boolean T} T{ Whether this output is on/off (via DPMS) T} T{ primary T} T{ boolean T} T{ For i3 compatibility, this will be false. It does not make sense in Wayland T} T{ scale T} T{ float T} T{ The scale currently in use on the output or \fI-1\fR for disabled outputs T} T{ subpixel_hinting T} T{ string T} T{ The subpixel hinting current in use on the output. This can be \fIrgb\fR, \fIbgr\fR, \fIvrgb\fR, \fIvbgr\fR, or \fInone\fR T} T{ transform T} T{ string T} T{ The transform currently in use for the output. This can be \fInormal\fR, \fI90\fR, \fI180\fR, \fI270\fR, \fIflipped-90\fR, \fIflipped-180\fR, or \fIflipped-270\fR T} T{ current_workspace T} T{ string T} T{ The workspace currently visible on the output or \fInull\fR for disabled outputs T} T{ modes T} T{ array T} T{ An array of supported mode objects. Each object contains \fIwidth\fR, \fIheight\fR, and \fIrefresh\fR T} T{ current_mode T} T{ object T} T{ An object representing the current mode containing \fIwidth\fR, \fIheight\fR, and \fIrefresh\fR T} T{ rect T} T{ object T} T{ The bounds for the output consisting of \fIx\fR, \fIy\fR, \fIwidth\fR, and \fIheight\fR T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 [ { "name": "HDMI-A-2", "make": "Unknown", "model": "NS-19E310A13", "serial": "0x00000001", "active": true, "primary": false, "scale": 1\&.0, "subpixel_hinting": "rgb", "transform": "normal", "current_workspace": "1", "modes": [ { "width": 640, "height": 480, "refresh": 59940 }, { "width": 800, "height": 600, "refresh": 60317 }, { "width": 1024, "height": 768, "refresh": 60004 }, { "width": 1920, "height": 1080, "refresh": 60000 } ], "current_mode": { "width": 1920, "height": 1080, "refresh": 60000 } } ] .fi .RE .P .SS 4. GET_TREE .P \fBMESSAGE\fR .br Retrieve a JSON representation of the tree .P \fBREPLY\fR .br An array of object the represent the current tree. Each object represents one node and will have the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ id T} T{ integer T} T{ The internal unique ID for this node T} T{ name T} T{ string T} T{ The name of the node such as the output name or window title. For the scratchpad, this will be \fI__i3_scratch\fR for compatibility with i3. T} T{ type T} T{ string T} T{ The node type. It can be \fIroot\fR, \fIoutput\fR, \fIworkspace\fR, \fIcon\fR, or \fIfloating_con\fR T} T{ border T} T{ string T} T{ The border style for the node. It can be \fInormal\fR, \fInone\fR, \fIpixel\fR, or \fIcsd\fR T} T{ current_border_width T} T{ integer T} T{ Number of pixels used for the border width T} T{ layout T} T{ string T} T{ The node's layout. It can either be \fIsplith\fR, \fIsplitv\fR, \fIstacked\fR, \fItabbed\fR, or \fIoutput\fR T} T{ orientation T} T{ string T} T{ The node's orientation. It can be \fIvertical\fR, \fIhorizontal\fR, or \fInone\fR T} T{ percent T} T{ float T} T{ The percentage of the node's parent that it takes up or \fInull\fR for the root and other special nodes such as the scratchpad T} T{ rect T} T{ object T} T{ The absolute geometry of the node. The window decorations are excluded from this, but borders are included. T} T{ window_rect T} T{ object T} T{ The geometry of the contents inside the node. The window decorations are excluded from this calculation, but borders are included. T} T{ deco_rect T} T{ object T} T{ The geometry of the decorations for the node relative to the parent node T} T{ geometry T} T{ object T} T{ The natural geometry of the contents if it were to size itself T} T{ urgent T} T{ boolean T} T{ Whether the node or any of its descendants has the urgent hint set. Note: This may not exist when compiled without \fIxwayland\fR support T} T{ sticky T} T{ boolean T} T{ Whether the node is sticky (shows on all workspaces) T} T{ marks T} T{ array T} T{ List of marks assigned to the node T} T{ focused T} T{ boolean T} T{ Whether the node is currently focused by the default seat (\fIseat0\fR) T} T{ focus T} T{ array T} T{ Array of child node IDs in the current focus order T} T{ nodes T} T{ array T} T{ The tiling children nodes for the node T} T{ floating_nodes T} T{ array T} T{ The floating children nodes for the node T} T{ representation T} T{ string T} T{ (Only workspaces) A string representation of the layout of the workspace that can be used as an aid in submitting reproduction steps for bug reports T} T{ fullscreen_mode T} T{ integer T} T{ (Only containers and views) The fullscreen mode of the node. 0 means none, 1 means full workspace, and 2 means global fullscreen T} T{ app_id T} T{ string T} T{ (Only views) For an xdg-shell view, the name of the application, if set. Otherwise, \fInull\fR T} T{ pid T} T{ integer T} T{ (Only views) The PID of the application that owns the view T} T{ visible T} T{ boolean T} T{ (Only views) Whether the node is visible T} T{ shell T} T{ string T} T{ (Only views) The shell of the view, such as \fIxdg_shell\fR or \fIxwayland\fR T} T{ inhibit_idle T} T{ boolean T} T{ (Only views) Whether the view is inhibiting the idle state T} T{ idle_inhibitors T} T{ object T} T{ (Only views) An object containing the state of the \fIapplication\fR and \fIuser\fR idle inhibitors. \fIapplication\fR can be \fIenabled\fR or \fInone\fR. \fIuser\fR can be \fIfocus\fR, \fIfullscreen\fR, \fIopen\fR, \fIvisible\fR or \fInone\fR. T} T{ window T} T{ integer T} T{ (Only xwayland views) The X11 window ID for the xwayland view T} T{ window_properties T} T{ object T} T{ (Only xwayland views) An object containing the \fItitle\fR, \fIclass\fR, \fIinstance\fR, \fIwindow_role\fR, \fIwindow_type\fR, and \fItransient_for\fR for the view T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 { "id": 1, "name": "root", "rect": { "x": 0, "y": 0, "width": 1920, "height": 1080 }, "focused": false, "focus": [ 3 ], "border": "none", "current_border_width": 0, "layout": "splith", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "root", "nodes": [ { "id": 2147483647, "name": "__i3", "rect": { "x": 0, "y": 0, "width": 1920, "height": 1080 }, "focused": false, "focus": [ 2147483646 ], "border": "none", "current_border_width": 0, "layout": "output", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "output", "nodes": [ { "id": 2147483646, "name": "__i3_scratch", "rect": { "x": 0, "y": 0, "width": 1920, "height": 1080 }, "focused": false, "focus": [ ], "border": "none", "current_border_width": 0, "layout": "splith", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "workspace" } ] }, { "id": 3, "name": "eDP-1", "rect": { "x": 0, "y": 0, "width": 1920, "height": 1080 }, "focused": false, "focus": [ 4 ], "border": "none", "current_border_width": 0, "layout": "output", "orientation": "none", "percent": 1\&.0, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "output", "active": true, "primary": false, "make": "Unknown", "model": "0x38ED", "serial": "0x00000000", "scale": 1\&.0, "transform": "normal", "current_workspace": "1", "modes": [ { "width": 1920, "height": 1080, "refresh": 60052 } ], "current_mode": { "width": 1920, "height": 1080, "refresh": 60052 }, "nodes": [ { "id": 4, "name": "1", "rect": { "x": 0, "y": 23, "width": 1920, "height": 1057 }, "focused": false, "focus": [ 6, 5 ], "border": "none", "current_border_width": 0, "layout": "splith", "orientation": "horizontal", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "num": 1, "output": "eDP-1", "type": "workspace", "representation": "H[URxvt termite]", "nodes": [ { "id": 5, "name": "urxvt", "rect": { "x": 0, "y": 23, "width": 960, "height": 1057 }, "focused": false, "focus": [ ], "border": "normal", "current_border_width": 2, "layout": "none", "orientation": "none", "percent": 0\&.5, "window_rect": { "x": 2, "y": 0, "width": 956, "height": 1030 }, "deco_rect": { "x": 0, "y": 0, "width": 960, "height": 25 }, "geometry": { "x": 0, "y": 0, "width": 1124, "height": 422 }, "window": 4194313, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "con", "fullscreen_mode": 0, "pid": 23959, "app_id": null, "visible": true, "shell": "xwayland", "inhibit_idle": true, "idle_inhibitors": { "application": "none", "user": "visible", }, "window_properties": { "class": "URxvt", "instance": "urxvt", "title": "urxvt", "transient_for": null }, "nodes": [ ] }, { "id": 6, "name": "", "rect": { "x": 960, "y": 23, "width": 960, "height": 1057 }, "focused": true, "focus": [ ], "border": "normal", "current_border_width": 2, "layout": "none", "orientation": "none", "percent": 0\&.5, "window_rect": { "x": 2, "y": 0, "width": 956, "height": 1030 }, "deco_rect": { "x": 0, "y": 0, "width": 960, "height": 25 }, "geometry": { "x": 0, "y": 0, "width": 817, "height": 458 }, "window": null, "urgent": false, "floating_nodes": [ ], "sticky": false, "type": "con", "fullscreen_mode": 0, "pid": 25370, "app_id": "termite", "visible": true, "shell": "xdg_shell", "inhibit_idle": false, "idle_inhibitors": { "application": "none", "user": "fullscreen", }, "nodes": [ ] } ] } ] } ] } .fi .RE .P .SS 5. GET_MARKS .P \fBMESSAGE\fR .br Retrieve the currently set marks .P \fBREPLY\fR .br An array of marks current set. Since each mark can only be set for one container, this is a set so each value is unique and the order is undefined. .P \fBExample Reply:\fR .nf .RS 4 [ "one", "test" ] .fi .RE .P .SS 6. GET_BAR_CONFIG (WITHOUT A PAYLOAD) .P \fBMESSAGE\fR .br When sending without a payload, this retrieves the list of configured bar IDs .P \fBREPLY\fR .br An array of bar IDs, which are strings .P \fBExample Reply:\fR .nf .RS 4 [ "bar-0", "bar-1" ] .fi .RE .P .SS 6. GET_BAR_CONFIG (WITH A PAYLOAD) .P \fBMESSAGE\fR .br When sent with a bar ID as the payload, this retrieves the config associated with the specified by the bar ID in the payload. This is used by swaybar, but could also be used for third party bars .P \fBREPLY\fR .br An object that represents the configuration for the bar with the bar ID sent as the payload. The following properties exists and more information about what their value mean can be found in \fBsway-bar\fR(5): .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ id T} T{ string T} T{ The bar ID T} T{ mode T} T{ string T} T{ The mode for the bar. It can be \fIdock\fR, \fIhide\fR, or \fIinvisible\fR T} T{ position T} T{ string T} T{ The bar's position. It can currently either be \fIbottom\fR or \fItop\fR T} T{ status_command T} T{ string T} T{ The command which should be run to generate the status line T} T{ font T} T{ string T} T{ The font to use for the text on the bar T} T{ workspace_buttons T} T{ boolean T} T{ Whether to display the workspace buttons on the bar T} T{ binding_mode_indicator T} T{ boolean T} T{ Whether to display the current binding mode on the bar T} T{ verbose T} T{ boolean T} T{ For i3 compatibility, this will be the boolean value \fIfalse\fR. T} T{ colors T} T{ object T} T{ An object containing the \fI#RRGGBBAA\fR colors to use for the bar. See below for more information T} T{ gaps T} T{ object T} T{ An object representing the gaps for the bar consisting of \fItop\fR, \fIright\fR, \fIbottom\fR, and \fIleft\fR. T} T{ bar_height T} T{ integer T} T{ The absolute height to use for the bar or \fI0\fR to automatically size based on the font T} T{ status_padding T} T{ integer T} T{ The vertical padding to use for the status line T} T{ status_edge_padding T} T{ integer T} T{ The horizontal padding to use for the status line when at the end of an output T} .TE .sp 1 .P The colors object contains the following properties, which are all strings containing the \fI#RRGGBBAA\fR representation of the color: .TS allbox;c c c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l c l. T{ \fBPROPERTY\fR T} T{ \fBDESCRIPTION\fR T} T{ background T} T{ The color to use for the bar background on unfocused outputs T} T{ statusline T} T{ The color to use for the status line text on unfocused outputs T} T{ separator T} T{ The color to use for the separator text on unfocused outputs T} T{ focused_background T} T{ The color to use for the background of the bar on the focused output T} T{ focused_statusline T} T{ The color to use for the status line text on the focused output T} T{ focused_separator T} T{ The color to use for the separator text on the focused output T} T{ focused_workspace_text T} T{ The color to use for the text of the focused workspace button T} T{ focused_workspace_bg T} T{ The color to use for the background of the focused workspace button T} T{ focused_workspace_border T} T{ The color to use for the border of the focused workspace button T} T{ active_workspace_text T} T{ The color to use for the text of the workspace buttons for the visible workspaces on unfocused outputs T} T{ active_workspace_bg T} T{ The color to use for the background of the workspace buttons for the visible workspaces on unfocused outputs T} T{ active_workspace_border T} T{ The color to use for the border of the workspace buttons for the visible workspaces on unfocused outputs T} T{ inactive_workspace_text T} T{ The color to use for the text of the workspace buttons for workspaces that are not visible T} T{ inactive_workspace_bg T} T{ The color to use for the background of the workspace buttons for workspaces that are not visible T} T{ inactive_workspace_border T} T{ The color to use for the border of the workspace buttons for workspaces that are not visible T} T{ urgent_workspace_text T} T{ The color to use for the text of the workspace buttons for workspaces that contain an urgent view T} T{ urgent_workspace_bg T} T{ The color to use for the background of the workspace buttons for workspaces that contain an urgent view T} T{ urgent_workspace_border T} T{ The color to use for the border of the workspace buttons for workspaces that contain an urgent view T} T{ binding_mode_text T} T{ The color to use for the text of the binding mode indicator T} T{ binding_mode_bg T} T{ The color to use for the background of the binding mode indicator T} T{ binding_mode_border T} T{ The color to use for the border of the binding mode indicator T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 { "id": "bar-0", "mode": "dock", "position": "top", "status_command": "while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done", "font": "monospace 10", "gaps": { "top": 0, "right": 0, "bottom": 0, "left": 0 }, "bar_height": 0, "status_padding": 1, "status_edge_padding": 3, "workspace_buttons": true, "binding_mode_indicator": true, "verbose": false, "pango_markup": false, "colors": { "background": "#323232ff", "statusline": "#ffffffff", "separator": "#666666ff", "focused_background": "#323232ff", "focused_statusline": "#ffffffff", "focused_separator": "#666666ff", "focused_workspace_border": "#4c7899ff", "focused_workspace_bg": "#285577ff", "focused_workspace_text": "#ffffffff", "inactive_workspace_border": "#32323200", "inactive_workspace_bg": "#32323200", "inactive_workspace_text": "#5c5c5cff", "active_workspace_border": "#333333ff", "active_workspace_bg": "#5f676aff", "active_workspace_text": "#ffffffff", "urgent_workspace_border": "#2f343aff", "urgent_workspace_bg": "#900000ff", "urgent_workspace_text": "#ffffffff", "binding_mode_border": "#2f343aff", "binding_mode_bg": "#900000ff", "binding_mode_text": "#ffffffff" }, } .fi .RE .P .SS 7. GET_VERSION .P \fBMESSAGE\fR .br Retrieve version information about the sway process .P \fBREPLY\fR .br An object containing the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ major T} T{ integer T} T{ The major version of the sway process T} T{ minor T} T{ integer T} T{ The minor version of the sway process T} T{ patch T} T{ integer T} T{ The patch version of the sway process T} T{ human_readable T} T{ string T} T{ A human readable version string that will likely contain more useful information such as the git commit short hash and git branch T} T{ loaded_config_file_name T} T{ string T} T{ The path to the loaded config file T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 { "human_readable": "1\&.0-rc1-117-g2f7247e0 (Feb 24 2019, branch 'master')", "major": 1, "minor": 0, "patch": 0, "loaded_config_file_name": "/home/redsoxfan/\&.config/sway/config" } .fi .RE .P .SS 8. GET_BINDING_MODES .P \fBMESSAGE\fR .br Retrieve the list of binding modes that currently configured .P \fBREPLY\fR .br An array of strings, with each string being the name of a binding mode. This will always contain at least one mode (currently \fIdefault\fR), which is the default binding mode .P \fBExample Reply:\fR .nf .RS 4 [ "default", "resize", ] .fi .RE .P .SS 9. GET_CONFIG .P \fBMESSAGE\fR .br Retrieve the contents of the config that was last loaded .P \fBREPLY\fR .br An object with a single string property containing the contents of the config .P \fBExample Reply:\fR .nf .RS 4 { "config": "set $mod Mod4nbindsym $mod+q exitn" } .fi .RE .P .SS 10. SEND_TICK .P \fBMESSAGE\fR .br Issues a \fITICK\fR event to all clients subscribing to the event to ensure that all events prior to the tick were received. If a payload is given, it will be included in the \fITICK\fR event .P \fBREPLY\fR .br A single object contains the property \fIsuccess\fR, which is a boolean value indicating whether the \fITICK\fR event was sent. .P \fBExample Reply:\fR .nf .RS 4 { "success": true } .fi .RE .P .SS 11. SYNC .P \fBMESSAGE\fR .br For i3 compatibility, this command will just return a failure object since it does not make sense to implement in sway due to the X11 nature of the command. If you are curious about what this IPC command does in i3, refer to the i3 documentation. .P \fBREPLY\fR .br A single object that contains the property \fIsuccess\fR, which is set to the boolean value \fIfalse\fR. .P \fBExact Reply:\fR .nf .RS 4 { "success": false } .fi .RE .P .SS 12. GET_BINDING_STATE .P \fBMESSAGE\fR .br Returns the currently active binding mode. .P \fBREPLY\fR .br A single object that contains the property \fIname\fR, which is set to the currently active binding mode as a string. .P \fBExact Reply:\fR .nf .RS 4 { "name": "default" } .fi .RE .P .P .SS 100. GET_INPUTS .P \fBMESSAGE\fR .br Retrieve a list of the input devices currently available .P \fBREPLY\fR .br An array of objects corresponding to each input device. Each object has the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ identifier T} T{ string T} T{ The identifier for the input device T} T{ name T} T{ string T} T{ The human readable name for the device T} T{ vendor T} T{ integer T} T{ The vendor code for the input device T} T{ product T} T{ integer T} T{ The product code for the input device T} T{ type T} T{ string T} T{ The device type. Currently this can be \fIkeyboard\fR, \fIpointer\fR, \fItouch\fR, \fItablet_tool\fR, \fItablet_pad\fR, or \fIswitch\fR T} T{ xkb_active_layout_name T} T{ string T} T{ (Only keyboards) The name of the active keyboard layout in use T} T{ xkb_layout_names T} T{ array T} T{ (Only keyboards) A list a layout names configured for the keyboard T} T{ xkb_active_layout_index T} T{ integer T} T{ (Only keyboards) The index of the active keyboard layout in use T} T{ libinput T} T{ object T} T{ (Only libinput devices) An object describing the current device settings. See below for more information T} .TE .sp 1 The \fIlibinput\fR object describes the device configuration for libinput devices. Only properties that are supported for the device will be added to the object. In addition to the possible options listed, all string properties may also be \fIunknown\fR, in the case that a new option is added to libinput. See \fBsway-input\fR(5) for information on the meaning of the possible values. The following properties will be included for devices that support them: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ send_events T} T{ string T} T{ Whether events are being sent by the device. It can be \fIenabled\fR, \fIdisabled\fR, or \fIdisabled_on_external_mouse\fR T} T{ tap T} T{ string T} T{ Whether tap to click is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ tap_button_map T} T{ string T} T{ The finger to button mapping in use. It can be \fIlmr\fR or \fIlrm\fR T} T{ tap_drag T} T{ string T} T{ Whether tap-and-drag is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ tap_drag_lock T} T{ string T} T{ Whether drag-lock is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ accel_speed T} T{ double T} T{ The pointer-acceleration in use T} T{ accel_profile T} T{ string T} T{ The acceleration profile in use. It can be \fInone\fR, \fIflat\fR, or \fIadaptive\fR T} T{ natural_scroll T} T{ string T} T{ Whether natural scrolling is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ left_handed T} T{ string T} T{ Whether left-handed mode is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ click_method T} T{ string T} T{ The click method in use. It can be \fInone\fR, \fIbutton_areas\fR, or \fIclickfinger\fR T} T{ middle_emulation T} T{ string T} T{ Whether middle emulation is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ scroll_method T} T{ string T} T{ The scroll method in use. It can be \fInone\fR, \fItwo_finger\fR, \fIedge\fR, or \fIon_button_down\fR T} T{ scroll_button T} T{ int T} T{ The scroll button to use when \fIscroll_method\fR is \fIon_button_down\fR. This will be given as an input event code T} T{ dwt T} T{ string T} T{ Whether disable-while-typing is enabled. It can be \fIenabled\fR or \fIdisabled\fR T} T{ calibration_matrix T} T{ array T} T{ An array of 6 floats representing the calibration matrix for absolute devices such as touchscreens T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 [ { "identifier": "1:1:AT_Translated_Set_2_keyboard", "name": "AT Translated Set 2 keyboard", "vendor": 1, "product": 1, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "1267:5:Elan_Touchpad", "name": "Elan Touchpad", "vendor": 1267, "product": 5, "type": "pointer", "libinput": { "send_events": "enabled", "tap": "enabled", "tap_button_map": "lmr", "tap_drag": "enabled", "tap_drag_lock": "disabled", "accel_speed": 0\&.0, "accel_profile": "none", "natural_scroll", "disabled", "left_handed": "disabled", "click_method": "button_areas", "middle_emulation": "disabled", "scroll_method": "edge", "dwt": "enabled" } }, { "identifier": "3034:22494:USB2\&.0_VGA_UVC_WebCam:_USB2\&.0_V", "name": "USB2\&.0 VGA UVC WebCam: USB2\&.0 V", "vendor": 3034, "product": 22494, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:3:Sleep_Button", "name": "Sleep Button", "vendor": 0, "product": 3, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:5:Lid_Switch", "name": "Lid Switch", "vendor": 0, "product": 5, "type": "switch", "libinput": { "send_events": "enabled" } }, { "identifier": "0:6:Video_Bus", "name": "Video Bus", "vendor": 0, "product": 6, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:1:Power_Button", "name": "Power Button", "vendor": 0, "product": 1, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } } ] .fi .RE .P .SS 101. GET_SEATS .P \fBMESSAGE\fR .br Retrieve a list of the seats currently configured .P \fBREPLY\fR .br An array of objects corresponding to each seat. There will always be at least one seat. Each object has the following properties: .P .TS allbox;c c c c c r c c r c c r c c r. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ name T} T{ string T} T{ The unique name for the seat T} T{ capabilities T} T{ integer T} T{ The number of capabilities that the seat has T} T{ focus T} T{ integer T} T{ The id of the node currently focused by the seat or \fI0\fR when the seat is not currently focused by a node (i.e. a surface layer or xwayland unmanaged has focus) T} T{ devices T} T{ array T} T{ An array of input devices that are attached to the seat. Currently, this is an array of objects that are identical to those returned by \fIGET_INPUTS\fR T} .TE .sp 1 .P \fBExample Reply:\fR .nf .RS 4 [ { "name": "seat0", "capabilities": 3, "focus": 7, "devices": [ { "identifier": "1:1:AT_Translated_Set_2_keyboard", "name": "AT Translated Set 2 keyboard", "vendor": 1, "product": 1, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "1267:5:Elan_Touchpad", "name": "Elan Touchpad", "vendor": 1267, "product": 5, "type": "pointer", "libinput": { "send_events": "enabled", "tap": "enabled", "tap_button_map": "lmr", "tap_drag": "enabled", "tap_drag_lock": "disabled", "accel_speed": 0\&.0, "accel_profile": "none", "natural_scroll", "disabled", "left_handed": "disabled", "click_method": "button_areas", "middle_emulation": "disabled", "scroll_method": "edge", "dwt": "enabled" } }, { "identifier": "3034:22494:USB2\&.0_VGA_UVC_WebCam:_USB2\&.0_V", "name": "USB2\&.0 VGA UVC WebCam: USB2\&.0 V", "vendor": 3034, "product": 22494, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:3:Sleep_Button", "name": "Sleep Button", "vendor": 0, "product": 3, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:5:Lid_Switch", "name": "Lid Switch", "vendor": 0, "product": 5, "type": "switch", "libinput": { "send_events": "enabled" } }, { "identifier": "0:6:Video_Bus", "name": "Video Bus", "vendor": 0, "product": 6, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } }, { "identifier": "0:1:Power_Button", "name": "Power Button", "vendor": 0, "product": 1, "type": "keyboard", "xkb_active_layout_name": "English (US)", "libinput": { "send_events": "enabled" } } ] } ] .fi .RE .P .SH EVENTS .P Events are a way for client to get notified of changes to sway. A client can subscribe to any events it wants to be notified of changes for. The event is sent in the same format as a reply. The following events are currently available: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l c c l c c l c c l. T{ \fBEVENT TYPE\fR T} T{ \fBNAME\fR T} T{ \fBDESCRIPTION\fR T} T{ 0x80000000 T} T{ workspace T} T{ Sent whenever an event involving a workspace occurs such as initialization of a new workspace or a different workspace gains focus T} T{ 0x80000002 T} T{ mode T} T{ Sent whenever the binding mode changes T} T{ 0x80000003 T} T{ window T} T{ Sent whenever an event involving a view occurs such as being reparented, focused, or closed T} T{ 0x80000004 T} T{ barconfig_update T} T{ Sent whenever a bar config changes T} T{ 0x80000005 T} T{ binding T} T{ Sent when a configured binding is executed T} T{ 0x80000006 T} T{ shutdown T} T{ Sent when the ipc shuts down because sway is exiting T} T{ 0x80000007 T} T{ tick T} T{ Sent when an ipc client sends a \fISEND_TICK\fR message T} T{ 0x80000014 T} T{ bar_state_update T} T{ Send when the visibility of a bar should change due to a modifier T} T{ 0x80000015 T} T{ input T} T{ Sent when something related to input devices changes T} .TE .sp 1 .P .SS 0x80000000. WORKSPACE .P Sent whenever a change involving a workspace occurs. The event consists of a single object with the following properties: .P .TS allbox;c c c c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ change T} T{ string T} T{ The type of change that occurred. See below for more information T} T{ current T} T{ object T} T{ An object representing the workspace effected or \fInull\fR for \fIreload\fR changes T} T{ old T} T{ object T} T{ For a \fIfocus\fR change, this is will be an object representing the workspace being switched from. Otherwise, it is \fInull\fR T} .TE .sp 1 .P The following change types are currently available: .TS allbox;c c c l c l c l c l c l c l c l. T{ \fBTYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ init T} T{ The workspace was created T} T{ empty T} T{ The workspace is empty and is being destroyed since it is not visible T} T{ focus T} T{ The workspace was focused. See the \fIold\fR property for the previous focus T} T{ move T} T{ The workspace was moved to a different output T} T{ rename T} T{ The workspace was renamed T} T{ urgent T} T{ A view on the workspace has had their urgency hint set or all urgency hints for views on the workspace have been cleared T} T{ reload T} T{ The configuration file has been reloaded T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "change": "init", "old": null, "current": { "id": 10, "name": "2", "rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "focused": false, "focus": [ ], "border": "none", "current_border_width": 0, "layout": "splith", "percent": null, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 0, "height": 0 }, "window": null, "urgent": false, "floating_nodes": [ ], "num": 2, "output": "eDP-1", "type": "workspace", "representation": null, "nodes": [ ] } } .fi .RE .P .SS 0x80000002. MODE .P Sent whenever the binding mode changes. The event consists of a single object with the following properties: .P .TS allbox;c c c c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ change T} T{ string T} T{ The binding mode that became active T} T{ pango_markup T} T{ boolean T} T{ Whether the mode should be parsed as pango markup T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "change": "default", "pango_markup": false } .fi .RE .P .SS 0x80000003. WINDOW .P Sent whenever a change involving a view occurs. The event consists of a single object with the following properties: .P .TS allbox;c c c c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ change T} T{ string T} T{ The type of change that occurred. See below for more information T} T{ container T} T{ object T} T{ An object representing the view effected T} .TE .sp 1 .P The following change types are currently available: .TS allbox;c c c l c l c l c l c l c l c l c l c l. T{ \fBTYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ new T} T{ The view was created T} T{ close T} T{ The view was closed T} T{ focus T} T{ The view was focused T} T{ title T} T{ The view's title has changed T} T{ fullscreen_mode T} T{ The view's fullscreen mode has changed T} T{ move T} T{ The view has been reparented in the tree T} T{ floating T} T{ The view has become floating or is no longer floating T} T{ urgent T} T{ The view's urgency hint has changed status T} T{ mark T} T{ A mark has been added or removed from the view T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "change": "new", "container": { "id": 12, "name": null, "rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "focused": false, "focus": [ ], "border": "none", "current_border_width": 0, "layout": "none", "percent": 0\&.0, "window_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "deco_rect": { "x": 0, "y": 0, "width": 0, "height": 0 }, "geometry": { "x": 0, "y": 0, "width": 1124, "height": 422 }, "window": 4194313, "urgent": false, "floating_nodes": [ ], "type": "con", "pid": 19787, "app_id": null, "window_properties": { "class": "URxvt", "instance": "urxvt", "transient_for": null }, "nodes": [ ] } } .fi .RE .P .SS 0x80000004. BARCONFIG_UPDATE .P Sent whenever a config for a bar changes. The event is identical to that of \fIGET_BAR_CONFIG\fR when a bar ID is given as a payload. See \fI6. GET_BAR_CONFIG (WITH A PAYLOAD)\fR above for more information. .P .SS 0x80000005. BINDING .P Sent whenever a binding is executed. The event is a single object with the following properties: .P .TS allbox;c c c c c l c c l c c l c c l c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ change T} T{ string T} T{ The change that occurred for the binding. Currently this will only be \fIrun\fR T} T{ command T} T{ string T} T{ The command associated with the binding T} T{ event_state_mask T} T{ array T} T{ An array of strings that correspond to each modifier key for the binding T} T{ input_code T} T{ integer T} T{ For keyboard bindcodes, this is the key code for the binding. For mouse bindings, this is the X11 button number, if there is an equivalent. In all other cases, this will be \fI0\fR. T} T{ symbol T} T{ string T} T{ For keyboard bindsyms, this is the bindsym for the binding. Otherwise, this will be \fInull\fR T} T{ input_type T} T{ string T} T{ The input type that triggered the binding. This is either \fIkeyboard\fR or \fImouse\fR T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "change": "run", "binding": { "command": "workspace 2", "event_state_mask": [ "Mod4" ], "input_code": 0, "symbol": "2", "input_type": "keyboard" } } .fi .RE .P .SS 0x80000006. SHUTDOWN .P Sent whenever the IPC is shutting down. The event is a single object with the property \fIchange\fR, which is a string containing the reason for the shutdown. Currently, the only value for \fIchange\fR is \fIexit\fR, which is issued when sway is exiting. .P \fBExample Event:\fR .nf .RS 4 { "change": "exit" } .fi .RE .P .SS 0x80000007. TICK .P Sent when first subscribing to tick events or by a \fISEND_TICK\fR message. The event is a single object with the following properties: .P .TS allbox;c c c c c c c c c. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ first T} T{ boolean T} T{ Whether this event was triggered by subscribing to the tick events T} T{ payload T} T{ string T} T{ The payload given with a \fISEND_TICK\fR message, if any. Otherwise, an empty string T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "first": true "payload": "" } .fi .RE .P .SS 0x80000014. BAR_STATE_UPDATE .P Sent when the visibility of a bar changes due to a modifier being pressed. The event is a single object with the following properties: .P .TS allbox;c c c c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ id T} T{ string T} T{ The bar ID effected T} T{ visible_by_modifier T} T{ boolean T} T{ Whether the bar should be made visible due to a modifier being pressed T} .TE .sp 1 .P \fBExample Event:\fR .nf .RS 4 { "id": "bar-0", "visible_by_modifier": true } .fi .RE .P .SS 0x80000015. INPUT .P Sent when something related to the input devices changes. The event is a single object with the following properties: .P .TS allbox;c c c c c l c c l. T{ \fBPROPERTY\fR T} T{ \fBDATA TYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ change T} T{ string T} T{ What has changed T} T{ input T} T{ object T} T{ An object representing the input that is identical the ones GET_INPUTS gives T} .TE .sp 1 The following change types are currently available: .TS allbox;c c c l c l c l c l c l. T{ \fBTYPE\fR T} T{ \fBDESCRIPTION\fR T} T{ added T} T{ The input device became available T} T{ removed T} T{ The input device is no longer available T} T{ xkb_keymap T} T{ (Keyboards only) The keymap for the keyboard has changed T} T{ xkb_layout T} T{ (Keyboards only) The effective layout in the keymap has changed T} T{ libinput_config T} T{ (libinput device only) A libinput config option for the device changed T} .TE .sp 1 \fBExample Event:\fR .nf .RS 4 { "change": "xkb_layout", "input": { "identifier": "1:1:AT_Translated_Set_2_keyboard", "name": "AT Translated Set 2 keyboard", "vendor": 1, "product": 1, "type": "keyboard", "xkb_layout_names": [ "English (US)", "English (Dvorak)" ], "xkb_active_layout_index": 1, "xkb_active_layout_name": "English (Dvorak)", "libinput": { "send_events": "enabled" } } } .fi .RE .P .SH SEE ALSO .P \fBsway\fR(1) \fBsway\fR(5) \fBsway-bar\fR(5) \fBswaymsg\fR(1) \fBsway-input\fR(5) \fBsway-output\fR(5)