Last active
July 19, 2020 15:12
-
-
Save juliangroen/70566dd4723c3bd6c972b241b45f39d9 to your computer and use it in GitHub Desktop.
Bash script to get current resolution values from xrandr. Use -h for horizontal and -v for vertical.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
str=`xrandr | grep '*'` | |
IFS='x' | |
read -ra ADDR <<< "$str" | |
IFS=' ' | |
read -ra ADDR2 <<< "${ADDR[1]}" | |
while getopts 'hv' flag; do | |
case "${flag}" in | |
h) echo "${ADDR[0]:3}" ;; | |
v) echo "${ADDR2[0]}" ;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment