]> git.lizzy.rs Git - bspwm.git/blobdiff - query.c
Add new desktop selector: focused:MONITOR_SEL
[bspwm.git] / query.c
diff --git a/query.c b/query.c
index b35e50d0e0f89b5618ceabab29ffa97a1db666d2..13c39108e8838a729e36a793158d211b7683c92c 100644 (file)
--- a/query.c
+++ b/query.c
@@ -23,6 +23,7 @@
  */
 
 #include <stdio.h>
+#include <strings.h>
 #include <string.h>
 #include "bspwm.h"
 #include "desktop.h"
@@ -68,7 +69,7 @@ void query_desktops(monitor_t *m, domain_t dom, coordinates_t loc, unsigned int
             strncat(rsp, line, REMLEN(rsp));
             continue;
         } else {
-            snprintf(line, sizeof(line), "%s %u %i %c %c", d->name, d->border_width, d->window_gap, (d->layout == LAYOUT_TILED ? 'T' : 'M'), (d->floating ? 'f' : '-'));
+            snprintf(line, sizeof(line), "%s %u %i %i,%i,%i,%i %c %c", d->name, d->border_width, d->window_gap, d->top_padding, d->right_padding, d->bottom_padding, d->left_padding, (d->layout == LAYOUT_TILED ? 'T' : 'M'), (d->floating ? 'f' : '-'));
             strncat(rsp, line, REMLEN(rsp));
             if (d == m->desk)
                 strncat(rsp, " *", REMLEN(rsp));
@@ -90,7 +91,7 @@ void query_tree(desktop_t *d, node_t *n, char *rsp, unsigned int depth)
 
     if (is_leaf(n)) {
         client_t *c = n->client;
-        snprintf(line, sizeof(line), "%c %s 0x%X %u %ux%u%+i%+i %c %c%c%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' : '-'), (c->sticky ? 's' : '-'), (c->frame ? 'e' : '-'), (c->private ? 'i' : '-'), (n->split_mode ? 'p' : '-'));
+        snprintf(line, sizeof(line), "%c %s 0x%X %u %ux%u%+i%+i %c %c%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->pseudo_tiled ? 'd' : '-'), (c->fullscreen ? 'F' : '-'), (c->urgent ? 'u' : '-'), (c->locked ? 'l' : '-'), (c->sticky ? 's' : '-'), (c->private ? 'i' : '-'), (n->split_mode ? 'p' : '-'));
     } else {
         snprintf(line, sizeof(line), "%c %c %lf", (n->split_type == TYPE_HORIZONTAL ? 'H' : 'V'), (n->birth_rotation == 90 ? 'a' : (n->birth_rotation == 270 ? 'c' : 'm')), n->split_ratio);
     }
@@ -230,6 +231,7 @@ bool desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
 
     cycle_dir_t cyc;
     history_dir_t hdi;
+    char *colon;
     int idx;
     if (parse_cycle_direction(desc, &cyc)) {
         dst->monitor = ref->monitor;
@@ -244,6 +246,11 @@ bool desktop_from_desc(char *desc, coordinates_t *ref, coordinates_t *dst)
             dst->monitor = mon;
             dst->desktop = mon->desk;
         }
+    } else if ((colon = index(desc, ':')) != NULL) {
+        *colon = '\0';
+        if (streq("focused", desc))
+            if (monitor_from_desc(colon + 1, ref, dst))
+                dst->desktop = dst->monitor->desk;
     } else if (parse_index(desc, &idx)) {
         desktop_from_index(idx, dst);
     } else {