diff options
author | 諏訪子 <suwako@076.moe> | 2024-06-20 00:45:27 +0900 |
---|---|---|
committer | 諏訪子 <suwako@076.moe> | 2024-06-20 00:45:27 +0900 |
commit | f01c5fd8a969e033d31bf606835fe0d32dd5e447 (patch) | |
tree | 859eef9135f013f95052674ef9f2b41de274aab3 /src/resolution.c | |
parent | f7d10e058c16452de087a3774fe6645fc995b61f (diff) |
xrandrがなければ(サーバやGaylord等)、解像度をスキップする
Diffstat (limited to 'src/resolution.c')
-rw-r--r-- | src/resolution.c | 10 |
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 " |