aboutsummaryrefslogtreecommitdiffstats
path: root/sway/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/main.c')
-rw-r--r--sway/main.c39
1 files changed, 37 insertions, 2 deletions
diff --git a/sway/main.c b/sway/main.c
index e6a5b851..ab687b17 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -1,6 +1,41 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h>
3#include <stdbool.h>
4#include <wlc/wlc.h>
5#include "config.h"
2 6
3int main() { 7struct sway_config *config;
4 printf("Hello world\n"); 8
9bool load_config() {
10 // TODO: Allow use of more config file locations
11 const char *name = "/.i3/config";
12 const char *home = getenv("HOME");
13 char *temp = malloc(strlen(home) + strlen(name) + 1);
14 strcpy(temp, home);
15 strcat(temp, name);
16 FILE *f = fopen(temp, "r");
17 if (!f) {
18 fprintf(stderr, "Unable to open %s for reading", temp);
19 free(temp);
20 exit(1);
21 }
22 free(temp);
23 config = read_config(f);
24 fclose(f);
25 return true;
26}
27
28int main(int argc, char **argv) {
29 if (!load_config()) {
30 return 0;
31 }
32 return 0;
33 // TODO:
34
35 static struct wlc_interface interface = { };
36 if (!wlc_init(&interface, argc, argv)) {
37 return 1;
38 }
39 wlc_run();
5 return 0; 40 return 0;
6} 41}