rotate_tree(mon->desk->root, r);
}
}
- } else if (strcmp(cmd, "mouse") == 0) {
- char *mac = strtok(NULL, TOK_SEP);
- if (mac != NULL) {
- mouse_action_t a;
- if (parse_mouse_action(mac, &a))
- mouse_do(a);
+ } else if (strcmp(cmd, "grab_pointer") == 0) {
+ char *pac = strtok(NULL, TOK_SEP);
+ if (pac != NULL) {
+ pointer_action_t a;
+ if (parse_pointer_action(pac, &a))
+ grab_pointer(a);
}
+ } else if (strcmp(cmd, "track_pointer") == 0) {
+ char *arg1 = strtok(NULL, TOK_SEP);
+ if (arg1 == NULL)
+ return;
+ char *arg2 = strtok(NULL, TOK_SEP);
+ if (arg2 == NULL)
+ return;
+ int root_x, root_y;
+ if (sscanf(arg1, "%i", &root_x) == 1 && sscanf(arg2, "%i", &root_y) == 1)
+ track_pointer(root_x, root_y);
+ return;
+ } else if (strcmp(cmd, "ungrab_pointer") == 0) {
+ ungrab_pointer();
} else if (strcmp(cmd, "layout") == 0) {
char *lyt = strtok(NULL, TOK_SEP);
if (lyt != NULL) {
move_fence(mon->desk->focus, d, m);
}
}
- } else if (strcmp(cmd, "send_to_monitor") == 0) {
- char *arg = strtok(NULL, TOK_SEP);
- send_option_t opt;
- monitor_t *m = NULL;
-
- if (arg != NULL) {
- /* Check whether we're using the previous/next monitor to send the
- * client to.
- */
- if (parse_send_option(arg, &opt)) {
- if (opt == SEND_OPTION_NEXT)
+ } else if (strcmp(cmd, "drop_to_monitor") == 0) {
+ char *dir = strtok(NULL, TOK_SEP);
+ if (dir != NULL) {
+ cycle_dir_t d;
+ if (parse_cycle_direction(dir, &d)) {
+ monitor_t *m;
+ if (d == CYCLE_NEXT)
m = ((mon->next == NULL ? mon_head : mon->next));
- else if (opt == SEND_OPTION_PREV) {
+ else
m = ((mon->prev == NULL ? mon_tail : mon->prev));
- }
- } else
- m = find_monitor(arg);
+ transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus);
+ arrange(m, m->desk);
+ char *opt = strtok(NULL, TOK_SEP);
+ send_option_t o;
+ if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
+ select_monitor(m);
+ }
}
- if (m != NULL && m != mon) {
- transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus);
- arrange(m, m->desk);
- if (opt == SEND_OPTION_FOLLOW)
- select_monitor(m);
+ } else if (strcmp(cmd, "send_to_monitor") == 0) {
+ char *name = strtok(NULL, TOK_SEP);
+ if (name != NULL) {
+ monitor_t *m = find_monitor(name);
+ if (m != NULL && m != mon) {
+ transfer_node(mon, mon->desk, m, m->desk, mon->desk->focus);
+ arrange(m, m->desk);
+ char *opt = strtok(NULL, TOK_SEP);
+ send_option_t o;
+ if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
+ select_monitor(m);
+ }
+ }
+ } else if (strcmp(cmd, "drop_to") == 0) {
+ char *dir = strtok(NULL, TOK_SEP);
+ if (dir != NULL) {
+ cycle_dir_t c;
+ if (parse_cycle_direction(dir, &c)) {
+ desktop_t *d;
+ if (c == CYCLE_NEXT)
+ d = ((mon->desk->next == NULL ? mon->desk_head : mon->desk->next));
+ else
+ d = ((mon->desk->prev == NULL ? mon->desk_tail : mon->desk->prev));
+ transfer_node(mon, mon->desk, mon, d, mon->desk->focus);
+ char *opt = strtok(NULL, TOK_SEP);
+ send_option_t o;
+ if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW)
+ select_desktop(d);
+ }
}
} else if (strcmp(cmd, "send_to") == 0) {
char *name = strtok(NULL, TOK_SEP);
transfer_node(mon, mon->desk, loc.monitor, loc.desktop, mon->desk->focus);
if (mon != loc.monitor && loc.monitor->desk == loc.desktop)
arrange(loc.monitor, loc.desktop);
- char *arg = strtok(NULL, TOK_SEP);
- send_option_t opt;
- if (parse_send_option(arg, &opt) && opt == SEND_OPTION_FOLLOW) {
+ char *opt = strtok(NULL, TOK_SEP);
+ send_option_t o;
+ if (parse_send_option(opt, &o) && o == SEND_OPTION_FOLLOW) {
select_monitor(loc.monitor);
select_desktop(loc.desktop);
}
if (sscanf(arg, "%X", &uid) > 0)
remove_rule_by_uid(uid);
return;
+ } else if (strcmp(cmd, "swap") == 0) {
+ swap_nodes(mon->desk->focus, mon->desk->last_focus);
} else if (strcmp(cmd, "alternate") == 0) {
focus_node(mon, mon->desk, mon->desk->last_focus, true);
return;
bool b;
if (parse_bool(value, &b))
gapless_monocle = b;
- } else if (strcmp(name, "focus_follows_mouse") == 0) {
+ } else if (strcmp(name, "focus_follows_pointer") == 0) {
bool b;
- if (parse_bool(value, &b))
- focus_follows_mouse = b;
+ if (parse_bool(value, &b)) {
+ if (b != focus_follows_pointer) {
+ uint32_t values[] = {(focus_follows_pointer ? CLIENT_EVENT_MASK : CLIENT_EVENT_MASK_FFP)};
+ for (monitor_t *m = mon_head; m != NULL; m = m->next)
+ for (desktop_t *d = m->desk_head; d != NULL; d = d->next)
+ for (node_t *n = first_extrema(d->root); n != NULL; n = next_leaf(n))
+ xcb_change_window_attributes(dpy, n->client->window, XCB_CW_EVENT_MASK, values);
+
+ }
+ focus_follows_pointer = b;
+ }
} else if (strcmp(name, "adaptative_raise") == 0) {
bool b;
if (parse_bool(value, &b))
adaptative_raise = b;
+ } else if (strcmp(name, "apply_shadow_property") == 0) {
+ bool b;
+ if (parse_bool(value, &b))
+ apply_shadow_property = b;
} else if (strcmp(name, "wm_name") == 0) {
strncpy(wm_name, value, sizeof(wm_name));
ewmh_update_wm_name();
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(borderless_monocle));
else if (strcmp(name, "gapless_monocle") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(gapless_monocle));
- else if (strcmp(name, "focus_follows_mouse") == 0)
- snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_mouse));
+ else if (strcmp(name, "focus_follows_pointer") == 0)
+ snprintf(rsp, BUFSIZ, "%s", BOOLSTR(focus_follows_pointer));
else if (strcmp(name, "adaptative_raise") == 0)
snprintf(rsp, BUFSIZ, "%s", BOOLSTR(adaptative_raise));
+ else if (strcmp(name, "apply_shadow_property") == 0)
+ snprintf(rsp, BUFSIZ, "%s", BOOLSTR(apply_shadow_property));
else if (strcmp(name, "wm_name") == 0)
snprintf(rsp, BUFSIZ, "%s", wm_name);
else
} else if (strcmp(s, "--follow") == 0) {
*o = SEND_OPTION_FOLLOW;
return true;
- } else if (strcmp(s, "--next") == 0) {
- *o = SEND_OPTION_NEXT;
- return true;
- } else if (strcmp(s, "--prev") == 0) {
- *o = SEND_OPTION_PREV;
- return true;
}
return false;
}
return false;
}
-bool parse_mouse_action(char *s, mouse_action_t *a)
+bool parse_pointer_action(char *s, pointer_action_t *a)
{
if (strcmp(s, "move") == 0) {
- *a = MOUSE_MOVE;
+ *a = ACTION_MOVE;
return true;
} else if (strcmp(s, "focus") == 0) {
- *a = MOUSE_FOCUS;
+ *a = ACTION_FOCUS;
return true;
} else if (strcmp(s, "resize") == 0) {
- *a = MOUSE_RESIZE;
+ *a = ACTION_RESIZE;
return true;
}
return false;