From 65e175a19e79fe7d3626b72a48b41369cbf4a5f8 Mon Sep 17 00:00:00 2001 From: alex Date: Sat, 31 May 2014 16:18:31 -0400 Subject: [PATCH] When 'A' is followed by a 'p', the x position will be printed after the action --- bar.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bar.c b/bar.c index 6346870..3fc68fe 100644 --- a/bar.c +++ b/bar.c @@ -37,6 +37,7 @@ typedef struct area_t { int begin, end, align; xcb_window_t window; char *cmd; + bool print_pos; } area_t; #define N 10 @@ -235,6 +236,11 @@ area_add (char *str, const char *optend, char **end, monitor_t *mon, const int x return false; } + if (*p == 'W') { + a->print_pos = true; + p++; + } + /* A wild close area tag appeared! */ if (*p != ':') { *end = p; @@ -1039,7 +1045,15 @@ main (int argc, char **argv) /* Respond to left click */ if (press_ev->detail == XCB_BUTTON_INDEX_1) { area_t *area = area_get(press_ev->event, press_ev->event_x); - if (area) { write(STDOUT_FILENO, area->cmd, strlen(area->cmd)); write(STDOUT_FILENO, "\n", 1); } + if (area) { + write(STDOUT_FILENO, area->cmd, strlen(area->cmd)); + if (area->print_pos) { + char pos[6]; + snprintf(pos, 6, " %d", area->begin); + write(STDOUT_FILENO, pos, 6); + } + write(STDOUT_FILENO, "\n", 1); + } } break; }