1sway-ipc(7) Miscellaneous Information Manual sway-ipc(7)
2
3
4
6 sway-ipc - IPC protocol for sway
7
9 This details the interprocess communication (IPC) protocol for sway(1).
10 This IPC protocol can be used to control or obtain information from a
11 sway process.
12
13 The IPC protocol uses a UNIX socket as the method of communication. The
14 path to the socket is stored in the environment variable SWAYSOCK and,
15 for backwards compatibility with i3, I3SOCK. You can also retrieve the
16 socket path by calling sway --get-socketpath.
17
19 The format for messages and replies is:
20 <magic-string> <payload-length> <payload-type> <payload>
21 Where
22 <magic-string> is i3-ipc, for compatibility with i3
23 <payload-length> is a 32-bit integer in native byte order
24 <payload-type> is a 32-bit integer in native byte order
25
26 For example, sending the exit command would look like the following
27 hexdump:
28 00000000 | 69 33 2d 69 70 63 04 00 00 00 00 00 00 00 65 78 |i3-ipc........ex|
29 00000010 | 69 74 |it |
30
31 The payload for replies will be a valid serialized JSON data structure.
32
34 The following message types and their corresponding reply types are
35 currently supported. For all replies, any properties not listed are
36 subject to removal.
37
38 ┌────────────┬───────────────────┬─────────────────────┐
39 │TYPE NUMBER │ MESSAGE NAME │ PURPOSE │
40 ├────────────┼───────────────────┼─────────────────────┤
41 │ 0 │ RUN_COMMAND │ Runs the payload as │
42 │ │ │ sway commands │
43 ├────────────┼───────────────────┼─────────────────────┤
44 │ 1 │ GET_WORKSPACES │ Get the list of │
45 │ │ │ current workspaces │
46 ├────────────┼───────────────────┼─────────────────────┤
47 │ 2 │ SUBSCRIBE │ Subscribe the IPC │
48 │ │ │ connection to the │
49 │ │ │ events listed in │
50 │ │ │ the payload │
51 ├────────────┼───────────────────┼─────────────────────┤
52 │ 3 │ GET_OUTPUTS │ Get the list of │
53 │ │ │ current outputs │
54 ├────────────┼───────────────────┼─────────────────────┤
55 │ 4 │ GET_TREE │ Get the node layout │
56 │ │ │ tree │
57 ├────────────┼───────────────────┼─────────────────────┤
58 │ 5 │ GET_MARKS │ Get the names of │
59 │ │ │ all the marks cur‐ │
60 │ │ │ rently set │
61 ├────────────┼───────────────────┼─────────────────────┤
62 │ 6 │ GET_BAR_CONFIG │ Get the specified │
63 │ │ │ bar config or a │
64 │ │ │ list of bar config │
65 │ │ │ names │
66 ├────────────┼───────────────────┼─────────────────────┤
67 │ 7 │ GET_VERSION │ Get the version of │
68 │ │ │ sway that owns the │
69 │ │ │ IPC socket │
70 ├────────────┼───────────────────┼─────────────────────┤
71 │ 8 │ GET_BINDING_MODES │ Get the list of │
72 │ │ │ binding mode names │
73 ├────────────┼───────────────────┼─────────────────────┤
74 │ 9 │ GET_CONFIG │ Returns the config │
75 │ │ │ that was last │
76 │ │ │ loaded │
77 ├────────────┼───────────────────┼─────────────────────┤
78 │ 10 │ SEND_TICK │ Sends a tick event │
79 │ │ │ with the specified │
80 │ │ │ payload │
81 ├────────────┼───────────────────┼─────────────────────┤
82 │ 11 │ SYNC │ Replies failure │
83 │ │ │ object for i3 com‐ │
84 │ │ │ patibility │
85 ├────────────┼───────────────────┼─────────────────────┤
86 │ 100 │ GET_INPUTS │ Get the list of │
87 │ │ │ input devices │
88 ├────────────┼───────────────────┼─────────────────────┤
89 │ 101 │ GET_SEATS │ Get the list of │
90 │ │ │ seats │
91 └────────────┴───────────────────┴─────────────────────┘
92
93 0. RUN_COMMAND
94 MESSAGE
95 Parses and runs the payload as sway commands
96
97 REPLY
98 An array of objects corresponding to each command that was parsed. Each
99 object has the property success, which is a boolean indicating whether
100 the command was successful. The object may also contain the property
101 error, which is a human readable error message.
102
103 Example Reply:
104 [
105 {
106 "success": true
107 },
108 {
109 "success": false,
110 "error": "Invalid/unknown command"
111 }
112 ]
113
114 1. GET_WORKSPACES
115 MESSAGE
116 Retrieves the list of workspaces.
117
118 REPLY
119 The reply is an array of objects corresponding to each workspace. Each
120 object has the following properties:
121
122 ┌─────────┬───────────┬─────────────────────┐
123 │PROPERTY │ DATA TYPE │ DESCRIPTION │
124 ├─────────┼───────────┼─────────────────────┤
125 │ num │ integer │ The workspace num‐ │
126 │ │ │ ber or -1 for │
127 │ │ │ workspaces that do │
128 │ │ │ not start with a │
129 │ │ │ number │
130 ├─────────┼───────────┼─────────────────────┤
131 │ name │ string │ The name of the │
132 │ │ │ workspace │
133 ├─────────┼───────────┼─────────────────────┤
134 │visible │ boolean │ Whether the │
135 │ │ │ workspace is cur‐ │
136 │ │ │ rently visible on │
137 │ │ │ any output │
138 ├─────────┼───────────┼─────────────────────┤
139 │focused │ boolean │ Whether the │
140 │ │ │ workspace is cur‐ │
141 │ │ │ rently focused by │
142 │ │ │ the default seat │
143 │ │ │ (seat0) │
144 ├─────────┼───────────┼─────────────────────┤
145 │ urgent │ boolean │ Whether a view on │
146 │ │ │ the workspace has │
147 │ │ │ the urgent flag set │
148 ├─────────┼───────────┼─────────────────────┤
149 │ rect │ object │ The bounds of the │
150 │ │ │ workspace. It con‐ │
151 │ │ │ sists of x, y, │
152 │ │ │ width, and height │
153 ├─────────┼───────────┼─────────────────────┤
154 │ output │ string │ The name of the │
155 │ │ │ output that the │
156 │ │ │ workspace is on │
157 └─────────┴───────────┴─────────────────────┘
158
159 Example Reply:
160 [
161 {
162 "num": 1,
163 "name": "1",
164 "visible": true,
165 "focused": true,
166 "rect": {
167 "x": 0,
168 "y": 23,
169 "width": 1920,
170 "height": 1057
171 },
172 "output": "eDP-1"
173 },
174 ]
175
176 2. SUBSCRIBE
177 MESSAGE
178 Subscribe this IPC connection to the event types specified in the mes‐
179 sage payload. The payload should be a valid JSON array of events. See
180 the EVENTS section for the list of supported events.
181
182 REPLY
183 A single object that contains the property success, which is a boolean
184 value indicating whether the subscription was successful or not.
185
186 Example Reply:
187 {
188 "success": true
189 }
190
191 3. GET_OUTPUTS
192 MESSAGE
193 Retrieve the list of outputs
194
195 REPLY
196 An array of objects corresponding to each output. Each object has the
197 following properties:
198
199 ┌──────────────────┬───────────┬─────────────────────┐
200 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
201 ├──────────────────┼───────────┼─────────────────────┤
202 │ name │ string │ The name of the │
203 │ │ │ output. On DRM, │
204 │ │ │ this is the connec‐ │
205 │ │ │ tor │
206 ├──────────────────┼───────────┼─────────────────────┤
207 │ make │ string │ The make of the │
208 │ │ │ output │
209 ├──────────────────┼───────────┼─────────────────────┤
210 │ model │ string │ The model of the │
211 │ │ │ output │
212 ├──────────────────┼───────────┼─────────────────────┤
213 │ serial │ string │ The output's serial │
214 │ │ │ number as a hexa‐ │
215 │ │ │ decimal string │
216 ├──────────────────┼───────────┼─────────────────────┤
217 │ active │ boolean │ Whether this output │
218 │ │ │ is active/enabled │
219 ├──────────────────┼───────────┼─────────────────────┤
220 │ dpms │ boolean │ Whether this output │
221 │ │ │ is on/off (via │
222 │ │ │ DPMS) │
223 ├──────────────────┼───────────┼─────────────────────┤
224 │ primary │ boolean │ For i3 compatibil‐ │
225 │ │ │ ity, this will be │
226 │ │ │ false. It does not │
227 │ │ │ make sense in Way‐ │
228 │ │ │ land │
229 ├──────────────────┼───────────┼─────────────────────┤
230 │ scale │ float │ The scale currently │
231 │ │ │ in use on the out‐ │
232 │ │ │ put or -1 for dis‐ │
233 │ │ │ abled outputs │
234 ├──────────────────┼───────────┼─────────────────────┤
235 │subpixel_hinting │ string │ The subpixel hint‐ │
236 │ │ │ ing current in use │
237 │ │ │ on the output. This │
238 │ │ │ can be rgb, bgr, │
239 │ │ │ vrgb, vbgr, or none │
240 ├──────────────────┼───────────┼─────────────────────┤
241 │ transform │ string │ The transform cur‐ │
242 │ │ │ rently in use for │
243 │ │ │ the output. This │
244 │ │ │ can be normal, 90, │
245 │ │ │ 180, 270, │
246 │ │ │ flipped-90, │
247 │ │ │ flipped-180, or │
248 │ │ │ flipped-270 │
249 ├──────────────────┼───────────┼─────────────────────┤
250 │current_workspace │ string │ The workspace cur‐ │
251 │ │ │ rently visible on │
252 │ │ │ the output or null │
253 │ │ │ for disabled out‐ │
254 │ │ │ puts │
255 ├──────────────────┼───────────┼─────────────────────┤
256 │ modes │ array │ An array of sup‐ │
257 │ │ │ ported mode │
258 │ │ │ objects. Each │
259 │ │ │ object contains │
260 │ │ │ width, height, and │
261 │ │ │ refresh │
262 ├──────────────────┼───────────┼─────────────────────┤
263 │ current_mode │ object │ An object repre‐ │
264 │ │ │ senting the current │
265 │ │ │ mode containing │
266 │ │ │ width, height, and │
267 │ │ │ refresh │
268 ├──────────────────┼───────────┼─────────────────────┤
269 │ rect │ object │ The bounds for the │
270 │ │ │ output consisting │
271 │ │ │ of x, y, width, and │
272 │ │ │ height │
273 └──────────────────┴───────────┴─────────────────────┘
274
275 Example Reply:
276 [
277 {
278 "name": "HDMI-A-2",
279 "make": "Unknown",
280 "model": "NS-19E310A13",
281 "serial": "0x00000001",
282 "active": true,
283 "primary": false,
284 "scale": 1.0,
285 "subpixel_hinting": "rgb",
286 "transform": "normal",
287 "current_workspace": "1",
288 "modes": [
289 {
290 "width": 640,
291 "height": 480,
292 "refresh": 59940
293 },
294 {
295 "width": 800,
296 "height": 600,
297 "refresh": 60317
298 },
299 {
300 "width": 1024,
301 "height": 768,
302 "refresh": 60004
303 },
304 {
305 "width": 1920,
306 "height": 1080,
307 "refresh": 60000
308 }
309 ],
310 "current_mode": {
311 "width": 1920,
312 "height": 1080,
313 "refresh": 60000
314 }
315 }
316 ]
317
318 4. GET_TREE
319 MESSAGE
320 Retrieve a JSON representation of the tree
321
322 REPLY
323 An array of object the represent the current tree. Each object repre‐
324 sents one node and will have the following properties:
325
326 ┌──────────────────┬───────────┬─────────────────────┐
327 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
328 ├──────────────────┼───────────┼─────────────────────┤
329 │ id │ integer │ The internal unique │
330 │ │ │ ID for this node │
331 ├──────────────────┼───────────┼─────────────────────┤
332 │ name │ string │ The name of the │
333 │ │ │ node such as the │
334 │ │ │ output name or win‐ │
335 │ │ │ dow title. For the │
336 │ │ │ scratchpad, this │
337 │ │ │ will be │
338 │ │ │ __i3_scratch for │
339 │ │ │ compatibility with │
340 │ │ │ i3. │
341 ├──────────────────┼───────────┼─────────────────────┤
342 │ type │ string │ The node type. It │
343 │ │ │ can be root, out‐ │
344 │ │ │ put, workspace, │
345 │ │ │ con, or float‐ │
346 │ │ │ ing_con │
347 ├──────────────────┼───────────┼─────────────────────┤
348 │ border │ string │ The border style │
349 │ │ │ for the node. It │
350 │ │ │ can be normal, │
351 │ │ │ none, pixel, or csd │
352 ├──────────────────┼───────────┼─────────────────────┤
353 │ current_bor‐ │ integer │ Number of pixels │
354 │ der_width │ │ used for the border │
355 │ │ │ width │
356 ├──────────────────┼───────────┼─────────────────────┤
357 │ layout │ string │ The node's layout. │
358 │ │ │ It can either be │
359 │ │ │ splith, splitv, │
360 │ │ │ stacked, tabbed, or │
361 │ │ │ output │
362 ├──────────────────┼───────────┼─────────────────────┤
363 │ orientation │ string │ The node's orienta‐ │
364 │ │ │ tion. It can be │
365 │ │ │ vertical, horizon‐ │
366 │ │ │ tal, or none │
367 ├──────────────────┼───────────┼─────────────────────┤
368 │ percent │ float │ The percentage of │
369 │ │ │ the node's parent │
370 │ │ │ that it takes up or │
371 │ │ │ null for the root │
372 │ │ │ and other special │
373 │ │ │ nodes such as the │
374 │ │ │ scratchpad │
375 ├──────────────────┼───────────┼─────────────────────┤
376 │ rect │ object │ The absolute geome‐ │
377 │ │ │ try of the node. │
378 │ │ │ The window decora‐ │
379 │ │ │ tions are excluded │
380 │ │ │ from this, but bor‐ │
381 │ │ │ ders are included. │
382 ├──────────────────┼───────────┼─────────────────────┤
383 │ window_rect │ object │ The geometry of the │
384 │ │ │ contents inside the │
385 │ │ │ node. The window │
386 │ │ │ decorations are │
387 │ │ │ excluded from this │
388 │ │ │ calculation, but │
389 │ │ │ borders are │
390 │ │ │ included. │
391 ├──────────────────┼───────────┼─────────────────────┤
392 │ deco_rect │ object │ The geometry of the │
393 │ │ │ decorations for the │
394 │ │ │ node relative to │
395 │ │ │ the parent node │
396 ├──────────────────┼───────────┼─────────────────────┤
397 │ geometry │ object │ The natural geome‐ │
398 │ │ │ try of the contents │
399 │ │ │ if it were to size │
400 │ │ │ itself │
401 ├──────────────────┼───────────┼─────────────────────┤
402 │ urgent │ boolean │ Whether the node or │
403 │ │ │ any of its descen‐ │
404 │ │ │ dants has the │
405 │ │ │ urgent hint set. │
406 │ │ │ Note: This may not │
407 │ │ │ exist when compiled │
408 │ │ │ without xwayland │
409 │ │ │ support │
410 ├──────────────────┼───────────┼─────────────────────┤
411 │ sticky │ boolean │ Whether the node is │
412 │ │ │ sticky (shows on │
413 │ │ │ all workspaces) │
414 ├──────────────────┼───────────┼─────────────────────┤
415 │ focused │ boolean │ Whether the node is │
416 │ │ │ currently focused │
417 │ │ │ by the default seat │
418 │ │ │ (seat0) │
419 ├──────────────────┼───────────┼─────────────────────┤
420 │ focus │ array │ Array of child node │
421 │ │ │ IDs in the current │
422 │ │ │ focus order │
423 ├──────────────────┼───────────┼─────────────────────┤
424 │ nodes │ array │ The tiling children │
425 │ │ │ nodes for the node │
426 ├──────────────────┼───────────┼─────────────────────┤
427 │ floating_nodes │ array │ The floating chil‐ │
428 │ │ │ dren nodes for the │
429 │ │ │ node │
430 ├──────────────────┼───────────┼─────────────────────┤
431 │ representation │ string │ (Only workspaces) A │
432 │ │ │ string representa‐ │
433 │ │ │ tion of the layout │
434 │ │ │ of the workspace │
435 │ │ │ that can be used as │
436 │ │ │ an aid in submit‐ │
437 │ │ │ ting reproduction │
438 │ │ │ steps for bug │
439 │ │ │ reports │
440 ├──────────────────┼───────────┼─────────────────────┤
441 │ fullscreen_mode │ integer │ (Only containers │
442 │ │ │ and views) The │
443 │ │ │ fullscreen mode of │
444 │ │ │ the node. 0 means │
445 │ │ │ none, 1 means full │
446 │ │ │ workspace, and 2 │
447 │ │ │ means global │
448 │ │ │ fullscreen │
449 ├──────────────────┼───────────┼─────────────────────┤
450 │ app_id │ string │ (Only views) For an │
451 │ │ │ xdg-shell view, the │
452 │ │ │ name of the appli‐ │
453 │ │ │ cation, if set. │
454 │ │ │ Otherwise, null │
455 ├──────────────────┼───────────┼─────────────────────┤
456 │ pid │ integer │ (Only views) The │
457 │ │ │ PID of the applica‐ │
458 │ │ │ tion that owns the │
459 │ │ │ view │
460 ├──────────────────┼───────────┼─────────────────────┤
461 │ visible │ boolean │ (Only views) │
462 │ │ │ Whether the node is │
463 │ │ │ visible │
464 ├──────────────────┼───────────┼─────────────────────┤
465 │ window │ integer │ (Only xwayland │
466 │ │ │ views) The X11 win‐ │
467 │ │ │ dow ID for the │
468 │ │ │ xwayland view │
469 ├──────────────────┼───────────┼─────────────────────┤
470 │window_properties │ object │ (Only xwayland │
471 │ │ │ views) An object │
472 │ │ │ containing the │
473 │ │ │ title, class, │
474 │ │ │ instance, win‐ │
475 │ │ │ dow_role, and tran‐ │
476 │ │ │ sient_for for the │
477 │ │ │ view │
478 └──────────────────┴───────────┴─────────────────────┘
479
480 Example Reply:
481 {
482 "id": 1,
483 "name": "root",
484 "rect": {
485 "x": 0,
486 "y": 0,
487 "width": 1920,
488 "height": 1080
489 },
490 "focused": false,
491 "focus": [
492 3
493 ],
494 "border": "none",
495 "current_border_width": 0,
496 "layout": "splith",
497 "orientation": "horizontal",
498 "percent": null,
499 "window_rect": {
500 "x": 0,
501 "y": 0,
502 "width": 0,
503 "height": 0
504 },
505 "deco_rect": {
506 "x": 0,
507 "y": 0,
508 "width": 0,
509 "height": 0
510 },
511 "geometry": {
512 "x": 0,
513 "y": 0,
514 "width": 0,
515 "height": 0
516 },
517 "window": null,
518 "urgent": false,
519 "floating_nodes": [
520 ],
521 "sticky": false,
522 "type": "root",
523 "nodes": [
524 {
525 "id": 2147483647,
526 "name": "__i3",
527 "rect": {
528 "x": 0,
529 "y": 0,
530 "width": 1920,
531 "height": 1080
532 },
533 "focused": false,
534 "focus": [
535 2147483646
536 ],
537 "border": "none",
538 "current_border_width": 0,
539 "layout": "output",
540 "orientation": "horizontal",
541 "percent": null,
542 "window_rect": {
543 "x": 0,
544 "y": 0,
545 "width": 0,
546 "height": 0
547 },
548 "deco_rect": {
549 "x": 0,
550 "y": 0,
551 "width": 0,
552 "height": 0
553 },
554 "geometry": {
555 "x": 0,
556 "y": 0,
557 "width": 0,
558 "height": 0
559 },
560 "window": null,
561 "urgent": false,
562 "floating_nodes": [
563 ],
564 "sticky": false,
565 "type": "output",
566 "nodes": [
567 {
568 "id": 2147483646,
569 "name": "__i3_scratch",
570 "rect": {
571 "x": 0,
572 "y": 0,
573 "width": 1920,
574 "height": 1080
575 },
576 "focused": false,
577 "focus": [
578 ],
579 "border": "none",
580 "current_border_width": 0,
581 "layout": "splith",
582 "orientation": "horizontal",
583 "percent": null,
584 "window_rect": {
585 "x": 0,
586 "y": 0,
587 "width": 0,
588 "height": 0
589 },
590 "deco_rect": {
591 "x": 0,
592 "y": 0,
593 "width": 0,
594 "height": 0
595 },
596 "geometry": {
597 "x": 0,
598 "y": 0,
599 "width": 0,
600 "height": 0
601 },
602 "window": null,
603 "urgent": false,
604 "floating_nodes": [
605 ],
606 "sticky": false,
607 "type": "workspace"
608 }
609 ]
610 },
611 {
612 "id": 3,
613 "name": "eDP-1",
614 "rect": {
615 "x": 0,
616 "y": 0,
617 "width": 1920,
618 "height": 1080
619 },
620 "focused": false,
621 "focus": [
622 4
623 ],
624 "border": "none",
625 "current_border_width": 0,
626 "layout": "output",
627 "orientation": "none",
628 "percent": 1.0,
629 "window_rect": {
630 "x": 0,
631 "y": 0,
632 "width": 0,
633 "height": 0
634 },
635 "deco_rect": {
636 "x": 0,
637 "y": 0,
638 "width": 0,
639 "height": 0
640 },
641 "geometry": {
642 "x": 0,
643 "y": 0,
644 "width": 0,
645 "height": 0
646 },
647 "window": null,
648 "urgent": false,
649 "floating_nodes": [
650 ],
651 "sticky": false,
652 "type": "output",
653 "active": true,
654 "primary": false,
655 "make": "Unknown",
656 "model": "0x38ED",
657 "serial": "0x00000000",
658 "scale": 1.0,
659 "transform": "normal",
660 "current_workspace": "1",
661 "modes": [
662 {
663 "width": 1920,
664 "height": 1080,
665 "refresh": 60052
666 }
667 ],
668 "current_mode": {
669 "width": 1920,
670 "height": 1080,
671 "refresh": 60052
672 },
673 "nodes": [
674 {
675 "id": 4,
676 "name": "1",
677 "rect": {
678 "x": 0,
679 "y": 23,
680 "width": 1920,
681 "height": 1057
682 },
683 "focused": false,
684 "focus": [
685 6,
686 5
687 ],
688 "border": "none",
689 "current_border_width": 0,
690 "layout": "splith",
691 "orientation": "horizontal",
692 "percent": null,
693 "window_rect": {
694 "x": 0,
695 "y": 0,
696 "width": 0,
697 "height": 0
698 },
699 "deco_rect": {
700 "x": 0,
701 "y": 0,
702 "width": 0,
703 "height": 0
704 },
705 "geometry": {
706 "x": 0,
707 "y": 0,
708 "width": 0,
709 "height": 0
710 },
711 "window": null,
712 "urgent": false,
713 "floating_nodes": [
714 ],
715 "sticky": false,
716 "num": 1,
717 "output": "eDP-1",
718 "type": "workspace",
719 "representation": "H[URxvt termite]",
720 "nodes": [
721 {
722 "id": 5,
723 "name": "urxvt",
724 "rect": {
725 "x": 0,
726 "y": 23,
727 "width": 960,
728 "height": 1057
729 },
730 "focused": false,
731 "focus": [
732 ],
733 "border": "normal",
734 "current_border_width": 2,
735 "layout": "none",
736 "orientation": "none",
737 "percent": 0.5,
738 "window_rect": {
739 "x": 2,
740 "y": 0,
741 "width": 956,
742 "height": 1030
743 },
744 "deco_rect": {
745 "x": 0,
746 "y": 0,
747 "width": 960,
748 "height": 25
749 },
750 "geometry": {
751 "x": 0,
752 "y": 0,
753 "width": 1124,
754 "height": 422
755 },
756 "window": 4194313,
757 "urgent": false,
758 "floating_nodes": [
759 ],
760 "sticky": false,
761 "type": "con",
762 "fullscreen_mode": 0,
763 "pid": 23959,
764 "app_id": null,
765 "visible": true,
766 "window_properties": {
767 "class": "URxvt",
768 "instance": "urxvt",
769 "title": "urxvt",
770 "transient_for": null
771 },
772 "nodes": [
773 ]
774 },
775 {
776 "id": 6,
777 "name": "",
778 "rect": {
779 "x": 960,
780 "y": 23,
781 "width": 960,
782 "height": 1057
783 },
784 "focused": true,
785 "focus": [
786 ],
787 "border": "normal",
788 "current_border_width": 2,
789 "layout": "none",
790 "orientation": "none",
791 "percent": 0.5,
792 "window_rect": {
793 "x": 2,
794 "y": 0,
795 "width": 956,
796 "height": 1030
797 },
798 "deco_rect": {
799 "x": 0,
800 "y": 0,
801 "width": 960,
802 "height": 25
803 },
804 "geometry": {
805 "x": 0,
806 "y": 0,
807 "width": 817,
808 "height": 458
809 },
810 "window": null,
811 "urgent": false,
812 "floating_nodes": [
813 ],
814 "sticky": false,
815 "type": "con",
816 "fullscreen_mode": 0,
817 "pid": 25370,
818 "app_id": "termite",
819 "visible": true,
820 "nodes": [
821 ]
822 }
823 ]
824 }
825 ]
826 }
827 ]
828 }
829
830 5. GET_MARKS
831 MESSAGE
832 Retrieve the currently set marks
833
834 REPLY
835 An array of marks current set. Since each mark can only be set for one
836 container, this is a set so each value is unique and the order is unde‐
837 fined.
838
839 Example Reply:
840 [
841 "one",
842 "test"
843 ]
844
845 6. GET_BAR_CONFIG (WITHOUT A PAYLOAD)
846 MESSAGE
847 When sending without a payload, this retrieves the list of configured
848 bar IDs
849
850 REPLY
851 An array of bar IDs, which are strings
852
853 Example Reply:
854 [
855 "bar-0",
856 "bar-1"
857 ]
858
859 6. GET_BAR_CONFIG (WITH A PAYLOAD)
860 MESSAGE
861 When sent with a bar ID as the payload, this retrieves the config asso‐
862 ciated with the specified by the bar ID in the payload. This is used by
863 swaybar, but could also be used for third party bars
864
865 REPLY
866 An object that represents the configuration for the bar with the bar ID
867 sent as the payload. The following properties exists and more informa‐
868 tion about what their value mean can be found in sway-bar(5):
869
870 ┌────────────────────┬───────────┬─────────────────────┐
871 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
872 ├────────────────────┼───────────┼─────────────────────┤
873 │ id │ string │ The bar ID │
874 ├────────────────────┼───────────┼─────────────────────┤
875 │ mode │ string │ The mode for the │
876 │ │ │ bar. It can be │
877 │ │ │ dock, hide, or │
878 │ │ │ invisible │
879 ├────────────────────┼───────────┼─────────────────────┤
880 │ position │ string │ The bar's position. │
881 │ │ │ It can currently │
882 │ │ │ either be bottom or │
883 │ │ │ top │
884 ├────────────────────┼───────────┼─────────────────────┤
885 │ status_command │ string │ The command which │
886 │ │ │ should be run to │
887 │ │ │ generate the status │
888 │ │ │ line │
889 ├────────────────────┼───────────┼─────────────────────┤
890 │ font │ string │ The font to use for │
891 │ │ │ the text on the bar │
892 ├────────────────────┼───────────┼─────────────────────┤
893 │ workspace_buttons │ boolean │ Whether to display │
894 │ │ │ the workspace but‐ │
895 │ │ │ tons on the bar │
896 ├────────────────────┼───────────┼─────────────────────┤
897 │binding_mode_indi‐ │ boolean │ Whether to display │
898 │cator │ │ the current binding │
899 │ │ │ mode on the bar │
900 ├────────────────────┼───────────┼─────────────────────┤
901 │ verbose │ boolean │ For i3 compatibil‐ │
902 │ │ │ ity, this will be │
903 │ │ │ the boolean value │
904 │ │ │ false. │
905 ├────────────────────┼───────────┼─────────────────────┤
906 │ colors │ object │ An object contain‐ │
907 │ │ │ ing the #RRGGBBAA │
908 │ │ │ colors to use for │
909 │ │ │ the bar. See below │
910 │ │ │ for more informa‐ │
911 │ │ │ tion │
912 ├────────────────────┼───────────┼─────────────────────┤
913 │ gaps │ object │ An object repre‐ │
914 │ │ │ senting the gaps │
915 │ │ │ for the bar con‐ │
916 │ │ │ sisting of top, │
917 │ │ │ right, bottom, and │
918 │ │ │ left. │
919 ├────────────────────┼───────────┼─────────────────────┤
920 │ bar_height │ integer │ The absolute height │
921 │ │ │ to use for the bar │
922 │ │ │ or 0 to automati‐ │
923 │ │ │ cally size based on │
924 │ │ │ the font │
925 ├────────────────────┼───────────┼─────────────────────┤
926 │ status_padding │ integer │ The vertical pad‐ │
927 │ │ │ ding to use for the │
928 │ │ │ status line │
929 ├────────────────────┼───────────┼─────────────────────┤
930 │status_edge_padding │ integer │ The horizontal pad‐ │
931 │ │ │ ding to use for the │
932 │ │ │ status line when at │
933 │ │ │ the end of an out‐ │
934 │ │ │ put │
935 └────────────────────┴───────────┴─────────────────────┘
936
937 The colors object contains the following properties, which are all
938 strings containing the #RRGGBBAA representation of the color:
939
940 ┌──────────────────────────┬────────────────────────────┐
941 │ PROPERTY │ DESCRIPTION │
942 ├──────────────────────────┼────────────────────────────┤
943 │ background │ The color to use for the │
944 │ │ bar background on unfo‐ │
945 │ │ cused outputs │
946 ├──────────────────────────┼────────────────────────────┤
947 │ statusline │ The color to use for the │
948 │ │ status line text on unfo‐ │
949 │ │ cused outputs │
950 ├──────────────────────────┼────────────────────────────┤
951 │ separator │ The color to use for the │
952 │ │ separator text on unfo‐ │
953 │ │ cused outputs │
954 ├──────────────────────────┼────────────────────────────┤
955 │ focused_background │ The color to use for the │
956 │ │ background of the bar on │
957 │ │ the focused output │
958 ├──────────────────────────┼────────────────────────────┤
959 │ focused_statusline │ The color to use for the │
960 │ │ status line text on the │
961 │ │ focused output │
962 ├──────────────────────────┼────────────────────────────┤
963 │ focused_separator │ The color to use for the │
964 │ │ separator text on the │
965 │ │ focused output │
966 ├──────────────────────────┼────────────────────────────┤
967 │ focused_workspace_text │ The color to use for the │
968 │ │ text of the focused │
969 │ │ workspace button │
970 ├──────────────────────────┼────────────────────────────┤
971 │ focused_workspace_bg │ The color to use for the │
972 │ │ background of the focused │
973 │ │ workspace button │
974 ├──────────────────────────┼────────────────────────────┤
975 │focused_workspace_border │ The color to use for the │
976 │ │ border of the focused │
977 │ │ workspace button │
978 ├──────────────────────────┼────────────────────────────┤
979 │ active_workspace_text │ The color to use for the │
980 │ │ text of the workspace but‐ │
981 │ │ tons for the visible │
982 │ │ workspaces on unfocused │
983 │ │ outputs │
984 ├──────────────────────────┼────────────────────────────┤
985 │ active_workspace_bg │ The color to use for the │
986 │ │ background of the │
987 │ │ workspace buttons for the │
988 │ │ visible workspaces on │
989 │ │ unfocused outputs │
990 ├──────────────────────────┼────────────────────────────┤
991 │ active_workspace_border │ The color to use for the │
992 │ │ border of the workspace │
993 │ │ buttons for the visible │
994 │ │ workspaces on unfocused │
995 │ │ outputs │
996 ├──────────────────────────┼────────────────────────────┤
997 │ inactive_workspace_text │ The color to use for the │
998 │ │ text of the workspace but‐ │
999 │ │ tons for workspaces that │
1000 │ │ are not visible │
1001 ├──────────────────────────┼────────────────────────────┤
1002 │ inactive_workspace_bg │ The color to use for the │
1003 │ │ background of the │
1004 │ │ workspace buttons for │
1005 │ │ workspaces that are not │
1006 │ │ visible │
1007 ├──────────────────────────┼────────────────────────────┤
1008 │inactive_workspace_border │ The color to use for the │
1009 │ │ border of the workspace │
1010 │ │ buttons for workspaces │
1011 │ │ that are not visible │
1012 ├──────────────────────────┼────────────────────────────┤
1013 │ urgent_workspace_text │ The color to use for the │
1014 │ │ text of the workspace but‐ │
1015 │ │ tons for workspaces that │
1016 │ │ contain an urgent view │
1017 ├──────────────────────────┼────────────────────────────┤
1018 │ urgent_workspace_bg │ The color to use for the │
1019 │ │ background of the │
1020 │ │ workspace buttons for │
1021 │ │ workspaces that contain an │
1022 │ │ urgent view │
1023 ├──────────────────────────┼────────────────────────────┤
1024 │ urgent_workspace_border │ The color to use for the │
1025 │ │ border of the workspace │
1026 │ │ buttons for workspaces │
1027 │ │ that contain an urgent │
1028 │ │ view │
1029 ├──────────────────────────┼────────────────────────────┤
1030 │ binding_mode_text │ The color to use for the │
1031 │ │ text of the binding mode │
1032 │ │ indicator │
1033 ├──────────────────────────┼────────────────────────────┤
1034 │ binding_mode_bg │ The color to use for the │
1035 │ │ background of the binding │
1036 │ │ mode indicator │
1037 ├──────────────────────────┼────────────────────────────┤
1038 │ binding_mode_border │ The color to use for the │
1039 │ │ border of the binding mode │
1040 │ │ indicator │
1041 └──────────────────────────┴────────────────────────────┘
1042
1043 Example Reply:
1044 {
1045 "id": "bar-0",
1046 "mode": "dock",
1047 "position": "top",
1048 "status_command": "while date +'%Y-%m-%d %l:%M:%S %p'; do sleep 1; done",
1049 "font": "monospace 10",
1050 "gaps": {
1051 "top": 0,
1052 "right": 0,
1053 "bottom": 0,
1054 "left": 0
1055 },
1056 "bar_height": 0,
1057 "status_padding": 1,
1058 "status_edge_padding": 3,
1059 "workspace_buttons": true,
1060 "binding_mode_indicator": true,
1061 "verbose": false,
1062 "pango_markup": false,
1063 "colors": {
1064 "background": "#323232ff",
1065 "statusline": "#ffffffff",
1066 "separator": "#666666ff",
1067 "focused_background": "#323232ff",
1068 "focused_statusline": "#ffffffff",
1069 "focused_separator": "#666666ff",
1070 "focused_workspace_border": "#4c7899ff",
1071 "focused_workspace_bg": "#285577ff",
1072 "focused_workspace_text": "#ffffffff",
1073 "inactive_workspace_border": "#32323200",
1074 "inactive_workspace_bg": "#32323200",
1075 "inactive_workspace_text": "#5c5c5cff",
1076 "active_workspace_border": "#333333ff",
1077 "active_workspace_bg": "#5f676aff",
1078 "active_workspace_text": "#ffffffff",
1079 "urgent_workspace_border": "#2f343aff",
1080 "urgent_workspace_bg": "#900000ff",
1081 "urgent_workspace_text": "#ffffffff",
1082 "binding_mode_border": "#2f343aff",
1083 "binding_mode_bg": "#900000ff",
1084 "binding_mode_text": "#ffffffff"
1085 },
1086 }
1087
1088 7. GET_VERSION
1089 MESSAGE
1090 Retrieve version information about the sway process
1091
1092 REPLY
1093 An object containing the following properties:
1094
1095 ┌───────────────┬───────────┬─────────────────────┐
1096 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1097 ├───────────────┼───────────┼─────────────────────┤
1098 │ major │ integer │ The major version │
1099 │ │ │ of the sway process │
1100 ├───────────────┼───────────┼─────────────────────┤
1101 │ minor │ integer │ The minor version │
1102 │ │ │ of the sway process │
1103 ├───────────────┼───────────┼─────────────────────┤
1104 │ patch │ integer │ The patch version │
1105 │ │ │ of the sway process │
1106 ├───────────────┼───────────┼─────────────────────┤
1107 │human_readable │ string │ A human readable │
1108 │ │ │ version string that │
1109 │ │ │ will likely contain │
1110 │ │ │ more useful infor‐ │
1111 │ │ │ mation such as the │
1112 │ │ │ git commit short │
1113 │ │ │ hash and git branch │
1114 ├───────────────┼───────────┼─────────────────────┤
1115 │loaded_con‐ │ string │ The path to the │
1116 │fig_file_name │ │ loaded config file │
1117 └───────────────┴───────────┴─────────────────────┘
1118
1119 Example Reply:
1120 {
1121 "human_readable": "1.0-rc1-117-g2f7247e0 (Feb 24 2019, branch 'master')",
1122 "major": 1,
1123 "minor": 0,
1124 "patch": 0,
1125 "loaded_config_file_name": "/home/redsoxfan/.config/sway/config"
1126 }
1127
1128 8. GET_BINDING_MODES
1129 MESSAGE
1130 Retrieve the list of binding modes that currently configured
1131
1132 REPLY
1133 An array of strings, with each string being the name of a binding mode.
1134 This will always contain at least one mode (currently default), which
1135 is the default binding mode
1136
1137 Example Reply:
1138 [
1139 "default",
1140 "resize",
1141 ]
1142
1143 9. GET_CONFIG
1144 MESSAGE
1145 Retrieve the contents of the config that was last loaded
1146
1147 REPLY
1148 An object with a single string property containing the contents of the
1149 config
1150
1151 Example Reply:
1152 {
1153 "config": "set $mod Mod4nbindsym $mod+q exitn"
1154 }
1155
1156 10. SEND_TICK
1157 MESSAGE
1158 Issues a TICK event to all clients subscribing to the event to ensure
1159 that all events prior to the tick were received. If a payload is given,
1160 it will be included in the TICK event
1161
1162 REPLY
1163 A single object contains the property success, which is a boolean value
1164 indicating whether the TICK event was sent.
1165
1166 Example Reply:
1167 {
1168 "success": true
1169 }
1170
1171 11. SYNC
1172 MESSAGE
1173 For i3 compatibility, this command will just return a failure object
1174 since it does not make sense to implement in sway due to the X11 nature
1175 of the command. If you are curious about what this IPC command does in
1176 i3, refer to the i3 documentation.
1177
1178 REPLY
1179 A single object that contains the property success, which is set to the
1180 boolean value false.
1181
1182 Exact Reply:
1183 {
1184 "success": false
1185 }
1186
1187 100. GET_INPUTS
1188 MESSAGE
1189 Retrieve a list of the input devices currently available
1190
1191 REPLY
1192 An array of objects corresponding to each input device. Each object has
1193 the following properties:
1194
1195 ┌─────────────────┬───────────┬─────────────────────┐
1196 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1197 ├─────────────────┼───────────┼─────────────────────┤
1198 │ identifier │ string │ The identifier for │
1199 │ │ │ the input device │
1200 ├─────────────────┼───────────┼─────────────────────┤
1201 │ name │ string │ The human readable │
1202 │ │ │ name for the device │
1203 ├─────────────────┼───────────┼─────────────────────┤
1204 │ vendor │ integer │ The vendor code for │
1205 │ │ │ the input device │
1206 ├─────────────────┼───────────┼─────────────────────┤
1207 │ product │ integer │ The product code │
1208 │ │ │ for the input │
1209 │ │ │ device │
1210 ├─────────────────┼───────────┼─────────────────────┤
1211 │ type │ string │ The device type. │
1212 │ │ │ Currently this can │
1213 │ │ │ be keyboard, │
1214 │ │ │ pointer, touch, │
1215 │ │ │ tablet_tool, │
1216 │ │ │ tablet_pad, or │
1217 │ │ │ switch │
1218 ├─────────────────┼───────────┼─────────────────────┤
1219 │xkb_active_lay‐ │ string │ (Only keyboards) │
1220 │out_name │ │ The name of the │
1221 │ │ │ active keyboard │
1222 │ │ │ layout in use │
1223 ├─────────────────┼───────────┼─────────────────────┤
1224 │xkb_layout_names │ array │ (Only keyboards) A │
1225 │ │ │ list a layout names │
1226 │ │ │ configured for the │
1227 │ │ │ keyboard │
1228 ├─────────────────┼───────────┼─────────────────────┤
1229 │xkb_active_lay‐ │ integer │ (Only keyboards) │
1230 │out_index │ │ The index of the │
1231 │ │ │ active keyboard │
1232 │ │ │ layout in use │
1233 ├─────────────────┼───────────┼─────────────────────┤
1234 │ libinput │ object │ (Only libinput │
1235 │ │ │ devices) An object │
1236 │ │ │ describing the cur‐ │
1237 │ │ │ rent device set‐ │
1238 │ │ │ tings. See below │
1239 │ │ │ for more informa‐ │
1240 │ │ │ tion │
1241 └─────────────────┴───────────┴─────────────────────┘
1242 The libinput object describes the device configuration for libinput
1243 devices. Only properties that are supported for the device will be
1244 added to the object. In addition to the possible options listed, all
1245 string properties may also be unknown, in the case that a new option is
1246 added to libinput. See sway-input(5) for information on the meaning of
1247 the possible values. The following properties will be included for
1248 devices that support them:
1249
1250 ┌───────────────────┬───────────┬─────────────────────┐
1251 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1252 ├───────────────────┼───────────┼─────────────────────┤
1253 │ send_events │ string │ Whether events are │
1254 │ │ │ being sent by the │
1255 │ │ │ device. It can be │
1256 │ │ │ enabled, disabled, │
1257 │ │ │ or dis‐ │
1258 │ │ │ abled_on_exter‐ │
1259 │ │ │ nal_mouse │
1260 ├───────────────────┼───────────┼─────────────────────┤
1261 │ tap │ string │ Whether tap to │
1262 │ │ │ click is enabled. │
1263 │ │ │ It can be enabled │
1264 │ │ │ or disabled │
1265 ├───────────────────┼───────────┼─────────────────────┤
1266 │ tap_button_map │ string │ The finger to but‐ │
1267 │ │ │ ton mapping in use. │
1268 │ │ │ It can be lmr or │
1269 │ │ │ lrm │
1270 ├───────────────────┼───────────┼─────────────────────┤
1271 │ tap_drag │ string │ Whether tap-and- │
1272 │ │ │ drag is enabled. It │
1273 │ │ │ can be enabled or │
1274 │ │ │ disabled │
1275 ├───────────────────┼───────────┼─────────────────────┤
1276 │ tap_drag_lock │ string │ Whether drag-lock │
1277 │ │ │ is enabled. It can │
1278 │ │ │ be enabled or dis‐ │
1279 │ │ │ abled │
1280 ├───────────────────┼───────────┼─────────────────────┤
1281 │ accel_speed │ double │ The pointer-accel‐ │
1282 │ │ │ eration in use │
1283 ├───────────────────┼───────────┼─────────────────────┤
1284 │ accel_profile │ string │ The acceleration │
1285 │ │ │ profile in use. It │
1286 │ │ │ can be none, flat, │
1287 │ │ │ or adaptive │
1288 ├───────────────────┼───────────┼─────────────────────┤
1289 │ natural_scroll │ string │ Whether natural │
1290 │ │ │ scrolling is │
1291 │ │ │ enabled. It can be │
1292 │ │ │ enabled or disabled │
1293 ├───────────────────┼───────────┼─────────────────────┤
1294 │ left_handed │ string │ Whether left-handed │
1295 │ │ │ mode is enabled. It │
1296 │ │ │ can be enabled or │
1297 │ │ │ disabled │
1298 ├───────────────────┼───────────┼─────────────────────┤
1299 │ click_method │ string │ The click method in │
1300 │ │ │ use. It can be │
1301 │ │ │ none, button_areas, │
1302 │ │ │ or clickfinger │
1303 ├───────────────────┼───────────┼─────────────────────┤
1304 │ middle_emulation │ string │ Whether middle emu‐ │
1305 │ │ │ lation is enabled. │
1306 │ │ │ It can be enabled │
1307 │ │ │ or disabled │
1308 ├───────────────────┼───────────┼─────────────────────┤
1309 │ scroll_method │ string │ The scroll method │
1310 │ │ │ in use. It can be │
1311 │ │ │ none, two_finger, │
1312 │ │ │ edge, or on_but‐ │
1313 │ │ │ ton_down │
1314 ├───────────────────┼───────────┼─────────────────────┤
1315 │ scroll_button │ int │ The scroll button │
1316 │ │ │ to use when │
1317 │ │ │ scroll_method is │
1318 │ │ │ on_button_down. │
1319 │ │ │ This will be given │
1320 │ │ │ as an input event │
1321 │ │ │ code │
1322 ├───────────────────┼───────────┼─────────────────────┤
1323 │ dwt │ string │ Whether disable- │
1324 │ │ │ while-typing is │
1325 │ │ │ enabled. It can be │
1326 │ │ │ enabled or disabled │
1327 ├───────────────────┼───────────┼─────────────────────┤
1328 │calibration_matrix │ array │ An array of 6 │
1329 │ │ │ floats representing │
1330 │ │ │ the calibration │
1331 │ │ │ matrix for absolute │
1332 │ │ │ devices such as │
1333 │ │ │ touchscreens │
1334 └───────────────────┴───────────┴─────────────────────┘
1335
1336 Example Reply:
1337 [
1338 {
1339 "identifier": "1:1:AT_Translated_Set_2_keyboard",
1340 "name": "AT Translated Set 2 keyboard",
1341 "vendor": 1,
1342 "product": 1,
1343 "type": "keyboard",
1344 "xkb_active_layout_name": "English (US)",
1345 "libinput": {
1346 "send_events": "enabled"
1347 }
1348 },
1349 {
1350 "identifier": "1267:5:Elan_Touchpad",
1351 "name": "Elan Touchpad",
1352 "vendor": 1267,
1353 "product": 5,
1354 "type": "pointer",
1355 "libinput": {
1356 "send_events": "enabled",
1357 "tap": "enabled",
1358 "tap_button_map": "lmr",
1359 "tap_drag": "enabled",
1360 "tap_drag_lock": "disabled",
1361 "accel_speed": 0.0,
1362 "accel_profile": "none",
1363 "natural_scroll", "disabled",
1364 "left_handed": "disabled",
1365 "click_method": "button_areas",
1366 "middle_emulation": "disabled",
1367 "scroll_method": "edge",
1368 "dwt": "enabled"
1369 }
1370 },
1371 {
1372 "identifier": "3034:22494:USB2.0_VGA_UVC_WebCam:_USB2.0_V",
1373 "name": "USB2.0 VGA UVC WebCam: USB2.0 V",
1374 "vendor": 3034,
1375 "product": 22494,
1376 "type": "keyboard",
1377 "xkb_active_layout_name": "English (US)",
1378 "libinput": {
1379 "send_events": "enabled"
1380 }
1381 },
1382 {
1383 "identifier": "0:3:Sleep_Button",
1384 "name": "Sleep Button",
1385 "vendor": 0,
1386 "product": 3,
1387 "type": "keyboard",
1388 "xkb_active_layout_name": "English (US)",
1389 "libinput": {
1390 "send_events": "enabled"
1391 }
1392 },
1393 {
1394 "identifier": "0:5:Lid_Switch",
1395 "name": "Lid Switch",
1396 "vendor": 0,
1397 "product": 5,
1398 "type": "switch",
1399 "libinput": {
1400 "send_events": "enabled"
1401 }
1402 },
1403 {
1404 "identifier": "0:6:Video_Bus",
1405 "name": "Video Bus",
1406 "vendor": 0,
1407 "product": 6,
1408 "type": "keyboard",
1409 "xkb_active_layout_name": "English (US)",
1410 "libinput": {
1411 "send_events": "enabled"
1412 }
1413 },
1414 {
1415 "identifier": "0:1:Power_Button",
1416 "name": "Power Button",
1417 "vendor": 0,
1418 "product": 1,
1419 "type": "keyboard",
1420 "xkb_active_layout_name": "English (US)",
1421 "libinput": {
1422 "send_events": "enabled"
1423 }
1424 }
1425 ]
1426
1427 101. GET_SEATS
1428 MESSAGE
1429 Retrieve a list of the seats currently configured
1430
1431 REPLY
1432 An array of objects corresponding to each seat. There will always be at
1433 least one seat. Each object has the following properties:
1434
1435 ┌─────────────┬───────────┬─────────────────────┐
1436 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1437 ├─────────────┼───────────┼─────────────────────┤
1438 │ name │ string │ The unique name for │
1439 │ │ │ the seat │
1440 ├─────────────┼───────────┼─────────────────────┤
1441 │capabilities │ integer │ The number of capa‐ │
1442 │ │ │ bilities that the │
1443 │ │ │ seat has │
1444 ├─────────────┼───────────┼─────────────────────┤
1445 │ focus │ integer │ The id of the node │
1446 │ │ │ currently focused │
1447 │ │ │ by the seat or 0 │
1448 │ │ │ when the seat is │
1449 │ │ │ not currently │
1450 │ │ │ focused by a node │
1451 │ │ │ (i.e. a surface │
1452 │ │ │ layer or xwayland │
1453 │ │ │ unmanaged has │
1454 │ │ │ focus) │
1455 ├─────────────┼───────────┼─────────────────────┤
1456 │ devices │ array │ An array of input │
1457 │ │ │ devices that are │
1458 │ │ │ attached to the │
1459 │ │ │ seat. Currently, │
1460 │ │ │ this is an array of │
1461 │ │ │ objects that are │
1462 │ │ │ identical to those │
1463 │ │ │ returned by │
1464 │ │ │ GET_INPUTS │
1465 └─────────────┴───────────┴─────────────────────┘
1466
1467 Example Reply:
1468 [
1469 {
1470 "name": "seat0",
1471 "capabilities": 3,
1472 "focus": 7,
1473 "devices": [
1474 {
1475 "identifier": "1:1:AT_Translated_Set_2_keyboard",
1476 "name": "AT Translated Set 2 keyboard",
1477 "vendor": 1,
1478 "product": 1,
1479 "type": "keyboard",
1480 "xkb_active_layout_name": "English (US)",
1481 "libinput": {
1482 "send_events": "enabled"
1483 }
1484 },
1485 {
1486 "identifier": "1267:5:Elan_Touchpad",
1487 "name": "Elan Touchpad",
1488 "vendor": 1267,
1489 "product": 5,
1490 "type": "pointer",
1491 "libinput": {
1492 "send_events": "enabled",
1493 "tap": "enabled",
1494 "tap_button_map": "lmr",
1495 "tap_drag": "enabled",
1496 "tap_drag_lock": "disabled",
1497 "accel_speed": 0.0,
1498 "accel_profile": "none",
1499 "natural_scroll", "disabled",
1500 "left_handed": "disabled",
1501 "click_method": "button_areas",
1502 "middle_emulation": "disabled",
1503 "scroll_method": "edge",
1504 "dwt": "enabled"
1505 }
1506 },
1507 {
1508 "identifier": "3034:22494:USB2.0_VGA_UVC_WebCam:_USB2.0_V",
1509 "name": "USB2.0 VGA UVC WebCam: USB2.0 V",
1510 "vendor": 3034,
1511 "product": 22494,
1512 "type": "keyboard",
1513 "xkb_active_layout_name": "English (US)",
1514 "libinput": {
1515 "send_events": "enabled"
1516 }
1517 },
1518 {
1519 "identifier": "0:3:Sleep_Button",
1520 "name": "Sleep Button",
1521 "vendor": 0,
1522 "product": 3,
1523 "type": "keyboard",
1524 "xkb_active_layout_name": "English (US)",
1525 "libinput": {
1526 "send_events": "enabled"
1527 }
1528 },
1529 {
1530 "identifier": "0:5:Lid_Switch",
1531 "name": "Lid Switch",
1532 "vendor": 0,
1533 "product": 5,
1534 "type": "switch",
1535 "libinput": {
1536 "send_events": "enabled"
1537 }
1538 },
1539 {
1540 "identifier": "0:6:Video_Bus",
1541 "name": "Video Bus",
1542 "vendor": 0,
1543 "product": 6,
1544 "type": "keyboard",
1545 "xkb_active_layout_name": "English (US)",
1546 "libinput": {
1547 "send_events": "enabled"
1548 }
1549 },
1550 {
1551 "identifier": "0:1:Power_Button",
1552 "name": "Power Button",
1553 "vendor": 0,
1554 "product": 1,
1555 "type": "keyboard",
1556 "xkb_active_layout_name": "English (US)",
1557 "libinput": {
1558 "send_events": "enabled"
1559 }
1560 }
1561 ]
1562 }
1563 ]
1564
1566 Events are a way for client to get notified of changes to sway. A
1567 client can subscribe to any events it wants to be notified of changes
1568 for. The event is sent in the same format as a reply. The following
1569 events are currently available:
1570
1571 ┌───────────┬──────────────────┬─────────────────────┐
1572 │EVENT TYPE │ NAME │ DESCRIPTION │
1573 ├───────────┼──────────────────┼─────────────────────┤
1574 │0x80000000 │ workspace │ Sent whenever an │
1575 │ │ │ event involving a │
1576 │ │ │ workspace occurs │
1577 │ │ │ such as initializa‐ │
1578 │ │ │ tion of a new │
1579 │ │ │ workspace or a dif‐ │
1580 │ │ │ ferent workspace │
1581 │ │ │ gains focus │
1582 ├───────────┼──────────────────┼─────────────────────┤
1583 │0x80000002 │ mode │ Sent whenever the │
1584 │ │ │ binding mode │
1585 │ │ │ changes │
1586 ├───────────┼──────────────────┼─────────────────────┤
1587 │0x80000003 │ window │ Sent whenever an │
1588 │ │ │ event involving a │
1589 │ │ │ view occurs such as │
1590 │ │ │ being reparented, │
1591 │ │ │ focused, or closed │
1592 ├───────────┼──────────────────┼─────────────────────┤
1593 │0x80000004 │ barconfig_update │ Sent whenever a bar │
1594 │ │ │ config changes │
1595 ├───────────┼──────────────────┼─────────────────────┤
1596 │0x80000005 │ binding │ Sent when a config‐ │
1597 │ │ │ ured binding is │
1598 │ │ │ executed │
1599 ├───────────┼──────────────────┼─────────────────────┤
1600 │0x80000006 │ shutdown │ Sent when the ipc │
1601 │ │ │ shuts down because │
1602 │ │ │ sway is exiting │
1603 ├───────────┼──────────────────┼─────────────────────┤
1604 │0x80000007 │ tick │ Sent when an ipc │
1605 │ │ │ client sends a │
1606 │ │ │ SEND_TICK message │
1607 ├───────────┼──────────────────┼─────────────────────┤
1608 │0x80000014 │ bar_state_update │ Send when the visi‐ │
1609 │ │ │ bility of a bar │
1610 │ │ │ should change due │
1611 │ │ │ to a modifier │
1612 ├───────────┼──────────────────┼─────────────────────┤
1613 │0x80000015 │ input │ Sent when something │
1614 │ │ │ related to input │
1615 │ │ │ devices changes │
1616 └───────────┴──────────────────┴─────────────────────┘
1617
1618 0x80000000. WORKSPACE
1619 Sent whenever a change involving a workspace occurs. The event consists
1620 of a single object with the following properties:
1621
1622 ┌─────────┬───────────┬─────────────────────┐
1623 │PROPERTY │ DATA TYPE │ DESCRIPTION │
1624 ├─────────┼───────────┼─────────────────────┤
1625 │ change │ string │ The type of change │
1626 │ │ │ that occurred. See │
1627 │ │ │ below for more │
1628 │ │ │ information │
1629 ├─────────┼───────────┼─────────────────────┤
1630 │current │ object │ An object repre‐ │
1631 │ │ │ senting the │
1632 │ │ │ workspace effected │
1633 │ │ │ or null for reload │
1634 │ │ │ changes │
1635 ├─────────┼───────────┼─────────────────────┤
1636 │ old │ object │ For a focus change, │
1637 │ │ │ this is will be an │
1638 │ │ │ object representing │
1639 │ │ │ the workspace being │
1640 │ │ │ switched from. Oth‐ │
1641 │ │ │ erwise, it is null │
1642 └─────────┴───────────┴─────────────────────┘
1643
1644 The following change types are currently available:
1645
1646 ┌───────┬────────────────────────────┐
1647 │ TYPE │ DESCRIPTION │
1648 ├───────┼────────────────────────────┤
1649 │ init │ The workspace was created │
1650 ├───────┼────────────────────────────┤
1651 │empty │ The workspace is empty and │
1652 │ │ is being destroyed since │
1653 │ │ it is not visible │
1654 ├───────┼────────────────────────────┤
1655 │focus │ The workspace was focused. │
1656 │ │ See the old property for │
1657 │ │ the previous focus │
1658 ├───────┼────────────────────────────┤
1659 │ move │ The workspace was moved to │
1660 │ │ a different output │
1661 ├───────┼────────────────────────────┤
1662 │rename │ The workspace was renamed │
1663 ├───────┼────────────────────────────┤
1664 │urgent │ A view on the workspace │
1665 │ │ has had their urgency hint │
1666 │ │ set or all urgency hints │
1667 │ │ for views on the workspace │
1668 │ │ have been cleared │
1669 ├───────┼────────────────────────────┤
1670 │reload │ The configuration file has │
1671 │ │ been reloaded │
1672 └───────┴────────────────────────────┘
1673
1674 Example Event:
1675 {
1676 "change": "init",
1677 "old": null,
1678 "current": {
1679 "id": 10,
1680 "name": "2",
1681 "rect": {
1682 "x": 0,
1683 "y": 0,
1684 "width": 0,
1685 "height": 0
1686 },
1687 "focused": false,
1688 "focus": [
1689 ],
1690 "border": "none",
1691 "current_border_width": 0,
1692 "layout": "splith",
1693 "percent": null,
1694 "window_rect": {
1695 "x": 0,
1696 "y": 0,
1697 "width": 0,
1698 "height": 0
1699 },
1700 "deco_rect": {
1701 "x": 0,
1702 "y": 0,
1703 "width": 0,
1704 "height": 0
1705 },
1706 "geometry": {
1707 "x": 0,
1708 "y": 0,
1709 "width": 0,
1710 "height": 0
1711 },
1712 "window": null,
1713 "urgent": false,
1714 "floating_nodes": [
1715 ],
1716 "num": 2,
1717 "output": "eDP-1",
1718 "type": "workspace",
1719 "representation": null,
1720 "nodes": [
1721 ]
1722 }
1723 }
1724
1725 0x80000002. MODE
1726 Sent whenever the binding mode changes. The event consists of a single
1727 object with the following properties:
1728
1729 ┌─────────────┬───────────┬─────────────────────┐
1730 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1731 ├─────────────┼───────────┼─────────────────────┤
1732 │ change │ string │ The binding mode │
1733 │ │ │ that became active │
1734 ├─────────────┼───────────┼─────────────────────┤
1735 │pango_markup │ boolean │ Whether the mode │
1736 │ │ │ should be parsed as │
1737 │ │ │ pango markup │
1738 └─────────────┴───────────┴─────────────────────┘
1739
1740 Example Event:
1741 {
1742 "change": "default",
1743 "pango_markup": false
1744 }
1745
1746 0x80000003. WINDOW
1747 Sent whenever a change involving a view occurs. The event consists of a
1748 single object with the following properties:
1749
1750 ┌──────────┬───────────┬────────────────────┐
1751 │PROPERTY │ DATA TYPE │ DESCRIPTION │
1752 ├──────────┼───────────┼────────────────────┤
1753 │ change │ string │ The type of change │
1754 │ │ │ that occurred. See │
1755 │ │ │ below for more │
1756 │ │ │ information │
1757 ├──────────┼───────────┼────────────────────┤
1758 │container │ object │ An object repre‐ │
1759 │ │ │ senting the view │
1760 │ │ │ effected │
1761 └──────────┴───────────┴────────────────────┘
1762
1763 The following change types are currently available:
1764
1765 ┌────────────────┬────────────────────────────┐
1766 │ TYPE │ DESCRIPTION │
1767 ├────────────────┼────────────────────────────┤
1768 │ new │ The view was created │
1769 ├────────────────┼────────────────────────────┤
1770 │ close │ The view was closed │
1771 ├────────────────┼────────────────────────────┤
1772 │ focus │ The view was focused │
1773 ├────────────────┼────────────────────────────┤
1774 │ title │ The view's title has │
1775 │ │ changed │
1776 ├────────────────┼────────────────────────────┤
1777 │fullscreen_mode │ The view's fullscreen mode │
1778 │ │ has changed │
1779 ├────────────────┼────────────────────────────┤
1780 │ move │ The view has been repar‐ │
1781 │ │ ented in the tree │
1782 ├────────────────┼────────────────────────────┤
1783 │ floating │ The view has become float‐ │
1784 │ │ ing or is no longer float‐ │
1785 │ │ ing │
1786 ├────────────────┼────────────────────────────┤
1787 │ urgent │ The view's urgency hint │
1788 │ │ has changed status │
1789 ├────────────────┼────────────────────────────┤
1790 │ mark │ A mark has been added or │
1791 │ │ removed from the view │
1792 └────────────────┴────────────────────────────┘
1793
1794 Example Event:
1795 {
1796 "change": "new",
1797 "container": {
1798 "id": 12,
1799 "name": null,
1800 "rect": {
1801 "x": 0,
1802 "y": 0,
1803 "width": 0,
1804 "height": 0
1805 },
1806 "focused": false,
1807 "focus": [
1808 ],
1809 "border": "none",
1810 "current_border_width": 0,
1811 "layout": "none",
1812 "percent": 0.0,
1813 "window_rect": {
1814 "x": 0,
1815 "y": 0,
1816 "width": 0,
1817 "height": 0
1818 },
1819 "deco_rect": {
1820 "x": 0,
1821 "y": 0,
1822 "width": 0,
1823 "height": 0
1824 },
1825 "geometry": {
1826 "x": 0,
1827 "y": 0,
1828 "width": 1124,
1829 "height": 422
1830 },
1831 "window": 4194313,
1832 "urgent": false,
1833 "floating_nodes": [
1834 ],
1835 "type": "con",
1836 "pid": 19787,
1837 "app_id": null,
1838 "window_properties": {
1839 "class": "URxvt",
1840 "instance": "urxvt",
1841 "transient_for": null
1842 },
1843 "nodes": [
1844 ]
1845 }
1846 }
1847
1848 0x80000004. BARCONFIG_UPDATE
1849 Sent whenever a config for a bar changes. The event is identical to
1850 that of GET_BAR_CONFIG when a bar ID is given as a payload. See 6.
1851 GET_BAR_CONFIG (WITH A PAYLOAD) above for more information.
1852
1853 0x80000005. BINDING
1854 Sent whenever a binding is executed. The event is a single object with
1855 the following properties:
1856
1857 ┌─────────────────┬───────────┬─────────────────────┐
1858 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1859 ├─────────────────┼───────────┼─────────────────────┤
1860 │ change │ string │ The change that │
1861 │ │ │ occurred for the │
1862 │ │ │ binding. Currently │
1863 │ │ │ this will only be │
1864 │ │ │ run │
1865 ├─────────────────┼───────────┼─────────────────────┤
1866 │ command │ string │ The command associ‐ │
1867 │ │ │ ated with the bind‐ │
1868 │ │ │ ing │
1869 ├─────────────────┼───────────┼─────────────────────┤
1870 │event_state_mask │ array │ An array of strings │
1871 │ │ │ that correspond to │
1872 │ │ │ each modifier key │
1873 │ │ │ for the binding │
1874 ├─────────────────┼───────────┼─────────────────────┤
1875 │ input_code │ integer │ For keyboard bind‐ │
1876 │ │ │ codes, this is the │
1877 │ │ │ key code for the │
1878 │ │ │ binding. For mouse │
1879 │ │ │ bindings, this is │
1880 │ │ │ the X11 button num‐ │
1881 │ │ │ ber, if there is an │
1882 │ │ │ equivalent. In all │
1883 │ │ │ other cases, this │
1884 │ │ │ will be 0. │
1885 ├─────────────────┼───────────┼─────────────────────┤
1886 │ symbol │ string │ For keyboard │
1887 │ │ │ bindsyms, this is │
1888 │ │ │ the bindsym for the │
1889 │ │ │ binding. Otherwise, │
1890 │ │ │ this will be null │
1891 ├─────────────────┼───────────┼─────────────────────┤
1892 │ input_type │ string │ The input type that │
1893 │ │ │ triggered the bind‐ │
1894 │ │ │ ing. This is either │
1895 │ │ │ keyboard or mouse │
1896 └─────────────────┴───────────┴─────────────────────┘
1897
1898 Example Event:
1899 {
1900 "change": "run",
1901 "binding": {
1902 "command": "workspace 2",
1903 "event_state_mask": [
1904 "Mod4"
1905 ],
1906 "input_code": 0,
1907 "symbol": "2",
1908 "input_type": "keyboard"
1909 }
1910 }
1911
1912 0x80000006. SHUTDOWN
1913 Sent whenever the IPC is shutting down. The event is a single object
1914 with the property change, which is a string containing the reason for
1915 the shutdown. Currently, the only value for change is exit, which is
1916 issued when sway is exiting.
1917
1918 Example Event:
1919 {
1920 "change": "exit"
1921 }
1922
1923 0x80000007. TICK
1924 Sent when first subscribing to tick events or by a SEND_TICK message.
1925 The event is a single object with the following properties:
1926
1927 ┌─────────┬───────────┬─────────────────────┐
1928 │PROPERTY │ DATA TYPE │ DESCRIPTION │
1929 ├─────────┼───────────┼─────────────────────┤
1930 │ first │ boolean │ Whether this event │
1931 │ │ │ was triggered by │
1932 │ │ │ subscribing to the │
1933 │ │ │ tick events │
1934 ├─────────┼───────────┼─────────────────────┤
1935 │payload │ string │ The payload given │
1936 │ │ │ with a SEND_TICK │
1937 │ │ │ message, if any. │
1938 │ │ │ Otherwise, an empty │
1939 │ │ │ string │
1940 └─────────┴───────────┴─────────────────────┘
1941
1942 Example Event:
1943 {
1944 "first": true
1945 "payload": ""
1946 }
1947
1948 0x80000014. BAR_STATE_UPDATE
1949 Sent when the visibility of a bar changes due to a modifier being
1950 pressed. The event is a single object with the following properties:
1951
1952 ┌────────────────────┬───────────┬─────────────────────┐
1953 │ PROPERTY │ DATA TYPE │ DESCRIPTION │
1954 ├────────────────────┼───────────┼─────────────────────┤
1955 │ id │ string │ The bar ID effected │
1956 ├────────────────────┼───────────┼─────────────────────┤
1957 │visible_by_modifier │ boolean │ Whether the bar │
1958 │ │ │ should be made vis‐ │
1959 │ │ │ ible due to a modi‐ │
1960 │ │ │ fier being pressed │
1961 └────────────────────┴───────────┴─────────────────────┘
1962
1963 Example Event:
1964 {
1965 "id": "bar-0",
1966 "visible_by_modifier": true
1967 }
1968
1969 0x80000015. INPUT
1970 Sent when something related to the input devices changes. The event is
1971 a single object with the following properties:
1972
1973 ┌─────────┬───────────┬─────────────────────┐
1974 │PROPERTY │ DATA TYPE │ DESCRIPTION │
1975 ├─────────┼───────────┼─────────────────────┤
1976 │ change │ string │ What has changed │
1977 ├─────────┼───────────┼─────────────────────┤
1978 │ input │ object │ An object repre‐ │
1979 │ │ │ senting the input │
1980 │ │ │ that is identical │
1981 │ │ │ the ones GET_INPUTS │
1982 │ │ │ gives │
1983 └─────────┴───────────┴─────────────────────┘
1984 The following change types are currently available:
1985
1986 ┌────────────────┬────────────────────────────┐
1987 │ TYPE │ DESCRIPTION │
1988 ├────────────────┼────────────────────────────┤
1989 │ added │ The input device became │
1990 │ │ available │
1991 ├────────────────┼────────────────────────────┤
1992 │ removed │ The input device is no │
1993 │ │ longer available │
1994 ├────────────────┼────────────────────────────┤
1995 │ xkb_keymap │ (Keyboards only) The │
1996 │ │ keymap for the keyboard │
1997 │ │ has changed │
1998 ├────────────────┼────────────────────────────┤
1999 │ xkb_layout │ (Keyboards only) The │
2000 │ │ effective layout in the │
2001 │ │ keymap has changed │
2002 ├────────────────┼────────────────────────────┤
2003 │libinput_config │ (libinput device only) A │
2004 │ │ libinput config option for │
2005 │ │ the device changed │
2006 └────────────────┴────────────────────────────┘
2007 Example Event:
2008 {
2009 "change": "xkb_layout",
2010 "input": {
2011 "identifier": "1:1:AT_Translated_Set_2_keyboard",
2012 "name": "AT Translated Set 2 keyboard",
2013 "vendor": 1,
2014 "product": 1,
2015 "type": "keyboard",
2016 "xkb_layout_names": [
2017 "English (US)",
2018 "English (Dvorak)"
2019 ],
2020 "xkb_active_layout_index": 1,
2021 "xkb_active_layout_name": "English (Dvorak)",
2022 "libinput": {
2023 "send_events": "enabled"
2024 }
2025 }
2026 }
2027
2029 sway(1) sway(5) sway-bar(5) swaymsg(1) sway-input(5) sway-output(5)
2030
2031
2032
2033 2020-02-26 sway-ipc(7)