diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-18 19:23:34 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-18 19:23:34 +0900 |
commit | 1f83ff6927841f3f48363b59d8c4bc22247f7943 (patch) | |
tree | c2204c0694eabc35503881c8d73d87d008674e05 /src | |
parent | b48f40f863c80c9f8394cfd5e8c3716191611888 (diff) |
GPU情報の追加
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu.c | 28 | ||||
-rw-r--r-- | src/gpu.h | 6 | ||||
-rw-r--r-- | src/logo/openbsd.h | 1 |
3 files changed, 35 insertions, 0 deletions
diff --git a/src/gpu.c b/src/gpu.c new file mode 100644 index 0000000..168fe23 --- /dev/null +++ b/src/gpu.c @@ -0,0 +1,28 @@ +#include "gpu.h" + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> + +void run_gpu_command(const char *command) { + char buf[128]; + + FILE *p = popen(command, "r"); + if (!p) { + fprintf(stderr, "GPUコマンドを実効に失敗: %s", command); + return; + } + + while (fgets(buf, sizeof(buf), p) != NULL) { + buf[strcspn(buf, "\n")] = '\0'; + printf("%s", buf); + } + + pclose(p); +} + +void display_gpu() { + run_gpu_command("glxinfo -B | grep -F 'OpenGL renderer string' | " + "sed 's/OpenGL renderer string: //' | sed 's/Mesa //' | " + "sed 's/DRI //' | sed 's/(R)//' | sed 's/(.*$//'"); +} diff --git a/src/gpu.h b/src/gpu.h new file mode 100644 index 0000000..0db6e79 --- /dev/null +++ b/src/gpu.h @@ -0,0 +1,6 @@ +#ifndef GPU_H +#define GPU_H + +void display_gpu(); + +#endif diff --git a/src/logo/openbsd.h b/src/logo/openbsd.h index bbd4df4..4c6c2c5 100644 --- a/src/logo/openbsd.h +++ b/src/logo/openbsd.h @@ -43,5 +43,6 @@ YELLOW " / \\ / " RESET, YELLOW " /-_____-\\ " RESET, YELLOW " " RESET, YELLOW " " RESET, +YELLOW " " RESET, YELLOW " " RESET }; |