add alternative fingerprinting method
This commit is contained in:
parent
016e1ceef5
commit
f8ffa38ffa
18
autorandr
18
autorandr
|
@ -42,13 +42,24 @@ CHANGE_PROFILE=0
|
|||
DEFAULT_PROFILE=""
|
||||
SAVE_PROFILE=""
|
||||
|
||||
setup_fp() {
|
||||
setup_fp_edid() {
|
||||
$XRANDR -q --verbose | awk '
|
||||
/^[^ ]+ (dis)?connected / { DEV=$1; ID[DEV] = ""; }
|
||||
$1 ~ /^[a-f0-9]+$/ { ID[DEV] = ID[DEV] $1 }
|
||||
END { for (X in ID) { print X " " ID[X]; } }'
|
||||
}
|
||||
|
||||
setup_fp_dim() {
|
||||
$XRANDR -q --verbose | awk '
|
||||
/^[^ ]+ connected / { CONNECTED=1 }
|
||||
/^[^ ]+ disconnected / { CONNECTED=0 }
|
||||
/^[^ ]+ (dis)?connected / \
|
||||
&& match($0, "([0-9]+mm) x ([0-9]+mm)", A) {
|
||||
print $1, (CONNECTED==1 ? A[1]"x"A[2] : "" )
|
||||
}'
|
||||
}
|
||||
|
||||
|
||||
current_cfg() {
|
||||
$XRANDR -q | awk '
|
||||
/^[^ ]+ disconnected / {
|
||||
|
@ -84,7 +95,7 @@ load() {
|
|||
}
|
||||
|
||||
# process parameters
|
||||
OPTS=$(getopt -n autorandr -o s:l:d:c --long change,default:,save:,load: -- "$@")
|
||||
OPTS=$(getopt -n autorandr -o s:l:d:cf --long change,default:,save:,load:,fingerprint -- "$@")
|
||||
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
|
||||
eval set -- "$OPTS"
|
||||
|
||||
|
@ -94,12 +105,13 @@ while true; do
|
|||
-d|--default) DEFAULT_PROFILE="$2"; shift 2 ;;
|
||||
-s|--save) SAVE_PROFILE="$2"; shift 2 ;;
|
||||
-l|--load) LOAD_PROFILE="$2"; shift 2 ;;
|
||||
--fingerprint) setup_fp_edid; exit 0;;
|
||||
--) shift; break ;;
|
||||
*) echo "Error: $1"; exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
CURRENT_SETUP="$(setup_fp)"
|
||||
CURRENT_SETUP="$(setup_fp_edid)"
|
||||
|
||||
if [ -n "$SAVE_PROFILE" ]; then
|
||||
echo "Saving current configuration as profile '${SAVE_PROFILE}'"
|
||||
|
|
Loading…
Reference in New Issue