-#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "bspwm.h"
#include "tree.h"
-#include "settings.h"
#include "messages.h"
+#include "history.h"
#include "query.h"
void query_monitors(coordinates_t loc, domain_t dom, char *rsp)
if (is_leaf(n)) {
client_t *c = n->client;
- snprintf(line, sizeof(line), "%c %s %X %u %ux%u%+i%+i %c%c%c%c%c%c", (n->birth_rotation == 90 ? 'a' : (n->birth_rotation == 270 ? 'c' : 'm')), c->class_name, c->window, c->border_width, c->floating_rectangle.width, c->floating_rectangle.height, c->floating_rectangle.x, c->floating_rectangle.y, (c->floating ? 'f' : '-'), (c->transient ? 't' : '-'), (c->fullscreen ? 'F' : '-'), (c->urgent ? 'u' : '-'), (c->locked ? 'l' : '-'), (n->split_mode ? 'p' : '-'));
+ snprintf(line, sizeof(line), "%c %s %X %u %ux%u%+i%+i %c %c%c%c%c%c%c", (n->birth_rotation == 90 ? 'a' : (n->birth_rotation == 270 ? 'c' : 'm')), c->class_name, c->window, c->border_width, c->floating_rectangle.width, c->floating_rectangle.height, c->floating_rectangle.x, c->floating_rectangle.y, (n->split_dir == DIR_UP ? 'U' : (n->split_dir == DIR_RIGHT ? 'R' : (n->split_dir == DIR_DOWN ? 'D' : 'L'))), (c->floating ? 'f' : '-'), (c->transient ? 't' : '-'), (c->fullscreen ? 'F' : '-'), (c->urgent ? 'u' : '-'), (c->locked ? 'l' : '-'), (n->split_mode ? 'p' : '-'));
} else {
snprintf(line, sizeof(line), "%c %c %.2f", (n->split_type == TYPE_HORIZONTAL ? 'H' : 'V'), (n->birth_rotation == 90 ? 'a' : (n->birth_rotation == 270 ? 'c' : 'm')), n->split_ratio);
}
}
return false;
}
+
+/**
+ * Check if the specified node matches the selection criteria.
+ *
+ * Arguments:
+ * node_t *c - the active node
+ * node_t *t - the node to test
+ * client_sel_t sel - the selection criteria
+ *
+ * Returns true if the node matches.
+ **/
+bool node_matches(node_t *c, node_t *t, client_select_t sel)
+{
+ if (sel.type != CLIENT_TYPE_ALL &&
+ is_tiled(t->client)
+ ? sel.type == CLIENT_TYPE_FLOATING
+ : sel.type == CLIENT_TYPE_TILED
+ ) return false;
+
+ if (sel.class != CLIENT_CLASS_ALL &&
+ streq(c->client->class_name, t->client->class_name)
+ ? sel.class == CLIENT_CLASS_DIFFER
+ : sel.class == CLIENT_CLASS_EQUAL
+ ) return false;
+
+ if (sel.mode != CLIENT_MODE_ALL &&
+ t->split_mode == MODE_MANUAL
+ ? sel.mode == CLIENT_MODE_AUTOMATIC
+ : sel.mode == CLIENT_MODE_MANUAL)
+ return false;
+
+ if (sel.urgency != CLIENT_URGENCY_ALL &&
+ t->client->urgent
+ ? sel.urgency == CLIENT_URGENCY_OFF
+ : sel.urgency == CLIENT_URGENCY_ON
+ ) return false;
+
+ return true;
+}
+
+bool desktop_matches(desktop_t *t, desktop_select_t sel) {
+ if (sel.status != DESKTOP_STATUS_ALL &&
+ t->root == NULL
+ ? sel.status == DESKTOP_STATUS_OCCUPIED
+ : sel.status == DESKTOP_STATUS_FREE
+ ) return false;
+
+ if (sel.urgency != DESKTOP_URGENCY_ALL &&
+ is_urgent(t)
+ ? sel.urgency == DESKTOP_URGENCY_OFF
+ : sel.urgency == DESKTOP_URGENCY_ON
+ ) return false;
+
+ return true;
+}