This commit is contained in:
Squibid 2025-11-23 17:31:47 -05:00
parent 8537a9a127
commit 1a764d6a14
Signed by: squibid
GPG key ID: BECE5684D3C4005D
9 changed files with 332 additions and 329 deletions

View file

@ -1,3 +1,4 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -12,18 +13,18 @@ char
config_path = NULL;
if ((path = getenv("XDG_CONFIG_HOME"))) {
config_path = calloc(
strlen(path) + strlen("/wom/init.lua") + 1,
sizeof(char)
);
config_path = strcat(path, "/wom/init.lua");
} else if ((path = getenv("HOME"))) {
config_path = calloc(
strlen(path) + strlen("/.config/wom/init.lua") + 1,
sizeof(char)
);
config_path = strcat(path, "/.config/wom/init.lua");
if ((path = strdup(getenv("XDG_CONFIG_HOME")))) {
size_t len = strlen(path) + strlen("/wom/init.lua") + 1;
config_path = calloc(len, sizeof(char));
if (config_path) {
snprintf(config_path, len, "%s%s", path, "/wom/init.lua");
}
} else if ((path = strdup(getenv("HOME")))) {
size_t len = strlen(path) + strlen("/.config/wom/init.lua") + 1;
config_path = calloc(len, sizeof(char));
if (config_path) {
snprintf(config_path, len, "%s%s", path, "/wom/init.lua");
}
}
return config_path;

View file

@ -9,6 +9,7 @@
#include <cargs.h>
#include "conf.h"
#include "log.h"
#include "lua/wom.h"
#include "lua/wom_fs.h"
#include "subcmds.h"

View file

@ -89,13 +89,14 @@ subcmds_dev(void *, int argc, char *argv[])
strcat(wpath, "dev");
editor = getenv("EDITOR");
puts(getenv("XDG_CONFIG_DIR"));
return;
if (editor) {
execvp(editor, (char *[]){ editor, wpath, NULL });
goto free_stuff;
}
printf("Failed to open editor\n");
free_stuff:
free(editor);
free(wpath);
} else if (strcmp(argv[1], "help") == 0 || strcmp(argv[1], "h") == 0) {
printf("Help text\n");