mirror of
https://github.com/swaywm/sway.git
synced 2024-11-30 03:41:27 +00:00
Add check for nvidia module and warn user
This commit is contained in:
parent
47c7ed9f3a
commit
4ef60e7c09
19
sway/main.c
19
sway/main.c
|
@ -8,6 +8,7 @@
|
||||||
#include "layout.h"
|
#include "layout.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "readline.h"
|
||||||
#include "handlers.h"
|
#include "handlers.h"
|
||||||
#include "ipc.h"
|
#include "ipc.h"
|
||||||
#include "sway.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) {
|
int main(int argc, char **argv) {
|
||||||
static int verbose = 0, debug = 0, validate = 0;
|
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);
|
wlc_log_set_handler(wlc_log_handler);
|
||||||
|
|
||||||
|
detect_nvidia();
|
||||||
|
|
||||||
/* Changing code earlier than this point requires detailed review */
|
/* Changing code earlier than this point requires detailed review */
|
||||||
if (!wlc_init(&interface, argc, argv)) {
|
if (!wlc_init(&interface, argc, argv)) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
Loading…
Reference in a new issue