nearest older|newer [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]
Focus the nearest window matching the given constraints.
+ circulate forward|backward
+ Circulate the leaves in the given direction.
+
toggle_fullscreen
Toggle the fullscreen state of the current window.
.BI nearest " older|newer [--skip-floating|--skip-tiled|--skip-class-equal|--skip-class-differ]"
Focus the nearest window matching the given constraints.
.TP
+.BI circulate " forward|backward"
+Circulate the leaves in the given direction.
+.TP
.BI toggle_fullscreen
Toggle the fullscreen state of the current window.
.TP
}
if (mon->desk->layout == LAYOUT_TILED)
return;
+ } else if (strcmp(cmd, "circulate") == 0) {
+ if (mon->desk->layout == LAYOUT_MONOCLE || (mon->desk->focus != NULL && mon->desk->focus->client->fullscreen))
+ return;
+ char *dir = strtok(NULL, TOKEN_SEP);
+ if (dir != NULL) {
+ circulate_dir_t d;
+ if (parse_circulate_direction(dir, &d))
+ circulate_leaves(mon, mon->desk, d);
+ }
} else if (strcmp(cmd, "rule") == 0) {
char *name = strtok(NULL, TOKEN_SEP);
if (name != NULL) {
return false;
}
+bool parse_circulate_direction(char *s, circulate_dir_t *d)
+{
+ if (strcmp(s, "forward") == 0) {
+ *d = CIRCULATE_FORWARD;
+ return true;
+ } else if (strcmp(s, "backward") == 0) {
+ *d = CIRCULATE_BACKWARD;
+ return true;
+ }
+ return false;
+}
+
bool parse_skip_client(char *s, skip_client_t *k)
{
if (s == NULL) {
bool parse_direction(char *, direction_t *);
bool parse_nearest_argument(char *, nearest_arg_t *);
bool parse_cycle_direction(char *, cycle_dir_t *);
+bool parse_circulate_direction(char *, circulate_dir_t *);
bool parse_list_option(char *, list_option_t *);
bool parse_skip_client(char *, skip_client_t *);
bool parse_skip_desktop(char *, skip_desktop_t *);
focus_node(m, d, x, true);
}
+void circulate_leaves(monitor_t *m, desktop_t *d, circulate_dir_t dir) {
+ if (d == NULL || d->root == NULL || is_leaf(d->root))
+ return;
+ node_t *par = d->focus->parent;
+ bool first = is_first_child(d->focus);
+ if (dir == CIRCULATE_FORWARD)
+ for (node_t *s = second_extrema(d->root), *f = prev_leaf(s); f != NULL && s != NULL; s = prev_leaf(f), f = prev_leaf(s))
+ swap_nodes(f, s);
+ else
+ for (node_t *f = first_extrema(d->root), *s = next_leaf(f); f != NULL && s != NULL; f = next_leaf(s), s = next_leaf(f))
+ swap_nodes(f, s);
+ if (is_floating(d->focus->client))
+ return;
+ if (first)
+ focus_node(m, d, par->first_child, true);
+ else
+ focus_node(m, d, par->second_child, true);
+}
+
void update_vacant_state(node_t *n)
{
if (n == NULL)
void cycle_desktop(monitor_t *, desktop_t *, cycle_dir_t, skip_desktop_t);
void cycle_leaf(monitor_t *, desktop_t *, node_t *, cycle_dir_t, skip_client_t);
void nearest_leaf(monitor_t *, desktop_t *, node_t *, nearest_arg_t, skip_client_t);
+void circulate_leaves(monitor_t *, desktop_t *, circulate_dir_t);
void update_vacant_state(node_t *);
void add_desktop(monitor_t *, char *);
void add_monitor(xcb_rectangle_t *);
NEAREST_NEWER
} nearest_arg_t;
+typedef enum {
+ CIRCULATE_FORWARD,
+ CIRCULATE_BACKWARD
+} circulate_dir_t;
+
typedef enum {
ROTATE_CLOCKWISE,
ROTATE_COUNTER_CLOCKWISE,