]> git.lizzy.rs Git - bspwm.git/commitdiff
New option for `bspwm`: `-p STATUS_PREFIX`
authorBastien Dejean <nihilhill@gmail.com>
Tue, 2 Apr 2013 17:46:16 +0000 (19:46 +0200)
committerBastien Dejean <nihilhill@gmail.com>
Tue, 2 Apr 2013 17:46:16 +0000 (19:46 +0200)
README.md
bspwm.1
bspwm.c
bspwm.h
tree.c

index 63e60e344b0849750c521b9e80cb0f8e921d244a..c0949c335475f98d7245a238890b0eeb1b23ae87 100644 (file)
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 ## Synopsis
 
-    bspwm [-v|-s STATUS_FIFO]
+    bspwm [-h|-v|-s STATUS_FIFO|-p STATUS_PREFIX]
 
     bspc MESSAGE [ARGUMENTS] [OPTIONS]
 
diff --git a/bspwm.1 b/bspwm.1
index d96669f25150044d52174252273f6e4f05a7f8bc..785859c0ff28d0e61d318ab285c6329b3cd629d3 100644 (file)
--- a/bspwm.1
+++ b/bspwm.1
@@ -3,7 +3,7 @@
 bspwm \- Tiling window manager based on binary space partitioning
 .SH SYNOPSIS
 .B bspwm
-.RI [ -v | "-s STATUS_FIFO" ]
+.RI [ -h | -v | "-s STATUS_FIFO" | "-p STATUS_PREFIX" ]
 .P
 .BI bspc " MESSAGE"
 .RI [ ARGUMENTS ]
diff --git a/bspwm.c b/bspwm.c
index f0debe9d75ce823851c4b7b672e0e49595509ca7..1a0012e89d20d6b924ec39bd45f0a941a5fc64e4 100644 (file)
--- a/bspwm.c
+++ b/bspwm.c
@@ -140,6 +140,7 @@ int main(int argc, char *argv[])
     fd_set descriptors;
     char socket_path[MAXLEN];
     char *fifo_path = NULL;
+    status_prefix = NULL;
     int sock_fd, ret_fd, dpy_fd, sel, n;
     struct sockaddr_un sock_address;
     size_t rsplen = 0;
@@ -148,10 +149,10 @@ int main(int argc, char *argv[])
     xcb_generic_event_t *event;
     char opt;
 
-    while ((opt = getopt(argc, argv, "hvs:")) != -1) {
+    while ((opt = getopt(argc, argv, "hvs:p:")) != -1) {
         switch (opt) {
             case 'h':
-                printf("bspwm [-h|-v|-s FIFO]\n");
+                printf("bspwm [-h|-v|-s STATUS_FIFO|-p STATUS_PREFIX]\n");
                 exit(EXIT_SUCCESS);
                 break;
             case 'v':
@@ -161,6 +162,9 @@ int main(int argc, char *argv[])
             case 's':
                 fifo_path = optarg;
                 break;
+            case 'p':
+                status_prefix = optarg;
+                break;
         }
     }
 
diff --git a/bspwm.h b/bspwm.h
index fd6c69c18eebfc9d124de329c68af31751805543..3ec17033be72eee38d779657d8abe7a8a8374a2a 100644 (file)
--- a/bspwm.h
+++ b/bspwm.h
@@ -20,6 +20,7 @@ xcb_screen_t *screen;
 xcb_window_t root;
 uint8_t root_depth;
 FILE *status_fifo;
+char *status_prefix;
 
 split_mode_t split_mode;
 direction_t split_dir;
diff --git a/tree.c b/tree.c
index 9c8390b28c084d424e8234da5b58d963735738bd..541af9924a2fc3fe523bd5cef6e4fb86d32bfafa 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -812,6 +812,8 @@ void put_status(void)
 {
     if (status_fifo == NULL)
         return;
+    if (status_prefix != NULL)
+        fprintf(status_fifo, "%s", status_prefix);
     bool urgent = false;
     for (monitor_t *m = mon_head; m != NULL; m = m->next) {
         fprintf(status_fifo, "%c%s:", (mon == m ? 'M' : 'm'), m->name);