New option for bspwm: -p STATUS_PREFIX

This commit is contained in:
Bastien Dejean 2013-04-02 19:46:16 +02:00
parent f97d35cd96
commit 42afe4ad11
5 changed files with 11 additions and 4 deletions

View file

@ -2,7 +2,7 @@
## Synopsis ## Synopsis
bspwm [-v|-s STATUS_FIFO] bspwm [-h|-v|-s STATUS_FIFO|-p STATUS_PREFIX]
bspc MESSAGE [ARGUMENTS] [OPTIONS] bspc MESSAGE [ARGUMENTS] [OPTIONS]

View file

@ -3,7 +3,7 @@
bspwm \- Tiling window manager based on binary space partitioning bspwm \- Tiling window manager based on binary space partitioning
.SH SYNOPSIS .SH SYNOPSIS
.B bspwm .B bspwm
.RI [ -v | "-s STATUS_FIFO" ] .RI [ -h | -v | "-s STATUS_FIFO" | "-p STATUS_PREFIX" ]
.P .P
.BI bspc " MESSAGE" .BI bspc " MESSAGE"
.RI [ ARGUMENTS ] .RI [ ARGUMENTS ]

View file

@ -140,6 +140,7 @@ int main(int argc, char *argv[])
fd_set descriptors; fd_set descriptors;
char socket_path[MAXLEN]; char socket_path[MAXLEN];
char *fifo_path = NULL; char *fifo_path = NULL;
status_prefix = NULL;
int sock_fd, ret_fd, dpy_fd, sel, n; int sock_fd, ret_fd, dpy_fd, sel, n;
struct sockaddr_un sock_address; struct sockaddr_un sock_address;
size_t rsplen = 0; size_t rsplen = 0;
@ -148,10 +149,10 @@ int main(int argc, char *argv[])
xcb_generic_event_t *event; xcb_generic_event_t *event;
char opt; char opt;
while ((opt = getopt(argc, argv, "hvs:")) != -1) { while ((opt = getopt(argc, argv, "hvs:p:")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
printf("bspwm [-h|-v|-s FIFO]\n"); printf("bspwm [-h|-v|-s STATUS_FIFO|-p STATUS_PREFIX]\n");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'v': case 'v':
@ -161,6 +162,9 @@ int main(int argc, char *argv[])
case 's': case 's':
fifo_path = optarg; fifo_path = optarg;
break; break;
case 'p':
status_prefix = optarg;
break;
} }
} }

View file

@ -20,6 +20,7 @@ xcb_screen_t *screen;
xcb_window_t root; xcb_window_t root;
uint8_t root_depth; uint8_t root_depth;
FILE *status_fifo; FILE *status_fifo;
char *status_prefix;
split_mode_t split_mode; split_mode_t split_mode;
direction_t split_dir; direction_t split_dir;

2
tree.c
View file

@ -812,6 +812,8 @@ void put_status(void)
{ {
if (status_fifo == NULL) if (status_fifo == NULL)
return; return;
if (status_prefix != NULL)
fprintf(status_fifo, "%s", status_prefix);
bool urgent = false; bool urgent = false;
for (monitor_t *m = mon_head; m != NULL; m = m->next) { for (monitor_t *m = mon_head; m != NULL; m = m->next) {
fprintf(status_fifo, "%c%s:", (mon == m ? 'M' : 'm'), m->name); fprintf(status_fifo, "%c%s:", (mon == m ? 'M' : 'm'), m->name);