Skip to content
Permalink
7a713c4089
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 28 lines (22 sloc) 511 Bytes
#!/usr/bin/env bash
set -eu -o pipefail
shopt -s nullglob lastpipe
export LC_ALL=C
function fingerprint-outputs {
local out h
for out in /sys/class/drm/card0-*; do
if [[ "$(< "$out"/status)" == "connected" ]]; then
echo "$out"
xxd -p "$out"/edid
fi
done | md5sum -b | read -r h _
printf "%s\n" "$h"
}
fingerprint=$(fingerprint-outputs)
if [[ -f ~/bin/.xlayout/"$fingerprint" ]]; then
~/bin/.xlayout/"$fingerprint"
elif [[ "${1-}" ]]; then
"$1"
else
echo "unknown layout: $fingerprint"
fi