further work on de-p1st-rotate (2)

This commit is contained in:
Daniel Langbein 2021-06-17 17:30:28 +02:00
parent 291fe5482c
commit e427b6420c
3 changed files with 11 additions and 9 deletions

View File

@ -2,7 +2,7 @@
_pkgname=rotate
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.0.8
pkgver=0.0.9
pkgrel=1
pkgdesc="Scripts to automate screen rotation"
arch=('any')

View File

@ -8,12 +8,15 @@ if [ "$#" -gt "1 " ] || [ "${1}" = "-h" ] || [ "${1}" = "--help" ] ; then
- Manually specify orientation:
${0} ORIENTATION
- Automatically detect orientation:
${0}";
${0}" >&2;
exit 1;
fi
if [ -z "${1}" ]; then
ORIENTATION="$(/usr/lib/de-p1st-rotate/get-orientation)" || exit $?
ORIENTATION="$(/usr/lib/de-p1st-rotate/get-orientation)" || {
echo "Could not get orientation: ${ORIENTATION}" >&2;
exit 1;
}
else
ORIENTATION="$1"
fi
@ -22,18 +25,18 @@ fi
# if e.g. the given output "$SCREEN" does not exist.
# Thus we check if $SCREEN is valid with grep:
xrandr --listmonitors | grep --quiet "\s${SCREEN}\$" || {
echo "The given screen ${SCREEN} does not exist.";
echo "The given screen ${SCREEN} does not exist." >&2;
exit 1;
}
xrandr --output "${SCREEN}" --rotate "${ORIENTATION}" || {
echo "Could not rotate ${SCREEN}!";
echo "Could not rotate ${SCREEN}!" >&2;
exit 1;
}
for i in "${DEVICES[@]}"; do
xinput --map-to-output "${i}" "${SCREEN}" || {
echo "Could not map device ${i} to screen ${SCREEN}! Please check output of 'xinput'.";
echo "Could not map device ${i} to screen ${SCREEN}! Please check output of 'xinput'." >&2;
FAILURE=true
}
done

View File

@ -24,12 +24,11 @@ case "${ORIENTATION_STR}" in
ORIENTATION="left";
;;
*": undefined"*)
echo "The orientation could not yet be determined. Please rotate the device a bit and try again."
echo "The orientation could not yet be determined. Please rotate the device a bit and try again." >&2;
exit 1;
;;
*)
echo "Could not parse ORIENTATION_STR!";
echo "${ORIENTATION_STR}";
echo "Could not parse ORIENTATION_STR: ${ORIENTATION_STR}" >&2;
exit 1;
esac