Spawn swaynag as a wayland client

This spawns swaynag as a wayland client similar to how swaybar and
swaybg are already done
This commit is contained in:
Brian Ashworth 2019-04-14 00:27:47 -04:00 committed by Simon Ser
parent 8c69da11bb
commit 6961bf2e4c
8 changed files with 147 additions and 71 deletions

View file

@ -1,6 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
#include <fcntl.h>
#include <stdbool.h>
#include <string.h>
#include <sys/socket.h>
@ -488,24 +487,6 @@ static void handle_swaybg_client_destroy(struct wl_listener *listener,
config->swaybg_client = NULL;
}
static bool set_cloexec(int fd, bool cloexec) {
int flags = fcntl(fd, F_GETFD);
if (flags == -1) {
sway_log_errno(SWAY_ERROR, "fcntl failed");
return false;
}
if (cloexec) {
flags = flags | FD_CLOEXEC;
} else {
flags = flags & ~FD_CLOEXEC;
}
if (fcntl(fd, F_SETFD, flags) == -1) {
sway_log_errno(SWAY_ERROR, "fcntl failed");
return false;
}
return true;
}
static bool _spawn_swaybg(char **command) {
if (config->swaybg_client != NULL) {
wl_client_destroy(config->swaybg_client);