+#define CHECK_MOVE_CON_TO_WORKSPACE \
+ do { \
+ HANDLE_EMPTY_MATCH; \
+ if (TAILQ_EMPTY(&owindows)) { \
+ yerror("Nothing to move: specified criteria don't match any window"); \
+ return; \
+ } else { \
+ bool found = false; \
+ owindow *current = TAILQ_FIRST(&owindows); \
+ while (current) { \
+ owindow *next = TAILQ_NEXT(current, owindows); \
+ \
+ if (current->con->type == CT_WORKSPACE && !con_has_children(current->con)) { \
+ TAILQ_REMOVE(&owindows, current, owindows); \
+ } else { \
+ found = true; \
+ } \
+ \
+ current = next; \
+ } \
+ if (!found) { \
+ yerror("Nothing to move: workspace empty"); \
+ return; \
+ } \
+ } \
+ } while (0)
+