#!/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 )