diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-09-02 11:46:21 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-09-02 11:46:21 -0400 |
commit | 4ef60e7c094e3d27a068d0ae94d40dbefd38cfac (patch) | |
tree | fa1899f4e6d9d5dd5f9d44be77e420f6eebc1528 | |
parent | 47c7ed9f3aed759ed73a32657e9dba8e3a519b26 (diff) |
Add check for nvidia module and warn user
-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 @@ #include "layout.h" #include "config.h" #include "log.h" +#include "readline.h" #include "handlers.h" #include "ipc.h" #include "sway.h" @@ -31,6 +32,22 @@ static void wlc_log_handler(enum wlc_log_type type, const char *str) { } } +void detect_nvidia() { + FILE *f = fopen("/proc/modules", "r"); + if (!f) { + return; + } + while (!feof(f)) { + char *line = read_line(f); + if (strstr(line, "nvidia")) { + fprintf(stderr, "\x1B[1;31mWarning: Proprietary nvidia drivers do NOT support Wayland. Use nouveau.\x1B[0m\n"); + free(line); + return; + } + free(line); + } +} + int main(int argc, char **argv) { static int verbose = 0, debug = 0, validate = 0; @@ -51,6 +68,8 @@ int main(int argc, char **argv) { wlc_log_set_handler(wlc_log_handler); + detect_nvidia(); + /* Changing code earlier than this point requires detailed review */ if (!wlc_init(&interface, argc, argv)) { return 1; |