river version as status when empty
This commit is contained in:
parent
af72852c7a
commit
9878cd0721
1 changed files with 26 additions and 0 deletions
26
dam.c
26
dam.c
|
@ -77,6 +77,7 @@ static struct zriver_seat_status_v1 *seat_status;
|
||||||
static struct wl_list bars;
|
static struct wl_list bars;
|
||||||
static Bar *selbar;
|
static Bar *selbar;
|
||||||
static char stext[256];
|
static char stext[256];
|
||||||
|
static char river_version[14];
|
||||||
static char *mode;
|
static char *mode;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
@ -114,6 +115,26 @@ die(const char *fmt, ...)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
river_version_setup(void)
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
FILE *fp;
|
||||||
|
|
||||||
|
if (!(fp = popen("river -version", "r")))
|
||||||
|
die("popen:");
|
||||||
|
|
||||||
|
p = fgets(river_version, sizeof(river_version) - 1, fp);
|
||||||
|
if (pclose(fp) < 0)
|
||||||
|
die("pclose:");
|
||||||
|
if (!p)
|
||||||
|
die("no river version read");
|
||||||
|
|
||||||
|
river_version[strcspn(river_version, "\n")] = 0;
|
||||||
|
memmove(p + 6, p, strlen(p) + 1);
|
||||||
|
memcpy(p, "river ", 6);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_color(uint32_t *dest, const char *src)
|
parse_color(uint32_t *dest, const char *src)
|
||||||
{
|
{
|
||||||
|
@ -287,6 +308,9 @@ bars_draw(void)
|
||||||
{
|
{
|
||||||
Bar *bar;
|
Bar *bar;
|
||||||
|
|
||||||
|
if (stext[0] == '\0')
|
||||||
|
strcpy(stext, river_version);
|
||||||
|
|
||||||
wl_list_for_each(bar, &bars, link)
|
wl_list_for_each(bar, &bars, link)
|
||||||
if (bar->drw) /* called before initial bars setup */
|
if (bar->drw) /* called before initial bars setup */
|
||||||
bar_draw(bar);
|
bar_draw(bar);
|
||||||
|
@ -705,6 +729,8 @@ setup(void)
|
||||||
if (!compositor || !shm || !layer_shell || !status_manager || !control || !seat)
|
if (!compositor || !shm || !layer_shell || !status_manager || !control || !seat)
|
||||||
die("unsupported compositor");
|
die("unsupported compositor");
|
||||||
|
|
||||||
|
river_version_setup();
|
||||||
|
|
||||||
sigemptyset(&mask);
|
sigemptyset(&mask);
|
||||||
sigaddset(&mask, SIGUSR1);
|
sigaddset(&mask, SIGUSR1);
|
||||||
sigaddset(&mask, SIGTERM);
|
sigaddset(&mask, SIGTERM);
|
||||||
|
|
Loading…
Add table
Reference in a new issue