further work on de-p1st-rotate

This commit is contained in:
Daniel Langbein 2021-06-17 17:20:23 +02:00
parent 743cf91312
commit 2c09337e61
4 changed files with 18 additions and 8 deletions

View File

@ -2,7 +2,7 @@
_pkgname=rotate
_reponame=arch
pkgname="de-p1st-$_pkgname"
pkgver=0.0.6
pkgver=0.0.7
pkgrel=1
pkgdesc="Scripts to automate screen rotation"
arch=('any')
@ -17,7 +17,7 @@ package() {
cd "${_reponame}/pkg/${pkgname}"
install -Dm0555 usr/bin/de-p1st-rotate-screen "$pkgdir"/usr/bin/de-p1st-rotate-screen
install -Dm0555 usr/bin/de-p1st-auto-rotate "$pkgdir"/usr/bin/de-p1st-auto-rotate
install -Dm0644 -o0 etc/de-p1st-rotate/config.cfg "$pkgdir"/etc/de-p1st-rotate/config.cfg
install -Dm0644 -o0 usr/lib/de-p1st-rotate/get-orientation "$pkgdir"/usr/lib/de-p1st-rotate/get-orientation
install -Dm0644 -o0 etc/de-p1st-rotate/config.cfg "$pkgdir"/etc/de-p1st-rotate/config.cfg
}

View File

@ -0,0 +1,3 @@
#!/bin/bash
de-p1st-rotate-screen

View File

@ -3,12 +3,20 @@
# @post: $SCREEN variable and $DEVICES array are set
source /etc/de-p1st-rotate/config.cfg || exit $?
if [ "$#" -ne "1" ]; then
echo "usage: $0 ORIENTATION";
if [ "$#" -gt "1 " ] || [ "${1}" = "-h" ] || [ "${1}" = "--help" ] ; then
echo "usage:
- Manually specify orientation:
${0} ORIENTATION
- Automatically detect orientation:
${0}";
exit 1;
fi
ORIENTATION="$1"
if [ -z "${1}" ]; then
ORIENTATION="$(/usr/lib/de-p1st-rotate/get-orientation)" || exit $?
else
ORIENTATION="$1"
fi
# "xrandr ... || exit 1" does not work to check if $SCREEN exists.
# if e.g. the given output "$SCREEN" does not exist.

View File

@ -33,5 +33,4 @@ case "${ORIENTATION_STR}" in
exit 1;
esac
# echo "Detected device orientation ${ORIENTATION}"
de-p1st-rotate-screen "${ORIENTATION}"
echo "${ORIENTATION}"