remove_rule_by_uid(uid);
return;
} else if (strcmp(cmd, "swap") == 0) {
- swap_nodes(mon->desk->focus, history_get(mon->desk->history, 1));
+ char *arg;
+ swap_arg_t a;
+ if ((arg = strtok(NULL, TOK_SEP)) != NULL) {
+ if (parse_swap_argument(arg, &a)) {
+ node_t *n = find_by_area(mon->desk, a);
+ swap_nodes(mon->desk->focus, n);
+ }
+ } else {
- swap_nodes(mon->desk->focus, mon->desk->last_focus);
++ swap_nodes(mon->desk->focus, history_get(mon->desk->history, 1));
+ }
} else if (strcmp(cmd, "alternate") == 0) {
- focus_node(mon, mon->desk, mon->desk->last_focus, true);
+ focus_node(mon, mon->desk, history_get(mon->desk->history, 1), true);
return;
} else if (strcmp(cmd, "alternate_desktop") == 0) {
select_desktop(mon->last_desk);
flip_tree(n->second_child, flp);
}
+void list_history(desktop_t *d, char *rsp)
+{
+ char line[MAXLEN];
+ for (node_list_t *a = d->history->head; a != NULL; a = a->next) {
+ snprintf(line, sizeof(line), "%s %X\n", a->node->client->class_name, a->node->client->window);
+ strncat(rsp, line, REMLEN(rsp));
+ }
+}
+
+ int balance_tree(node_t *n)
+ {
+ if (n == NULL || n->vacant) {
+ return 0;
+ } else if (is_leaf(n)) {
+ return 1;
+ } else {
+ int b1 = balance_tree(n->first_child);
+ int b2 = balance_tree(n->second_child);
+ int b = b1 + b2;
+ if (b1 > 0 && b2 > 0)
+ n->split_ratio = (double) b1 / b;
+ return b;
+ }
+ }
+
void arrange(monitor_t *m, desktop_t *d)
{
PRINTF("arrange %s%s%s\n", (num_monitors > 1 ? m->name : ""), (num_monitors > 1 ? " " : ""), d->name);
disable_motion_recorder();
}
- if (!is_tiled(n->client)) {
- if (!adaptative_raise || !might_cover(d, n))
- window_raise(n->client->window);
- } else {
- window_pseudo_raise(d, n->client->window);
- }
-
if (d->focus != n) {
- d->last_focus = d->focus;
d->focus = n;
+ history_add(d->history, n);
}
ewmh_update_active_window();
update_vacant_state(b->parent);
}
-
+ history_remove(d->history, n);
+ put_status();
}
void remove_node(desktop_t *d, node_t *n)