1swaymsg(1) General Commands Manual swaymsg(1)
2
3
4
6 swaymsg - Send messages to a running instance of sway over the IPC
7 socket.
8
10 swaymsg [options...] [message]
11
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.
24
25 -q, --quiet
26 Sends the IPC message but does not print the response from sway.
27
28 -r, --raw
29 Use raw output even if using a tty.
30
31 -s, --socket <path>
32 Use the specified socket path. Otherwise, swaymsg will ask sway
33 where the socket is (which is the value of $SWAYSOCK, then of
34 $I3SOCK).
35
36 -t, --type <type>
37 Specify the type of IPC message. See below.
38
39 -v, --version
40 Print the version (of swaymsg) and quit.
41
43 <command>
44 The message is a sway command (the same commands you can bind to
45 keybindings in your sway config file). It will be executed immedi‐
46 ately.
47
48 See sway(5) for a list of commands.
49
50 Tips:
51 • Command expansion is performed twice: once by swaymsg, and
52 again by sway. If you have quoted multi-word strings in your
53 command, enclose the entire command in single-quotes. For exam‐
54 ple, use swaymsg 'output "Foobar Display" enable' instead of
55 swaymsg output "Foobar Display" enable. Furthermore, note that
56 comma separated options also count as multi-word strings, be‐
57 cause commas can be used to execute commands on the same line.
58 • If you are providing a command that contains a leading hyphen
59 (-), insert two hyphens (--) before the command to signal to
60 swaymsg not to parse anything beyond that point as an option.
61 For example, use swaymsg -- mark --add test instead of swaymsg
62 mark --add test.
63
64
65 get_workspaces
66 Gets a JSON-encoded list of workspaces and their status.
67
68 get_inputs
69 Gets a JSON-encoded list of current inputs.
70
71 get_outputs
72 Gets a JSON-encoded list of current outputs.
73
74 get_tree
75 Gets a JSON-encoded layout tree of all open windows, containers,
76 outputs, workspaces, and so on.
77
78 get_seats
79 Gets a JSON-encoded list of all seats, its properties and all as‐
80 signed devices.
81
82 get_marks
83 Get a JSON-encoded list of marks.
84
85 get_bar_config
86 Get a JSON-encoded configuration for swaybar.
87
88 get_version
89 Get JSON-encoded version information for the running instance of
90 sway.
91
92 get_binding_modes
93 Gets a JSON-encoded list of currently configured binding modes.
94
95 get_binding_state
96 Gets JSON-encoded info about the current binding state.
97
98 get_config
99 Gets a JSON-encoded copy of the current configuration.
100
101 send_tick
102 Sends a tick event to all subscribed clients.
103
104 subscribe
105 Subscribe to a list of event types. The argument for this type
106 should be provided in the form of a valid JSON array. If any of the
107 types are invalid or if a valid JSON array is not provided, this
108 will result in a failure.
109
111 0
112 Success
113
114 1
115 swaymsg errors such as invalid syntax, unable to connect to the ipc
116 socket or unable to parse sway's reply
117
118 2
119 Sway returned an error when processing the command (ex. invalid
120 command, command failed, and invalid subscription request)
121
123 sway(5) sway-bar(5) sway-input(5) sway-output(5) sway-ipc(7)
124
125
126
127 2021-04-07 swaymsg(1)