.\" Generated by scdoc 1.11.3 .\" 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" "2024-10-28" .PP .SH NAME .PP swaymsg - Send messages to a running instance of sway over the IPC socket.\& .PP .SH SYNOPSIS .PP \fIswaymsg\fR [options.\&.\&.\&] [message] .PP .SH OPTIONS .PP \fB-h, --help\fR .RS 4 Show help message and quit.\& .PP .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.\& .PP .RE \fB-p, --pretty\fR .RS 4 Use pretty output even when not using a tty.\& Not available for all message types.\& .PP .RE \fB-q, --quiet\fR .RS 4 Sends the IPC message but does not print the response from sway.\& .PP .RE \fB-r, --raw\fR .RS 4 Use raw JSON output even if using a tty.\& .PP .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).\& .PP .RE \fB-t, --type\fR .RS 4 Specify the type of IPC message.\& See below.\& .PP .RE \fB-v, --version\fR .RS 4 Print the version (of swaymsg) and quit.\& .PP .RE .SH IPC MESSAGE TYPES .PP \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.\& .PP See \fBsway\fR(5) for a list of commands.\& .PP \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.\& .PP Tips: .PD 0 .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.\& .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.\& .PD .PP .RE \fBget_workspaces\fR .RS 4 Gets a list of workspaces and their status.\& .PP .RE \fBget_inputs\fR .RS 4 Gets a list of current inputs.\& .PP .RE \fBget_outputs\fR .RS 4 Gets a list of current outputs.\& .PP .RE \fBget_tree\fR .RS 4 Gets a JSON-encoded layout tree of all open windows, containers, outputs, workspaces, and so on.\& .PP .RE \fBget_seats\fR .RS 4 Gets a list of all seats, its properties and all assigned devices.\& .PP .RE \fBget_marks\fR .RS 4 Get a JSON-encoded list of marks.\& .PP .RE \fBget_bar_config\fR .RS 4 Get a JSON-encoded configuration for swaybar.\& .PP .RE \fBget_version\fR .RS 4 Get version information for the running instance of sway.\& .PP .RE \fBget_binding_modes\fR .RS 4 Gets a JSON-encoded list of currently configured binding modes.\& .PP .RE \fBget_binding_state\fR .RS 4 Gets JSON-encoded info about the current binding state.\& .PP .RE \fBget_config\fR .RS 4 Gets a copy of the current configuration.\& Doesn'\&t expand includes.\& .PP .RE \fBsend_tick\fR .RS 4 Sends a tick event to all subscribed clients.\& .PP .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).\& .PP .RE .SH RETURN CODES .PP \fB0\fR .RS 4 Success .PP .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 .PP .RE \fB2\fR .RS 4 Sway returned an error when processing the command (ex.\& invalid command, command failed, and invalid subscription request) .PP .RE .SH SEE ALSO .PP \fBsway\fR(5) \fBsway-bar\fR(5) \fBsway-input\fR(5) \fBsway-output\fR(5) \fBsway-ipc\fR(7)