summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author諏訪子 <suwako@076.moe>2024-06-20 00:45:27 +0900
committer諏訪子 <suwako@076.moe>2024-06-20 00:45:27 +0900
commitf01c5fd8a969e033d31bf606835fe0d32dd5e447 (patch)
tree859eef9135f013f95052674ef9f2b41de274aab3 /src
parentf7d10e058c16452de087a3774fe6645fc995b61f (diff)
xrandrがなければ(サーバやGaylord等)、解像度をスキップする
Diffstat (limited to 'src')
-rw-r--r--src/resolution.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/resolution.c b/src/resolution.c
index f089fd2..635bab6 100644
--- a/src/resolution.c
+++ b/src/resolution.c
@@ -1,7 +1,17 @@
#include "resolution.h"
#include "common.h"
+#include <stdio.h>
+#include <string.h>
+
const char *display_resolution() {
+ const char *isexist = run_command_s("which xrandr");
+ if (
+ isexist == NULL ||
+ strlen(isexist) == 0 ||
+ strncmp(isexist, "xrandr not found", strlen("xrandr not found"))
+ ) return NULL;
+
return run_command_s("xrandr --nograb --current | "
"awk -F 'connected |\\\\+|\\\\(' '/ "
"connected.*[0-9]+x[0-9]+\\+/ && $2 {printf $2 "