- `cycle_layout` — Cycle the layout of the current desktop.
-- `rotate clockwise|counter_clockwise|full_cycle` — Rotate the tree of the current desktop.
+- `rotate clockwise|counter_clockwise|full_cycle` — Rotate the window tree.
+
+- `flip horizontal|vertical` — Flip the window tree.
- `rule PATTERN [DESKTOP_NAME] [floating]` — Create a new rule (`PATTERN` must match the class or instance name).
Cycle the layout of the current desktop.
.TP
.BI rotate " clockwise|counter_clockwise|full_cycle"
-Rotate the tree of the current desktop.
+Rotate the window tree.
+.TP
+.BI flip " horizontal|vertical"
+Flip the window tree.
.TP
.BI rule " PATTERN [DESKTOP_NAME] [floating]"
Create a new rule (PATTERN must match the class or instance name).
char *deg = strtok(NULL, TOK_SEP);
if (deg != NULL) {
rotate_t r;
- if (parse_rotate(deg, &r)) {
+ if (parse_rotate(deg, &r))
rotate_tree(mon->desk->root, r);
- }
+ }
+ } else if (strcmp(cmd, "flip") == 0) {
+ char *flp = strtok(NULL, TOK_SEP);
+ if (flp != NULL) {
+ flip_t f;
+ if (parse_flip(flp, &f))
+ flip_tree(mon->desk->root, f);
}
} else if (strcmp(cmd, "grab_pointer") == 0) {
char *pac = strtok(NULL, TOK_SEP);
return false;
}
+bool parse_flip(char *s, flip_t *f)
+{
+ if (strcmp(s, "horizontal") == 0) {
+ *f = FLIP_HORIZONTAL;
+ return true;
+ } else if (strcmp(s, "vertical") == 0) {
+ *f = FLIP_VERTICAL;
+ return true;
+ }
+ return false;
+}
+
bool parse_fence_move(char *s, fence_move_t *m)
{
if (strcmp(s, "push") == 0) {
bool parse_skip_client(char *, skip_client_t *);
bool parse_skip_desktop(char *, skip_desktop_t *);
bool parse_rotate(char *, rotate_t *);
+bool parse_flip(char *, flip_t *);
bool parse_fence_move(char *, fence_move_t *);
bool parse_pointer_action(char *, pointer_action_t *);
rotate_tree(n->second_child, rot);
}
+void flip_tree(node_t *n, flip_t flp)
+{
+ if (n == NULL || is_leaf(n))
+ return;
+
+ node_t *tmp;
+
+ if ((flp == FLIP_HORIZONTAL && n->split_type == TYPE_HORIZONTAL)
+ || (flp == FLIP_VERTICAL && n->split_type == TYPE_VERTICAL)) {
+ tmp = n->first_child;
+ n->first_child = n->second_child;
+ n->second_child = tmp;
+ n->split_ratio = 1.0 - n->split_ratio;
+ }
+
+ flip_tree(n->first_child, flp);
+ flip_tree(n->second_child, flp);
+}
void arrange(monitor_t *m, desktop_t *d)
{
unsigned int distance_to_fence(xcb_point_t, node_t *);
fence_distance_t nearest_fence(xcb_point_t, node_t *);
void rotate_tree(node_t *, rotate_t);
+void flip_tree(node_t *, flip_t);
void arrange(monitor_t *, desktop_t *);
void apply_layout(monitor_t *, desktop_t *, node_t *, xcb_rectangle_t, xcb_rectangle_t);
void insert_node(monitor_t *, desktop_t *, node_t *);
ROTATE_FULL_CYCLE
} rotate_t;
+typedef enum {
+ FLIP_HORIZONTAL,
+ FLIP_VERTICAL
+} flip_t;
+
typedef enum {
DIR_LEFT,
DIR_RIGHT,