diff options
author | Brian Ashworth <RedSoxFan@users.noreply.github.com> | 2018-05-12 12:43:34 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-12 12:43:34 -0400 |
commit | ec60e24f75f778b378206366057df4efae4b8630 (patch) | |
tree | a2b6ce2f6f28b294ae6cbb8cbf49b107138215f5 /swaymsg | |
parent | Count descendant views for hide_edge_borders smart (diff) | |
parent | Merge pull request #1964 from emersion/wlroots-970 (diff) | |
download | sway-ec60e24f75f778b378206366057df4efae4b8630.tar.gz sway-ec60e24f75f778b378206366057df4efae4b8630.tar.zst sway-ec60e24f75f778b378206366057df4efae4b8630.zip |
Merge branch 'master' into edge-borders
Diffstat (limited to 'swaymsg')
-rw-r--r-- | swaymsg/main.c | 37 | ||||
-rw-r--r-- | swaymsg/swaymsg.1.scd | 66 | ||||
-rw-r--r-- | swaymsg/swaymsg.1.txt | 3 |
3 files changed, 105 insertions, 1 deletions
diff --git a/swaymsg/main.c b/swaymsg/main.c index 7e3622d9..89af7345 100644 --- a/swaymsg/main.c +++ b/swaymsg/main.c | |||
@@ -106,6 +106,35 @@ static void pretty_print_input(json_object *i) { | |||
106 | json_object_get_int(vendor)); | 106 | json_object_get_int(vendor)); |
107 | } | 107 | } |
108 | 108 | ||
109 | static void pretty_print_seat(json_object *i) { | ||
110 | json_object *name, *capabilities, *devices; | ||
111 | json_object_object_get_ex(i, "name", &name); | ||
112 | json_object_object_get_ex(i, "capabilities", &capabilities); | ||
113 | json_object_object_get_ex(i, "devices", &devices); | ||
114 | |||
115 | const char *fmt = | ||
116 | "Seat: %s\n" | ||
117 | " Capabilities: %d\n"; | ||
118 | |||
119 | printf(fmt, json_object_get_string(name), | ||
120 | json_object_get_int(capabilities)); | ||
121 | |||
122 | size_t devices_len = json_object_array_length(devices); | ||
123 | if (devices_len > 0) { | ||
124 | printf(" Devices:\n"); | ||
125 | for (size_t i = 0; i < devices_len; ++i) { | ||
126 | json_object *device = json_object_array_get_idx(devices, i); | ||
127 | |||
128 | json_object *device_name; | ||
129 | json_object_object_get_ex(device, "name", &device_name); | ||
130 | |||
131 | printf(" %s\n", json_object_get_string(device_name)); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | printf("\n"); | ||
136 | } | ||
137 | |||
109 | static void pretty_print_output(json_object *o) { | 138 | static void pretty_print_output(json_object *o) { |
110 | json_object *name, *rect, *focused, *active, *ws; | 139 | json_object *name, *rect, *focused, *active, *ws; |
111 | json_object_object_get_ex(o, "name", &name); | 140 | json_object_object_get_ex(o, "name", &name); |
@@ -211,7 +240,8 @@ static void pretty_print_clipboard(json_object *v) { | |||
211 | static void pretty_print(int type, json_object *resp) { | 240 | static void pretty_print(int type, json_object *resp) { |
212 | if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && | 241 | if (type != IPC_COMMAND && type != IPC_GET_WORKSPACES && |
213 | type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && | 242 | type != IPC_GET_INPUTS && type != IPC_GET_OUTPUTS && |
214 | type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD) { | 243 | type != IPC_GET_VERSION && type != IPC_GET_CLIPBOARD && |
244 | type != IPC_GET_SEATS) { | ||
215 | printf("%s\n", json_object_to_json_string_ext(resp, | 245 | printf("%s\n", json_object_to_json_string_ext(resp, |
216 | JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); | 246 | JSON_C_TO_STRING_PRETTY | JSON_C_TO_STRING_SPACED)); |
217 | return; | 247 | return; |
@@ -244,6 +274,9 @@ static void pretty_print(int type, json_object *resp) { | |||
244 | case IPC_GET_OUTPUTS: | 274 | case IPC_GET_OUTPUTS: |
245 | pretty_print_output(obj); | 275 | pretty_print_output(obj); |
246 | break; | 276 | break; |
277 | case IPC_GET_SEATS: | ||
278 | pretty_print_seat(obj); | ||
279 | break; | ||
247 | } | 280 | } |
248 | } | 281 | } |
249 | } | 282 | } |
@@ -324,6 +357,8 @@ int main(int argc, char **argv) { | |||
324 | type = IPC_COMMAND; | 357 | type = IPC_COMMAND; |
325 | } else if (strcasecmp(cmdtype, "get_workspaces") == 0) { | 358 | } else if (strcasecmp(cmdtype, "get_workspaces") == 0) { |
326 | type = IPC_GET_WORKSPACES; | 359 | type = IPC_GET_WORKSPACES; |
360 | } else if (strcasecmp(cmdtype, "get_seats") == 0) { | ||
361 | type = IPC_GET_SEATS; | ||
327 | } else if (strcasecmp(cmdtype, "get_inputs") == 0) { | 362 | } else if (strcasecmp(cmdtype, "get_inputs") == 0) { |
328 | type = IPC_GET_INPUTS; | 363 | type = IPC_GET_INPUTS; |
329 | } else if (strcasecmp(cmdtype, "get_outputs") == 0) { | 364 | } else if (strcasecmp(cmdtype, "get_outputs") == 0) { |
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd new file mode 100644 index 00000000..1aa6a1b0 --- /dev/null +++ b/swaymsg/swaymsg.1.scd | |||
@@ -0,0 +1,66 @@ | |||
1 | swaymsg(1) | ||
2 | |||
3 | # NAME | ||
4 | |||
5 | swaymsg - Send messages to a running instance of sway over the IPC socket. | ||
6 | |||
7 | # SYNOPSIS | ||
8 | |||
9 | _swaymsg_ [options...] [message] | ||
10 | |||
11 | # OPTIONS | ||
12 | |||
13 | *-h, --help* | ||
14 | Show help message and quit. | ||
15 | |||
16 | *-q, --quiet* | ||
17 | Sends the IPC message but does not print the response from sway. | ||
18 | |||
19 | *-r, --raw* | ||
20 | Use raw output even if using a tty. | ||
21 | |||
22 | *-s, --socket* <path> | ||
23 | Use the specified socket path. Otherwise, swaymsg will ask sway where the | ||
24 | socket is (which is the value of $SWAYSOCK, then of $I3SOCK). | ||
25 | |||
26 | *-t, --type* <type> | ||
27 | Specify the type of IPC message. See below. | ||
28 | |||
29 | *-v, --version* | ||
30 | Print the version (of swaymsg) and quit. | ||
31 | |||
32 | # IPC MESSAGE TYPES | ||
33 | |||
34 | *<command>* | ||
35 | The message is a sway command (the same commands you can bind to keybindings | ||
36 | in your sway config file). It will be executed immediately. | ||
37 | |||
38 | See **sway**(5) for a list of commands. | ||
39 | |||
40 | *get\_workspaces* | ||
41 | Gets a JSON-encoded list of workspaces and their status. | ||
42 | |||
43 | *get\_inputs* | ||
44 | Gets a JSON-encoded list of current inputs. | ||
45 | |||
46 | *get\_outputs* | ||
47 | Gets a JSON-encoded list of current outputs. | ||
48 | |||
49 | *get\_tree* | ||
50 | Gets a JSON-encoded layout tree of all open windows, containers, outputs, | ||
51 | workspaces, and so on. | ||
52 | |||
53 | *get\_marks* | ||
54 | Get a JSON-encoded list of marks. | ||
55 | |||
56 | *get\_bar\_config* | ||
57 | Get a JSON-encoded configuration for swaybar. | ||
58 | |||
59 | *get\_version* | ||
60 | Get JSON-encoded version information for the running instance of sway. | ||
61 | |||
62 | *get\_clipboard* | ||
63 | Get JSON-encoded information about the clipboard. | ||
64 | Returns the current clipboard mime-types if called without | ||
65 | arguments, otherwise returns the clipboard data in the requested | ||
66 | formats. Encodes the data using base64 for non-text mime types. | ||
diff --git a/swaymsg/swaymsg.1.txt b/swaymsg/swaymsg.1.txt index abc517c8..52209b12 100644 --- a/swaymsg/swaymsg.1.txt +++ b/swaymsg/swaymsg.1.txt | |||
@@ -48,6 +48,9 @@ IPC Message Types | |||
48 | *get_workspaces*:: | 48 | *get_workspaces*:: |
49 | Gets a JSON-encoded list of workspaces and their status. | 49 | Gets a JSON-encoded list of workspaces and their status. |
50 | 50 | ||
51 | *get_seats*:: | ||
52 | Gets a JSON-encoded list of current seats. | ||
53 | |||
51 | *get_inputs*:: | 54 | *get_inputs*:: |
52 | Gets a JSON-encoded list of current inputs. | 55 | Gets a JSON-encoded list of current inputs. |
53 | 56 | ||