From 669dc2a61bd22030a6d922616b31af878e6d2f8d Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jun 2019 16:43:06 -0400 Subject: add .local/bin/get-res --- .local/bin/get-res | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 .local/bin/get-res diff --git a/.local/bin/get-res b/.local/bin/get-res new file mode 100755 index 0000000..2094f54 --- /dev/null +++ b/.local/bin/get-res @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Copyright 2019 Luke Shumaker + +( + export LC_ALL=C +xrandr | sed -rn -e 's@(.*) connected( .*)? ([0-9]+)x([0-9]+)\+([0-9]+)\+([0-9]+)( .*)? ([0-9]+)mm x ([0-9]+)mm( .*)?@\1 \3 \4@p' +# 1 2 3 4 5 6 7 8 9 10 +# `-outputName | `-fb_xpx `-fb_ypx `-fb_xoff `-fb_yoff `- hw_xmm `- hw_ymm | +# `-discard `- discard `- discard +) | ( + case $# in + 0) + cat + ;; + 1) + while read -r output x y; do + if [[ $output == "$1" ]]; then + printf '%s %s\n' "$x" "$y" + fi + done + ;; + *) + echo 'Usage: get-res [OUTPUT]' >&2 + exit 2 + ;; + esac +) -- cgit v1.1-4-g5e80