16 void process_message(char *msg, char *rsp)
18 char *cmd = strtok(msg, TOK_SEP);
23 if (strcmp(cmd, "get") == 0) {
24 char *name = strtok(NULL, TOK_SEP);
25 get_setting(name, rsp);
27 } else if (strcmp(cmd, "set") == 0) {
28 char *name = strtok(NULL, TOK_SEP);
29 char *value = strtok(NULL, TOK_SEP);
30 set_setting(name, value, rsp);
32 } else if (strcmp(cmd, "list") == 0) {
33 char *name = strtok(NULL, TOK_SEP);
35 desktop_location_t loc;
36 if (locate_desktop(name, &loc))
37 list(loc.desktop, loc.desktop->root, rsp, 0);
39 list(mon->desk, mon->desk->root, rsp, 0);
42 } else if (strcmp(cmd, "list_monitors") == 0) {
43 char *arg = strtok(NULL, TOK_SEP);
45 if (parse_list_option(arg, &opt))
46 list_monitors(opt, rsp);
48 } else if (strcmp(cmd, "list_desktops") == 0) {
49 char *arg = strtok(NULL, TOK_SEP);
51 if (parse_list_option(arg, &opt))
52 list_desktops(mon, opt, 0, rsp);
54 } else if (strcmp(cmd, "list_windows") == 0) {
57 } else if (strcmp(cmd, "list_rules") == 0) {
60 } else if (strcmp(cmd, "close") == 0) {
61 window_close(mon->desk->focus);
63 } else if (strcmp(cmd, "kill") == 0) {
64 window_kill(mon->desk, mon->desk->focus);
65 } else if (strcmp(cmd, "rotate") == 0) {
66 char *deg = strtok(NULL, TOK_SEP);
69 if (parse_rotate(deg, &r))
70 rotate_tree(mon->desk->root, r);
72 } else if (strcmp(cmd, "flip") == 0) {
73 char *flp = strtok(NULL, TOK_SEP);
76 if (parse_flip(flp, &f))
77 flip_tree(mon->desk->root, f);
79 } else if (strcmp(cmd, "balance") == 0) {
80 balance_tree(mon->desk->root);
81 } else if (strcmp(cmd, "grab_pointer") == 0) {
82 char *pac = strtok(NULL, TOK_SEP);
85 if (parse_pointer_action(pac, &a))
88 } else if (strcmp(cmd, "track_pointer") == 0) {
89 char *arg1 = strtok(NULL, TOK_SEP);
92 char *arg2 = strtok(NULL, TOK_SEP);
96 if (sscanf(arg1, "%i", &root_x) == 1 && sscanf(arg2, "%i", &root_y) == 1)
97 track_pointer(root_x, root_y);
99 } else if (strcmp(cmd, "ungrab_pointer") == 0) {
101 } else if (strcmp(cmd, "layout") == 0) {
102 char *lyt = strtok(NULL, TOK_SEP);
105 if (parse_layout(lyt, &y)) {
106 char *name = strtok(NULL, TOK_SEP);
108 mon->desk->layout = y;
110 desktop_location_t loc;
112 if (locate_desktop(name, &loc))
113 loc.desktop->layout = y;
114 } while ((name = strtok(NULL, TOK_SEP)) != NULL);
119 } else if (strcmp(cmd, "cycle_layout") == 0) {
120 if (mon->desk->layout == LAYOUT_MONOCLE)
121 mon->desk->layout = LAYOUT_TILED;
123 mon->desk->layout = LAYOUT_MONOCLE;
125 } else if (strcmp(cmd, "shift") == 0) {
126 char *dir = strtok(NULL, TOK_SEP);
129 if (parse_direction(dir, &d)) {
130 swap_nodes(mon->desk, mon->desk->focus, mon->desk, find_neighbor(mon->desk->focus, d));
133 } else if (strcmp(cmd, "toggle_fullscreen") == 0) {
134 if (mon->desk->focus != NULL)
135 toggle_fullscreen(mon, mon->desk->focus->client);
136 } else if (strcmp(cmd, "toggle_floating") == 0) {
137 split_mode = MODE_AUTOMATIC;
138 toggle_floating(mon->desk->focus);
139 } else if (strcmp(cmd, "toggle_locked") == 0) {
140 if (mon->desk->focus != NULL)
141 toggle_locked(mon->desk->focus->client);
142 } else if (strcmp(cmd, "toggle_visibility") == 0) {
144 } else if (strcmp(cmd, "pad") == 0) {
145 char *name = strtok(NULL, TOK_SEP);
147 monitor_t *m = find_monitor(name);
149 char args[BUFSIZ] = {0}, *s;
150 while ((s = strtok(NULL, TOK_SEP)) != NULL) {
151 strncat(args, s, REMLEN(args));
152 strncat(args, TOK_SEP, REMLEN(args));
154 if (strlen(args) > 0) {
155 sscanf(args, "%i %i %i %i", &m->top_padding, &m->right_padding, &m->bottom_padding, &m->left_padding);
158 snprintf(rsp, BUFSIZ, "%i %i %i %i\n", m->top_padding, m->right_padding, m->bottom_padding, m->left_padding);
163 } else if (strcmp(cmd, "ratio") == 0) {
164 char *value = strtok(NULL, TOK_SEP);
165 if (value != NULL && mon->desk->focus != NULL)
166 sscanf(value, "%lf", &mon->desk->focus->split_ratio);
167 } else if (strcmp(cmd, "cancel") == 0) {
168 split_mode = MODE_AUTOMATIC;
169 window_draw_border(mon->desk->focus, true, true);
171 } else if (strcmp(cmd, "presel") == 0) {
172 if (mon->desk->focus == NULL || !is_tiled(mon->desk->focus->client) || mon->desk->layout != LAYOUT_TILED)
174 char *dir = strtok(NULL, TOK_SEP);
177 if (parse_direction(dir, &d)) {
178 split_mode = MODE_MANUAL;
180 char *rat = strtok(NULL, TOK_SEP);
182 sscanf(rat, "%lf", &mon->desk->focus->split_ratio);
183 window_draw_border(mon->desk->focus, true, true);
187 } else if (strcmp(cmd, "push") == 0 || strcmp(cmd, "pull") == 0) {
188 char *dir = strtok(NULL, TOK_SEP);
192 if (parse_fence_move(cmd, &m) && parse_direction(dir, &d)) {
193 move_fence(mon->desk->focus, d, m);
196 } else if (strcmp(cmd, "drop_to_monitor") == 0) {
197 char *dir = strtok(NULL, TOK_SEP);
200 if (parse_cycle_direction(dir, &d)) {
203 m = ((mon->next == NULL ? mon_head : mon->next));
205 m = ((mon->prev == NULL ? mon_tail : mon->prev));
206 transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus);
208 char *opt = strtok(NULL, TOK_SEP);
210 if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
214 } else if (strcmp(cmd, "send_to_monitor") == 0) {
215 char *name = strtok(NULL, TOK_SEP);
217 monitor_t *m = find_monitor(name);
218 if (m != NULL && m != mon) {
219 transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus);
221 char *opt = strtok(NULL, TOK_SEP);
223 if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
227 } else if (strcmp(cmd, "drop_to") == 0) {
228 char *dir = strtok(NULL, TOK_SEP);
231 if (parse_cycle_direction(dir, &c)) {
234 d = ((mon->desk->next == NULL ? mon->desk_head : mon->desk->next));
236 d = ((mon->desk->prev == NULL ? mon->desk_tail : mon->desk->prev));
237 transfer_node(mon, mon->desk, mon, d, mon->desk->focus);
238 char *opt = strtok(NULL, TOK_SEP);
240 if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
244 } else if (strcmp(cmd, "send_to") == 0) {
245 char *name = strtok(NULL, TOK_SEP);
247 desktop_location_t loc;
248 if (locate_desktop(name, &loc)) {
249 transfer_node(mon, mon->desk, loc.monitor, loc.desktop, mon->desk->focus);
250 if (mon != loc.monitor && loc.monitor->desk == loc.desktop)
251 arrange(loc.monitor, loc.desktop);
252 char *opt = strtok(NULL, TOK_SEP);
254 if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW) {
255 select_monitor(loc.monitor);
256 select_desktop(loc.desktop);
260 } else if (strcmp(cmd, "rename_monitor") == 0) {
261 char *cur_name = strtok(NULL, TOK_SEP);
262 if (cur_name != NULL) {
263 monitor_t *m = find_monitor(cur_name);
265 char *new_name = strtok(NULL, TOK_SEP);
266 if (new_name != NULL) {
267 strncpy(m->name, new_name, sizeof(m->name));
272 } else if (strcmp(cmd, "rename") == 0) {
273 char *cur_name = strtok(NULL, TOK_SEP);
274 if (cur_name != NULL) {
275 desktop_location_t loc;
276 if (locate_desktop(cur_name, &loc)) {
277 char *new_name = strtok(NULL, TOK_SEP);
278 if (new_name != NULL) {
279 strncpy(loc.desktop->name, new_name, sizeof(loc.desktop->name));
280 ewmh_update_desktop_names();
285 } else if (strcmp(cmd, "use_monitor") == 0) {
286 char *name = strtok(NULL, TOK_SEP);
288 monitor_t *m = find_monitor(name);
292 } else if (strcmp(cmd, "use") == 0) {
293 char *name = strtok(NULL, TOK_SEP);
295 desktop_location_t loc;
296 if (locate_desktop(name, &loc)) {
297 if (auto_alternate && loc.desktop == mon->desk) {
298 select_desktop(mon->last_desk);
300 select_monitor(loc.monitor);
301 select_desktop(loc.desktop);
305 } else if (strcmp(cmd, "cycle_monitor") == 0) {
306 char *dir = strtok(NULL, TOK_SEP);
309 if (parse_cycle_direction(dir, &d))
312 } else if (strcmp(cmd, "cycle_desktop") == 0) {
313 char *dir = strtok(NULL, TOK_SEP);
316 if (parse_cycle_direction(dir, &d)) {
318 char *skip = strtok(NULL, TOK_SEP);
319 if (parse_skip_desktop(skip, &k))
320 cycle_desktop(mon, mon->desk, d, k);
323 } else if (strcmp(cmd, "cycle") == 0) {
324 if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
326 char *dir = strtok(NULL, TOK_SEP);
329 if (parse_cycle_direction(dir, &d)) {
331 char *skip = strtok(NULL, TOK_SEP);
332 if (parse_skip_client(skip, &k))
333 cycle_leaf(mon, mon->desk, mon->desk->focus, d, k);
337 } else if (strcmp(cmd, "nearest") == 0) {
338 if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
340 char *arg = strtok(NULL, TOK_SEP);
343 if (parse_nearest_argument(arg, &a)) {
345 char *skip = strtok(NULL, TOK_SEP);
346 if (parse_skip_client(skip, &k))
347 nearest_leaf(mon, mon->desk, mon->desk->focus, a, k);
351 } else if (strcmp(cmd, "circulate") == 0) {
352 if (mon->desk->layout == LAYOUT_MONOCLE
353 || (mon->desk->focus != NULL && !is_tiled(mon->desk->focus->client)))
355 char *dir = strtok(NULL, TOK_SEP);
358 if (parse_circulate_direction(dir, &d))
359 circulate_leaves(mon, mon->desk, d);
361 } else if (strcmp(cmd, "rule") == 0) {
362 char *name = strtok(NULL, TOK_SEP);
364 rule_t *rule = make_rule();
365 strncpy(rule->cause.name, name, sizeof(rule->cause.name));
366 char *arg = strtok(NULL, TOK_SEP);
367 while (arg != NULL) {
368 if (strcmp(arg, "floating") == 0) {
369 rule->effect.floating = true;
370 } else if (strcmp(arg, "follow") == 0) {
371 rule->effect.follow = true;
373 desktop_location_t loc;
374 if (locate_desktop(arg, &loc)) {
375 rule->effect.monitor = loc.monitor;
376 rule->effect.desktop = loc.desktop;
379 arg = strtok(NULL, TOK_SEP);
384 } else if (strcmp(cmd, "remove_rule") == 0) {
387 while ((arg = strtok(NULL, TOK_SEP)) != NULL)
388 if (sscanf(arg, "%X", &uid) > 0)
389 remove_rule_by_uid(uid);
391 } else if (strcmp(cmd, "swap") == 0) {
394 if ((arg = strtok(NULL, TOK_SEP)) != NULL) {
395 if (parse_swap_argument(arg, &a)) {
396 node_t *n = find_by_area(mon->desk, a);
397 swap_nodes(mon->desk, mon->desk->focus, mon->desk, n);
400 swap_nodes(mon->desk, mon->desk->focus, mon->desk, mon->desk->last_focus);
402 } else if (strcmp(cmd, "alternate") == 0) {
403 focus_node(mon, mon->desk, mon->desk->last_focus, true);
405 } else if (strcmp(cmd, "alternate_desktop") == 0) {
406 select_desktop(mon->last_desk);
407 } else if (strcmp(cmd, "alternate_monitor") == 0) {
408 select_monitor(last_mon);
409 } else if (strcmp(cmd, "add_in") == 0) {
410 char *name = strtok(NULL, TOK_SEP);
412 monitor_t *m = find_monitor(name);
414 for (name = strtok(NULL, TOK_SEP); name != NULL; name = strtok(NULL, TOK_SEP))
415 add_desktop(m, name);
418 } else if (strcmp(cmd, "add") == 0) {
419 for (char *name = strtok(NULL, TOK_SEP); name != NULL; name = strtok(NULL, TOK_SEP))
420 add_desktop(mon, name);
422 } else if (strcmp(cmd, "focus") == 0) {
423 if (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen)
425 char *dir = strtok(NULL, TOK_SEP);
428 if (parse_direction(dir, &d)) {
429 node_t *n = find_neighbor(mon->desk->focus, d);
430 focus_node(mon, mon->desk, n, true);
433 if (mon->desk->layout == LAYOUT_TILED)
435 } else if (strcmp(cmd, "put_status") == 0) {
437 } else if (strcmp(cmd, "adopt_orphans") == 0) {
439 } else if (strcmp(cmd, "restore") == 0) {
440 char *arg = strtok(NULL, TOK_SEP);
442 } else if (strcmp(cmd, "quit") == 0) {
443 char *arg = strtok(NULL, TOK_SEP);
445 sscanf(arg, "%i", &exit_status);
449 snprintf(rsp, BUFSIZ, "unknown command: %s", cmd);
453 arrange(mon, mon->desk);
456 void set_setting(char *name, char *value, char *rsp)
458 if (name == NULL || value == NULL)
461 if (strcmp(name, "border_width") == 0) {
462 sscanf(value, "%u", &border_width);
463 } else if (strcmp(name, "window_gap") == 0) {
464 sscanf(value, "%i", &window_gap);
465 } else if (strcmp(name, "split_ratio") == 0) {
466 sscanf(value, "%lf", &split_ratio);
467 } else if (strcmp(name, "left_padding") == 0) {
468 sscanf(value, "%i", &mon->left_padding);
469 } else if (strcmp(name, "right_padding") == 0) {
470 sscanf(value, "%i", &mon->right_padding);
471 } else if (strcmp(name, "top_padding") == 0) {
472 sscanf(value, "%i", &mon->top_padding);
473 } else if (strcmp(name, "bottom_padding") == 0) {
474 sscanf(value, "%i", &mon->bottom_padding);
475 } else if (strcmp(name, "focused_border_color") == 0) {
476 strncpy(focused_border_color, value, sizeof(focused_border_color));
477 focused_border_color_pxl = get_color(focused_border_color);
478 } else if (strcmp(name, "active_border_color") == 0) {
479 strncpy(active_border_color, value, sizeof(active_border_color));
480 active_border_color_pxl = get_color(active_border_color);
481 } else if (strcmp(name, "normal_border_color") == 0) {
482 strncpy(normal_border_color, value, sizeof(normal_border_color));
483 normal_border_color_pxl = get_color(normal_border_color);
484 } else if (strcmp(name, "presel_border_color") == 0) {
485 strncpy(presel_border_color, value, sizeof(presel_border_color));
486 presel_border_color_pxl = get_color(presel_border_color);
487 } else if (strcmp(name, "focused_locked_border_color") == 0) {
488 strncpy(focused_locked_border_color, value, sizeof(focused_locked_border_color));
489 focused_locked_border_color_pxl = get_color(focused_locked_border_color);
490 } else if (strcmp(name, "active_locked_border_color") == 0) {
491 strncpy(active_locked_border_color, value, sizeof(active_locked_border_color));
492 active_locked_border_color_pxl = get_color(active_locked_border_color);
493 } else if (strcmp(name, "normal_locked_border_color") == 0) {
494 strncpy(normal_locked_border_color, value, sizeof(normal_locked_border_color));
495 normal_locked_border_color_pxl = get_color(normal_locked_border_color);
496 } else if (strcmp(name, "urgent_border_color") == 0) {
497 strncpy(urgent_border_color, value, sizeof(urgent_border_color));
498 urgent_border_color_pxl = get_color(urgent_border_color);
499 } else if (strcmp(name, "borderless_monocle") == 0) {
501 if (parse_bool(value, &b))
502 borderless_monocle = b;
503 } else if (strcmp(name, "gapless_monocle") == 0) {
505 if (parse_bool(value, &b))
507 } else if (strcmp(name, "focus_follows_pointer") == 0) {
509 if (parse_bool(value, &b) && b != focus_follows_pointer) {
510 uint32_t values[] = {(focus_follows_pointer ? CLIENT_EVENT_MASK : CLIENT_EVENT_MASK_FFP)};
511 for (monitor_t *m = mon_head; m != NULL; m = m->next)
512 for (desktop_t *d = m->desk_head; d != NULL; d = d->next)
513 for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n))
514 xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values);
515 if (focus_follows_pointer)
516 disable_motion_recorder();
518 enable_motion_recorder();
519 focus_follows_pointer = b;
521 } else if (strcmp(name, "adaptative_raise") == 0) {
523 if (parse_bool(value, &b))
524 adaptative_raise = b;
525 } else if (strcmp(name, "apply_shadow_property") == 0) {
527 if (parse_bool(value, &b))
528 apply_shadow_property = b;
529 } else if (strcmp(name, "auto_alternate") == 0) {
531 if (parse_bool(value, &b))
533 } else if (strcmp(name, "wm_name") == 0) {
534 strncpy(wm_name, value, sizeof(wm_name));
535 ewmh_update_wm_name();
538 snprintf(rsp, BUFSIZ, "unknown setting: %s", name);
542 arrange(mon, mon->desk);
545 void get_setting(char *name, char* rsp)
550 if (strcmp(name, "border_width") == 0)
551 snprintf(rsp, BUFSIZ, "%u", border_width);
552 else if (strcmp(name, "window_gap") == 0)
553 snprintf(rsp, BUFSIZ, "%i", window_gap);
554 else if (strcmp(name, "split_ratio") == 0)
555 snprintf(rsp, BUFSIZ, "%lf", split_ratio);
556 else if (strcmp(name, "left_padding") == 0)
557 snprintf(rsp, BUFSIZ, "%i", mon->left_padding);
558 else if (strcmp(name, "right_padding") == 0)
559 snprintf(rsp, BUFSIZ, "%i", mon->right_padding);
560 else if (strcmp(name, "top_padding") == 0)
561 snprintf(rsp, BUFSIZ, "%i", mon->top_padding);
562 else if (strcmp(name, "bottom_padding") == 0)
563 snprintf(rsp, BUFSIZ, "%i", mon->bottom_padding);
564 else if (strcmp(name, "focused_border_color") == 0)
565 snprintf(rsp, BUFSIZ, "%s (%06X)", focused_border_color, focused_border_color_pxl);
566 else if (strcmp(name, "active_border_color") == 0)
567 snprintf(rsp, BUFSIZ, "%s (%06X)", active_border_color, active_border_color_pxl);
568 else if (strcmp(name, "normal_border_color") == 0)
569 snprintf(rsp, BUFSIZ, "%s (%06X)", normal_border_color, normal_border_color_pxl);
570 else if (strcmp(name, "presel_border_color") == 0)
571 snprintf(rsp, BUFSIZ, "%s (%06X)", presel_border_color, presel_border_color_pxl);
572 else if (strcmp(name, "focused_locked_border_color") == 0)
573 snprintf(rsp, BUFSIZ, "%s (%06X)", focused_locked_border_color, focused_locked_border_color_pxl);
574 else if (strcmp(name, "active_locked_border_color") == 0)
575 snprintf(rsp, BUFSIZ, "%s (%06X)", active_locked_border_color, active_locked_border_color_pxl);
576 else if (strcmp(name, "normal_locked_border_color") == 0)
577 snprintf(rsp, BUFSIZ, "%s (%06X)", normal_locked_border_color, normal_locked_border_color_pxl);
578 else if (strcmp(name, "urgent_border_color") == 0)
579 snprintf(rsp, BUFSIZ, "%s (%06X)", urgent_border_color, urgent_border_color_pxl);
580 else if (strcmp(name, "borderless_monocle") == 0)
581 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(borderless_monocle));
582 else if (strcmp(name, "gapless_monocle") == 0)
583 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
584 else if (strcmp(name, "focus_follows_pointer") == 0)
585 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_pointer));
586 else if (strcmp(name, "adaptative_raise") == 0)
587 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(adaptative_raise));
588 else if (strcmp(name, "apply_shadow_property") == 0)
589 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(apply_shadow_property));
590 else if (strcmp(name, "auto_alternate") == 0)
591 snprintf(rsp, BUFSIZ, "%s", BOOLSTR(auto_alternate));
592 else if (strcmp(name, "wm_name") == 0)
593 snprintf(rsp, BUFSIZ, "%s", wm_name);
595 snprintf(rsp, BUFSIZ, "unknown setting: %s", name);
598 bool parse_bool(char *value, bool *b)
600 if (strcmp(value, "true") == 0) {
603 } else if (strcmp(value, "false") == 0) {
610 bool parse_layout(char *s, layout_t *l)
612 if (strcmp(s, "monocle") == 0) {
615 } else if (strcmp(s, "tiled") == 0) {
622 bool parse_direction(char *s, direction_t *d)
624 if (strcmp(s, "up") == 0) {
627 } else if (strcmp(s, "down") == 0) {
630 } else if (strcmp(s, "left") == 0) {
633 } else if (strcmp(s, "right") == 0) {
640 bool parse_nearest_argument(char *s, nearest_arg_t *a)
642 if (strcmp(s, "older") == 0) {
645 } else if (strcmp(s, "newer") == 0) {
652 bool parse_swap_argument(char *s, swap_arg_t *a)
654 if (strcmp(s, "biggest") == 0) {
657 } else if (strcmp(s, "smallest") == 0) {
664 bool parse_cycle_direction(char *s, cycle_dir_t *d)
666 if (strcmp(s, "prev") == 0) {
669 } else if (strcmp(s, "next") == 0) {
676 bool parse_circulate_direction(char *s, circulate_dir_t *d)
678 if (strcmp(s, "forward") == 0) {
679 *d = CIRCULATE_FORWARD;
681 } else if (strcmp(s, "backward") == 0) {
682 *d = CIRCULATE_BACKWARD;
688 bool parse_skip_client(char *s, skip_client_t *k)
691 *k = CLIENT_SKIP_NONE;
693 } else if (strcmp(s, "--skip-floating") == 0) {
694 *k = CLIENT_SKIP_FLOATING;
696 } else if (strcmp(s, "--skip-tiled") == 0) {
697 *k = CLIENT_SKIP_TILED;
699 } else if (strcmp(s, "--skip-class-equal") == 0) {
700 *k = CLIENT_SKIP_CLASS_EQUAL;
702 } else if (strcmp(s, "--skip-class-differ") == 0) {
703 *k = CLIENT_SKIP_CLASS_DIFFER;
709 bool parse_skip_desktop(char *s, skip_desktop_t *k)
712 *k = DESKTOP_SKIP_NONE;
714 } else if (strcmp(s, "--skip-free") == 0) {
715 *k = DESKTOP_SKIP_FREE;
717 } else if (strcmp(s, "--skip-occupied") == 0) {
718 *k = DESKTOP_SKIP_OCCUPIED;
724 bool parse_list_option(char *s, list_option_t *o)
726 if (s == NULL || strcmp(s, "--verbose") == 0) {
727 *o = LIST_OPTION_VERBOSE;
729 } else if (strcmp(s, "--quiet") == 0) {
730 *o = LIST_OPTION_QUIET;
736 bool parse_send_option(char *s, send_option_t *o)
739 *o = SEND_OPTION_DONT_FOLLOW;
741 } else if (strcmp(s, "--follow") == 0) {
742 *o = SEND_OPTION_FOLLOW;
748 bool parse_rotate(char *s, rotate_t *r)
750 if (strcmp(s, "clockwise") == 0) {
751 *r = ROTATE_CLOCKWISE;
753 } else if (strcmp(s, "counter_clockwise") == 0) {
754 *r = ROTATE_COUNTER_CLOCKWISE;
756 } else if (strcmp(s, "full_cycle") == 0) {
757 *r = ROTATE_FULL_CYCLE;
763 bool parse_flip(char *s, flip_t *f)
765 if (strcmp(s, "horizontal") == 0) {
766 *f = FLIP_HORIZONTAL;
768 } else if (strcmp(s, "vertical") == 0) {
775 bool parse_fence_move(char *s, fence_move_t *m)
777 if (strcmp(s, "push") == 0) {
780 } else if (strcmp(s, "pull") == 0) {
787 bool parse_pointer_action(char *s, pointer_action_t *a)
789 if (strcmp(s, "move") == 0) {
792 } else if (strcmp(s, "resize_corner") == 0) {
793 *a = ACTION_RESIZE_CORNER;
795 } else if (strcmp(s, "resize_side") == 0) {
796 *a = ACTION_RESIZE_SIDE;
798 } else if (strcmp(s, "focus") == 0) {