This commit is contained in:
Rakarake 2025-12-27 17:42:01 +01:00
parent 1e0c44cc3d
commit 3de9bcea6b
4 changed files with 19 additions and 80 deletions

View file

@ -28,22 +28,26 @@ double time_since_start() {
int main(int argc, char *argv[]) {
char *shader_path = NULL;
int output_type = OUTPUT_WINDOW;
if (argc >= 2) {
shader_path = argv[1];
} else {
printf("need to supply path to shader\n");
exit(1);
}
if (argc >= 3) {
// xdg toplevel window (window) or wlr_layer_shell window (layer)
if (strcmp(argv[2], "window") == 0) {
// syntax: --window for a normal window or --layer for a wallpaper
for (int i = 1; i < argc; i++) {
if (strncmp("--window", argv[i], strlen("--window")) == 0) {
output_type = OUTPUT_WINDOW;
} else if (strcmp(argv[2], "layer") == 0) {
output_type = OUTPUT_LAYER;
} else {
printf("argument 2 is either 'window' or 'layer' 🍰\n");
return 1;
}
else if (strncmp("--layer", argv[i], strlen("--layer")) == 0) {
output_type = OUTPUT_LAYER;
}
else {
// path to fragment shader
if (shader_path != NULL) {
fprintf(stderr, "tried supplying '%s' as a shader file while one has already been selected\n", argv[i]);
return 1;
}
shader_path = argv[i];
}
}
if (shader_path == NULL) {
printf("need to supply path to shader\n");
return 1;
}
struct client_state state;