1swaymsg(1)                  General Commands Manual                 swaymsg(1)
2
3
4

NAME

6       swaymsg - Send messages to a running instance of sway over the IPC
7       socket.
8

SYNOPSIS

10       swaymsg [options...] [message]
11

OPTIONS

13       -h, --help
14           Show help message and quit.
15
16       -m, --monitor
17           Monitor for responses until killed instead of exiting after the
18           first response. This can only be used with the IPC message type
19           subscribe. If there is a malformed response or an invalid event
20           type was requested, swaymsg will stop monitoring and exit.
21
22       -p, --pretty
23           Use pretty output even when not using a tty. Not available for all
24           message types.
25
26       -q, --quiet
27           Sends the IPC message but does not print the response from sway.
28
29       -r, --raw
30           Use raw JSON output even if using a tty.
31
32       -s, --socket <path>
33           Use the specified socket path. Otherwise, swaymsg will ask sway
34           where the socket is (which is the value of $SWAYSOCK, then of
35           $I3SOCK).
36
37       -t, --type <type>
38           Specify the type of IPC message. See below.
39
40       -v, --version
41           Print the version (of swaymsg) and quit.
42

IPC MESSAGE TYPES

44       <command>
45           The message is a sway command (the same commands you can bind to
46           keybindings in your sway config file). It will be executed immedi‐
47           ately.
48
49           See sway(5) for a list of commands.
50
51           swaymsg can return pretty printed (standalone-default) or JSON-for‐
52           matted (--raw) output. For detailed documentation on the returned
53           JSON-data of each message type listed below,    refer to sway-
54           ipc(7). The JSON-format can contain more information than the
55           pretty print.
56
57           Tips:
58           •   Command expansion is performed twice: once by swaymsg, and
59               again by sway. If you have quoted multi-word strings in your
60               command, enclose the entire command in single-quotes. For exam‐
61               ple, use swaymsg 'output "Foobar Display" enable' instead of
62               swaymsg output "Foobar Display" enable. Furthermore, note that
63               comma separated options also count as multi-word strings, be‐
64               cause commas can be used to execute commands on the same line.
65           •   If you are providing a command that contains a leading hyphen
66               (-), insert two hyphens (--) before the command to signal to
67               swaymsg not to parse anything beyond that point as an option.
68               For example, use swaymsg -- mark --add test instead of swaymsg
69               mark --add test.
70
71
72       get_workspaces
73           Gets a list of workspaces and their status.
74
75       get_inputs
76           Gets a list of current inputs.
77
78       get_outputs
79           Gets a list of current outputs.
80
81       get_tree
82           Gets a JSON-encoded layout tree of all open windows, containers,
83           outputs, workspaces, and so on.
84
85       get_seats
86           Gets a list of all seats, its properties and all assigned devices.
87
88       get_marks
89           Get a JSON-encoded list of marks.
90
91       get_bar_config
92           Get a JSON-encoded configuration for swaybar.
93
94       get_version
95           Get version information for the running instance of sway.
96
97       get_binding_modes
98           Gets a JSON-encoded list of currently configured binding modes.
99
100       get_binding_state
101           Gets JSON-encoded info about the current binding state.
102
103       get_config
104           Gets a copy of the current configuration. Doesn't expand includes.
105
106       send_tick
107           Sends a tick event to all subscribed clients.
108
109       subscribe
110           Subscribe to a list of event types. The argument for this type
111           should be provided in the form of a valid JSON array. If any of the
112           types are invalid or if a valid JSON array is not provided, this
113           will result in a failure.
114

RETURN CODES

116       0
117           Success
118
119       1
120           swaymsg errors such as invalid syntax, unable to connect to the ipc
121           socket or unable to parse sway's reply
122
123       2
124           Sway returned an error when processing the command (ex. invalid
125           command, command failed, and invalid subscription request)
126

SEE ALSO

128       sway(5) sway-bar(5) sway-input(5) sway-output(5) sway-ipc(7)
129
130
131
132                                  2022-01-22                        swaymsg(1)
Impressum