1
1
mirror of https://github.com/swaywm/sway synced 2024-11-18 23:14:03 +01:00
sway/swaybg/main.c

40 lines
736 B
C
Raw Normal View History

#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
2015-11-28 14:49:02 +01:00
#include <string.h>
#include <time.h>
#include <wayland-client.h>
#include <wlr/util/log.h>
enum scaling_mode {
SCALING_MODE_STRETCH,
2015-11-25 19:52:34 +01:00
SCALING_MODE_FILL,
2015-11-25 21:26:21 +01:00
SCALING_MODE_FIT,
SCALING_MODE_CENTER,
2015-11-25 20:07:34 +01:00
SCALING_MODE_TILE,
};
bool is_valid_color(const char *color) {
int len = strlen(color);
if (len != 7 || color[0] != '#') {
wlr_log(L_ERROR, "%s is not a valid color for swaybg. "
"Color should be specified as #rrggbb (no alpha).", color);
return false;
}
int i;
for (i = 1; i < len; ++i) {
if (!isxdigit(color[i])) {
return false;
}
}
return true;
}
2015-11-25 15:53:02 +01:00
int main(int argc, const char **argv) {
wlr_log_init(L_DEBUG, NULL);
return 0;
}