Merge remote-tracking branch 'upstream/master' into xft-port

* upstream/master:
  Set the WM_NAME for all the windows.
  Don't use optarg directly when parsing the -n switch argument.
  Silence a warning about write() result being unused.
  Update the .travis.yml to build all the features
  Make it possible to build lemonbar w/o XINERAMA support
  Add pixel offset
  Document literal percent sign under formatting
This commit is contained in:
krypt-n 2016-11-07 09:18:19 +01:00
commit 7890857f95
3 changed files with 19 additions and 7 deletions

View File

@ -5,4 +5,6 @@ compiler:
before_install:
- sudo apt-get update -qq
- sudo apt-get install -y libx11-xcb-dev libxcb-randr0-dev libxcb-xinerama0-dev
env:
- CFLAGS='-DWITH_XINERAMA=1'
script: make

View File

@ -73,7 +73,7 @@ Set the underline color of the bar. Accepts the same color formats as B<-B>.
=head1 FORMATTING
lemonbar provides a screenrc-inspired formatting syntax to allow full customization at runtime. Every formatting block is opened with B<%{> and closed by B<}> and accepts the following commands, the parser tries it's best to handle malformed input.
lemonbar provides a screenrc-inspired formatting syntax to allow full customization at runtime. Every formatting block is opened with C<%{> and closed by C<}> and accepts the following commands, the parser tries it's best to handle malformed input. Use C<%%> to get a literal percent sign (C<%>).
=over

View File

@ -1,4 +1,5 @@
// vim:sw=4:ts=4:et:
#define _POSIX_C_SOURCE 200809L
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
@ -12,7 +13,9 @@
#include <errno.h>
#include <xcb/xcb.h>
#include <xcb/xcbext.h>
#if WITH_XINERAMA
#include <xcb/xinerama.h>
#endif
#include <xcb/randr.h>
#include <X11/Xft/Xft.h>
@ -1116,6 +1119,7 @@ get_randr_monitors (void)
monitor_create_chain(r, valid);
}
#ifdef WITH_XINERAMA
void
get_xinerama_monitors (void)
{
@ -1144,6 +1148,7 @@ get_xinerama_monitors (void)
monitor_create_chain(rects, screens);
}
#endif
xcb_visualid_t
get_visual (void)
@ -1275,7 +1280,9 @@ init (char *wm_name)
if (qe_reply && qe_reply->present) {
get_randr_monitors();
} else {
}
#if WITH_XINERAMA
else {
qe_reply = xcb_get_extension_data(c, &xcb_xinerama_id);
// Check if Xinerama extension is present and active
@ -1289,6 +1296,7 @@ init (char *wm_name)
free(xia_reply);
}
}
#endif
if (!monhead) {
// If I fits I sits
@ -1336,7 +1344,7 @@ init (char *wm_name)
// Set the WM_NAME atom to the user specified value
if (wm_name)
xcb_change_property(c, XCB_PROP_MODE_REPLACE, monhead->window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8 ,strlen(wm_name), wm_name);
xcb_change_property(c, XCB_PROP_MODE_REPLACE, mon->window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8 ,strlen(wm_name), wm_name);
}
char color[] = "#ffffff";
@ -1446,7 +1454,7 @@ main (int argc, char **argv)
exit (EXIT_SUCCESS);
case 'g': (void)parse_geometry_string(optarg, geom_v); break;
case 'p': permanent = true; break;
case 'n': wm_name = optarg; break;
case 'n': wm_name = strdup(optarg); break;
case 'b': topbar = false; break;
case 'd': dock = true; break;
case 'f': font_load(optarg); break;
@ -1482,6 +1490,8 @@ main (int argc, char **argv)
// Do the heavy lifting
init(wm_name);
// The string is strdup'd when the command line arguments are parsed
free(wm_name);
// Get the fd to Xserver
pollin[1].fd = xcb_get_file_descriptor(c);
for (;;) {
@ -1518,8 +1528,8 @@ main (int argc, char **argv)
area_t *area = area_get(press_ev->event, press_ev->detail, press_ev->event_x);
// Respond to the click
if (area) {
write(STDOUT_FILENO, area->cmd, strlen(area->cmd));
write(STDOUT_FILENO, "\n", 1);
(void)write(STDOUT_FILENO, area->cmd, strlen(area->cmd));
(void)write(STDOUT_FILENO, "\n", 1);
}
}
break;