diff options
-rw-r--r-- | sway/main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c index 9c7f21b3..20738307 100644 --- a/sway/main.c +++ b/sway/main.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "layout.h" | 8 | #include "layout.h" |
9 | #include "config.h" | 9 | #include "config.h" |
10 | #include "log.h" | 10 | #include "log.h" |
11 | #include "readline.h" | ||
11 | #include "handlers.h" | 12 | #include "handlers.h" |
12 | #include "ipc.h" | 13 | #include "ipc.h" |
13 | #include "sway.h" | 14 | #include "sway.h" |
@@ -31,6 +32,22 @@ static void wlc_log_handler(enum wlc_log_type type, const char *str) { | |||
31 | } | 32 | } |
32 | } | 33 | } |
33 | 34 | ||
35 | void detect_nvidia() { | ||
36 | FILE *f = fopen("/proc/modules", "r"); | ||
37 | if (!f) { | ||
38 | return; | ||
39 | } | ||
40 | while (!feof(f)) { | ||
41 | char *line = read_line(f); | ||
42 | if (strstr(line, "nvidia")) { | ||
43 | fprintf(stderr, "\x1B[1;31mWarning: Proprietary nvidia drivers do NOT support Wayland. Use nouveau.\x1B[0m\n"); | ||
44 | free(line); | ||
45 | return; | ||
46 | } | ||
47 | free(line); | ||
48 | } | ||
49 | } | ||
50 | |||
34 | int main(int argc, char **argv) { | 51 | int main(int argc, char **argv) { |
35 | static int verbose = 0, debug = 0, validate = 0; | 52 | static int verbose = 0, debug = 0, validate = 0; |
36 | 53 | ||
@@ -51,6 +68,8 @@ int main(int argc, char **argv) { | |||
51 | 68 | ||
52 | wlc_log_set_handler(wlc_log_handler); | 69 | wlc_log_set_handler(wlc_log_handler); |
53 | 70 | ||
71 | detect_nvidia(); | ||
72 | |||
54 | /* Changing code earlier than this point requires detailed review */ | 73 | /* Changing code earlier than this point requires detailed review */ |
55 | if (!wlc_init(&interface, argc, argv)) { | 74 | if (!wlc_init(&interface, argc, argv)) { |
56 | return 1; | 75 | return 1; |