blob: 2094f544b378e999cf686654b4e20870e1082342 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
)
|