From 65c919256369be5efba689a707035bf4038f4ebe Mon Sep 17 00:00:00 2001 From: jaydee Date: Tue, 21 Oct 2025 20:05:08 +0200 Subject: [PATCH] klal --- roles/mqtt-srv/files/get_monitors.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 roles/mqtt-srv/files/get_monitors.sh diff --git a/roles/mqtt-srv/files/get_monitors.sh b/roles/mqtt-srv/files/get_monitors.sh new file mode 100644 index 0000000..5d4958c --- /dev/null +++ b/roles/mqtt-srv/files/get_monitors.sh @@ -0,0 +1,24 @@ +#!/bin/bash +rm /tmp/monitors.txt +while read -r output hex conn; do + [[ -z "$conn" ]] && conn=${output%%-*} + echo "$output;$(xxd -r -p <<< "$hex")">>/tmp/monitors.txt + +done < <(xrandr --prop | awk ' + !/^[ \t]/ { + if (output && hex) print output, hex, conn + output=$1 + hex="" + } + /ConnectorType:/ {conn=$2} + /[:.]/ && h { + sub(/.*000000fc00/, "", hex) + hex = substr(hex, 0, 26) "0a" + sub(/0a.*/, "", hex) + h=0 + } + h {sub(/[ \t]+/, ""); hex = hex $0} + /EDID.*:/ {h=1} + END {if (output && hex) print output, hex, conn} + ' | sort +)