swaymsg(1)
π swaymsg(1) β the group-chat guide
okay so bestie, picture this: it's a manual page, it's from the General Commands Manual, and its whole personality is swaymsg. Say it with me β swaymsg. That's the vibe. It's the little bestie that talks to a running instance of sway over the IPC socket. That's it. That's the whole job. π
β¨ NAME β¨
swaymsg β send messages to a running instance of sway over the IPC socket. Like sliding into sway's DMs, but with JSON. π¦
πΈ SYNOPSIS πΈ
swaymsg [options...] [message]
π OPTIONS π
-h,--helpβ shows the help message and dips. icon π«Ά-m,--monitorβ keeps watching for responses until it gets killed, instead of exiting after the first response. Lowkey important: this one can only be used with the IPC message typesubscribe. And if there's a malformed response, or someone requested an invalid event type,swaymsgwill stop monitoring and exit. no cap.-p,--prettyβ gives you pretty output even when you're not on a tty. Ngl it's not available for all message types, so don't come for me if it ghosts you.-q,--quietβ sends the IPC message but does not print the response from sway. silent treatment, but make it productive π-r,--rawβ uses rawJSONoutput even if you are on a tty. crunchy and unfiltered, we love her.-s,--socket <path>β use the socket path you specify. Otherwiseswaymsgwill ask sway where the socket is β which is the value of$SWAYSOCK, then of$I3SOCK.-t,--type <type>β specifies the type of IPC message. details below, keep scrolling bestie β¬οΈ-v,--versionβ prints the version (ofswaymsg) and quits. flex and leave. β¨
π IPC MESSAGE TYPES π
<command>
The message is a sway command β literally the same commands you can bind to keybindings in your sway config file. It gets executed immediately. main character energy fr fr.
See sway(5) for a list of commands.
swaymsg can return pretty printed (standalone-default) or JSON-formatted (--raw) output. For detailed documentation on the returned JSON-data of each message type listed below, refer to sway-ipc(7). And heads up: the JSON-format can contain more information than the pretty print. she's not withholding, she's just thorough π
Tips:
- Command expansion is performed twice: once by
swaymsg, and again by sway. So if you have quoted multi-word strings in your command, enclose the entire command in single-quotes. For example, useswaymsg 'output "Foobar Display" enable'instead ofswaymsg output "Foobar Display" enable. Also note that comma separated options also count as multi-word strings, because commas can be used to execute commands on the same line. π yes really. - If you're providing a command that contains a leading hyphen (
-), insert two hyphens (--) before the command to signal toswaymsgnot to parse anything beyond that point as an option. For example, useswaymsg -- mark --add testinstead ofswaymsg mark --add test. protect her from misreading the vibe check π«Ά
get_workspaces
Gets a list of workspaces and their status. the roster.
get_inputs
Gets a list of current inputs.
get_outputs
Gets a list of current outputs.
get_tree
Gets a JSON-encoded layout tree of all open windows, containers, outputs, workspaces, and so on. the whole family tree, gorgeous π
get_seats
Gets a list of all seats, its properties and all assigned devices.
get_marks
Get a JSON-encoded list of marks.
get_bar_config
Get a JSON-encoded configuration for swaybar.
get_version
Get version information for the running instance of sway.
get_binding_modes
Gets a JSON-encoded list of currently configured binding modes.
get_binding_state
Gets JSON-encoded info about the current binding state.
get_config
Gets a copy of the current configuration. Doesn't expand includes. take her as she is π
send_tick
Sends a tick event to all subscribed clients. tiny notification, big impact β
subscribe
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 sway-ipc(7). read the docs bestie, i'm begging π
π₯ RETURN CODES π₯
0β Success. slay. β1βswaymsgerrors such as invalid syntax, unable to connect to the ipc socket, or unable to parse sway's reply. π2β Sway returned an error when processing the command (ex. invalid command, command failed, and invalid subscription request). π
π SEE ALSO π
sway(5) sway-bar(5) sway-input(5) sway-output(5) sway-ipc(7)
okay that's the whole page bestie, you ate that π«Ά this was the General Commands Manual edition, dated 2026-04-26 β yes, that's the date, and the version/source lives right there in this sign-off, so i didn't lose it, i just made it cute. it's the swaymsg(1) eraaaaa πβ¨π
π¦ where this page comes from
- alpine 3.24: sway-doc 1.12_rc3-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms