mirror of
https://codeberg.org/privacy1st/arch
synced 2024-12-23 01:16:04 +01:00
further work on de-p1st-rotate (2)
This commit is contained in:
parent
291fe5482c
commit
e427b6420c
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user