summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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 "