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