.\" Generated by scdoc 1.11.2 .\" 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 "swaymsg" "1" "2023-12-23" .P .SH NAME .P swaymsg - Send messages to a running instance of sway over the IPC socket.\& .P .SH SYNOPSIS .P \fIswaymsg\fR [options.\&.\&.\&] [message] .P .SH OPTIONS .P \fB-h, --help\fR .RS 4 Show help message and quit.\& .P .RE \fB-m, --monitor\fR .RS 4 Monitor for responses until killed instead of exiting after the first response.\& This can only be used with the IPC message type \fIsubscribe\fR.\& If there is a malformed response or an invalid event type was requested, swaymsg will stop monitoring and exit.\& .P .RE \fB-p, --pretty\fR .RS 4 Use pretty output even when not using a tty.\& Not available for all message types.\& .P .RE \fB-q, --quiet\fR .RS 4 Sends the IPC message but does not print the response from sway.\& .P .RE \fB-r, --raw\fR .RS 4 Use raw JSON output even if using a tty.\& .P .RE \fB-s, --socket\fR .RS 4 Use the specified socket path.\& Otherwise, swaymsg will ask sway where the socket is (which is the value of $SWAYSOCK, then of $I3SOCK).\& .P .RE \fB-t, --type\fR .RS 4 Specify the type of IPC message.\& See below.\& .P .RE \fB-v, --version\fR .RS 4 Print the version (of swaymsg) and quit.\& .P .RE .SH IPC MESSAGE TYPES .P \fB\fR .RS 4 The message is a sway command (the same commands you can bind to keybindings in your sway config file).\& It will be executed immediately.\& .P See \fBsway\fR(5) for a list of commands.\& .P \fIswaymsg\fR can return pretty printed (standalone-default) or JSON-formatted (\fB--raw\fR) output.\& For detailed documentation on the returned JSON-data of each message type listed below, refer to \fBsway-ipc\fR(7).\& The JSON-format can contain more information than the pretty print.\& .P Tips: .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} Command expansion is performed twice: once by swaymsg, and again by sway.\& If you have quoted multi-word strings in your command, enclose the entire command in single-quotes.\& For example, use \fIswaymsg '\&output "Foobar Display" enable'\&\fR instead of \fIswaymsg output "Foobar Display" enable\fR.\& Furthermore, note that comma separated options also count as multi-word strings, because commas can be used to execute commands on the same line.\& .RE .RS 4 .ie n \{\ \h'-04'\(bu\h'+03'\c .\} .el \{\ .IP \(bu 4 .\} If you are providing a command that contains a leading hyphen (\fI-\fR), insert two hyphens (\fI--\fR) before the command to signal to swaymsg not to parse anything beyond that point as an option.\& For example, use \fIswaymsg -- mark --add test\fR instead of \fIswaymsg mark --add test\fR.\& .RE .P .RE \fBget_workspaces\fR .RS 4 Gets a list of workspaces and their status.\& .P .RE \fBget_inputs\fR .RS 4 Gets a list of current inputs.\& .P .RE \fBget_outputs\fR .RS 4 Gets a list of current outputs.\& .P .RE \fBget_tree\fR .RS 4 Gets a JSON-encoded layout tree of all open windows, containers, outputs, workspaces, and so on.\& .P .RE \fBget_seats\fR .RS 4 Gets a list of all seats, its properties and all assigned devices.\& .P .RE \fBget_marks\fR .RS 4 Get a JSON-encoded list of marks.\& .P .RE \fBget_bar_config\fR .RS 4 Get a JSON-encoded configuration for swaybar.\& .P .RE \fBget_version\fR .RS 4 Get version information for the running instance of sway.\& .P .RE \fBget_binding_modes\fR .RS 4 Gets a JSON-encoded list of currently configured binding modes.\& .P .RE \fBget_binding_state\fR .RS 4 Gets JSON-encoded info about the current binding state.\& .P .RE \fBget_config\fR .RS 4 Gets a copy of the current configuration.\& Doesn'\&t expand includes.\& .P .RE \fBsend_tick\fR .RS 4 Sends a tick event to all subscribed clients.\& .P .RE \fBsubscribe\fR .RS 4 Subscribe to a list of event types.\& The argument for this type should be provided in the form of a valid JSON array.\& If any of the types are invalid or if a valid JSON array is not provided, this will result in a failure.\& For a list of valid event types and the data returned with them refer to \fBsway-ipc\fR(7).\& .P .RE .SH RETURN CODES .P \fB0\fR .RS 4 Success .P .RE \fB1\fR .RS 4 swaymsg errors such as invalid syntax, unable to connect to the ipc socket or unable to parse sway'\&s reply .P .RE \fB2\fR .RS 4 Sway returned an error when processing the command (ex.\& invalid command, command failed, and invalid subscription request) .P .RE .SH SEE ALSO .P \fBsway\fR(5) \fBsway-bar\fR(5) \fBsway-input\fR(5) \fBsway-output\fR(5) \fBsway-ipc\fR(7)