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.
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

IPC MESSAGE TYPES

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.
56           ·   If you are proving a command that contains a leading hyphen
57               (-), insert two hyphens (--) before the command to signal to
58               swaymsg not to parse anything beyond that point as an option.
59               For example, use swaymsg -- mark --add test instead of swaymsg
60               mark --add test.
61
62
63       get_workspaces
64           Gets a JSON-encoded list of workspaces and their status.
65
66       get_inputs
67           Gets a JSON-encoded list of current inputs.
68
69       get_outputs
70           Gets a JSON-encoded list of current outputs.
71
72       get_tree
73           Gets a JSON-encoded layout tree of all open windows, containers,
74           outputs, workspaces, and so on.
75
76       get_seats
77           Gets a JSON-encoded list of all seats, its properties and all
78           assigned devices.
79
80       get_marks
81           Get a JSON-encoded list of marks.
82
83       get_bar_config
84           Get a JSON-encoded configuration for swaybar.
85
86       get_version
87           Get JSON-encoded version information for the running instance of
88           sway.
89
90       get_binding_modes
91           Gets a JSON-encoded list of currently configured binding modes.
92
93       get_binding_state
94           Gets JSON-encoded info about the current binding state.
95
96       get_config
97           Gets a JSON-encoded copy of the current configuration.
98
99       send_tick
100           Sends a tick event to all subscribed clients.
101
102       subscribe
103           Subscribe to a list of event types. The argument for this type
104           should be provided in the form of a valid JSON array. If any of the
105           types are invalid or if a valid JSON array is not provided, this
106           will result in a failure.
107

RETURN CODES

109       0
110           Success
111
112       1
113           swaymsg errors such as invalid syntax, unable to connect to the ipc
114           socket or unable to parse sway's reply
115
116       2
117           Sway returned an error when processing the command (ex. invalid
118           command, command failed, and invalid subscription request)
119

SEE ALSO

121       sway(5) sway-bar(5) sway-input(5) sway-output(5) sway-ipc(7)
122
123
124
125                                  2020-10-22                        swaymsg(1)
Impressum