main/postmarketos-base-ui-cage: automatically rotate panel (MR 5121)
[ci:skip-build]: already built successfully in CI
This commit is contained in:
parent
e0ff1e478c
commit
2db5ff27fc
5 changed files with 57 additions and 20 deletions
|
@ -2,8 +2,8 @@
|
|||
# Maintainer: Vitaliy Ognev <vitaliy.ognev@gmail.com>
|
||||
pkgname=device-powkiddy-x55
|
||||
pkgdesc="Powkiddy X55"
|
||||
pkgver=3
|
||||
pkgrel=1
|
||||
pkgver=4
|
||||
pkgrel=0
|
||||
url="https://postmarketos.org"
|
||||
license="MIT"
|
||||
arch="aarch64"
|
||||
|
@ -16,11 +16,7 @@ depends="
|
|||
u-boot-powkiddy-x55
|
||||
"
|
||||
makedepends="devicepkg-dev"
|
||||
source="
|
||||
cage-ui-powkiddy-x55-rotate.sh
|
||||
deviceinfo
|
||||
"
|
||||
subpackages="$pkgname-cage-ui-addons:cage_ui_addons:noarch"
|
||||
source="deviceinfo"
|
||||
_pmb_recommends="powkiddy-x55-mapper"
|
||||
|
||||
build() {
|
||||
|
@ -31,14 +27,6 @@ package() {
|
|||
devicepkg_package $startdir $pkgname
|
||||
}
|
||||
|
||||
cage_ui_addons() {
|
||||
pkgdesc="Cage-UI addons for powkiddy x55"
|
||||
install_if="$pkgname=$pkgver-r$pkgrel postmarketos-base-ui-cage"
|
||||
|
||||
install -Dm644 "$srcdir"/cage-ui-powkiddy-x55-rotate.sh -t "$subpkgdir"/etc/cage-ui/
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
a22986cab90dd8641956e19f8139e1cb7f24a349cb2907cadb0001b0f5ff9be67b7fa717502f3b078ea8db62eb0fdb8de20e35495b4e4db69c0940dcac04996d cage-ui-powkiddy-x55-rotate.sh
|
||||
71efac86cba6e1982b0557636b08c050da9adcc98ecfa8d91ad96843994434d0e09a0af8094f103c88314a07a20962cad58f05c38109b887399b84b324cb05f1 deviceinfo
|
||||
"
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
wlr-randr --output DSI-1 --transform 90
|
|
@ -1,7 +1,7 @@
|
|||
# Maintainer: Vitaliy Ognev <vitaliy.ognev@gmail.com>
|
||||
# Co-Maintainer: Jenneron <jenneron@protonmail.com>
|
||||
pkgname=postmarketos-base-ui-cage
|
||||
pkgver=1
|
||||
pkgver=2
|
||||
pkgrel=0
|
||||
pkgdesc="Meta package for shared configuration for cage UIs"
|
||||
arch="all"
|
||||
|
@ -10,11 +10,13 @@ license="GPL-3.0-or-later"
|
|||
source="
|
||||
cage-ui.desktop
|
||||
cage-ui-session.sh
|
||||
cage-ui-autorotate.sh
|
||||
"
|
||||
install="$pkgname.post-install $pkgname.post-upgrade"
|
||||
options="!check"
|
||||
depends="
|
||||
dnsmasq
|
||||
drm_info
|
||||
postmarketos-base-ui
|
||||
postmarketos-base-ui-networkmanager
|
||||
wpa_supplicant
|
||||
|
@ -30,14 +32,17 @@ depends="
|
|||
psmisc
|
||||
tinydm
|
||||
tinydm-openrc
|
||||
jq
|
||||
"
|
||||
|
||||
package() {
|
||||
install -Dm755 "$srcdir"/cage-ui-session.sh -t "$pkgdir"/usr/share/cage-ui/
|
||||
install -Dm755 "$srcdir"/cage-ui-autorotate.sh -t "$pkgdir"/usr/share/cage-ui/
|
||||
install -Dm644 "$srcdir"/cage-ui.desktop -t "$pkgdir"/usr/share/wayland-sessions/
|
||||
}
|
||||
|
||||
sha512sums="
|
||||
b556bcff9bb62ca6580da5e1749aa4d6b8244ebb5213292a348075196704cc919f8060bff8da66c6f61a1aa071b7ae4d81fddf1b3747e89809196459bc2595d8 cage-ui.desktop
|
||||
15c3dd09cfd36e42c102c0c6065e47a7c67f9cc12fea641758e88b93e146b3b549bf5828191816ceaf35222c417fbb4b31173d6c4e9003fd23c834aa9b9f985e cage-ui-session.sh
|
||||
828ed29db77b759a1a5591a3723544b2d65c1760ec9cecc33542945a6d096667746e5fc65c6bce8dbc38a26066f31f79c8b8f608d2ea9f29741d04a28bfb841d cage-ui-session.sh
|
||||
47f25992c96486bd2840bd5b549a800ab524090e43234765c8ce4e0cc9ff4dc9f07f8f4883f5a378b5e0bbdf845d99da992b6d26fca8fffb5ed860a06cb32788 cage-ui-autorotate.sh
|
||||
"
|
||||
|
|
45
main/postmarketos-base-ui-cage/cage-ui-autorotate.sh
Normal file
45
main/postmarketos-base-ui-cage/cage-ui-autorotate.sh
Normal file
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ueo pipefail
|
||||
|
||||
CONNECTORS=$(drm_info -j 2>/dev/null | jq -rc '[.[].connectors | .[] | select( .status == 1 )]')
|
||||
|
||||
while read -r CONNECTOR ; do
|
||||
CONNECTOR_ID=$(echo "$CONNECTOR" | jq -rc '.id')
|
||||
[ "null" == "$CONNECTOR_ID" ] && continue
|
||||
|
||||
ROTATION=$(echo "$CONNECTOR" | jq -rc '.properties."panel orientation"')
|
||||
[ "null" == "$ROTATION" ] && continue
|
||||
|
||||
ROTATION_VALUE=$(echo "$ROTATION" | jq -rc '.value')
|
||||
[ "null" == "$ROTATION_VALUE" ] && continue
|
||||
|
||||
ROTATION_LABEL=$(echo "$ROTATION" | jq -rc '.spec | .[] | select( .value == '$ROTATION_VALUE' ) | .name')
|
||||
[ "null" == "$ROTATION_LABEL" ] && continue
|
||||
|
||||
OUTPUT_NAME=none
|
||||
for CONN_ID in /sys/class/drm/*/connector_id; do
|
||||
if [ "$CONNECTOR_ID" == $(cat $CONN_ID) ]; then
|
||||
OUTPUT_NAME=$(dirname "$CONN_ID")
|
||||
OUTPUT_NAME=${OUTPUT_NAME#*/card?-}
|
||||
fi
|
||||
done
|
||||
[ "none" == "$OUTPUT_NAME" ] && continue
|
||||
|
||||
case "$ROTATION_LABEL" in
|
||||
"Normal")
|
||||
;;
|
||||
"Upside Down")
|
||||
wlr-randr --output "$OUTPUT_NAME" --transform 180
|
||||
;;
|
||||
"Left Side Up")
|
||||
wlr-randr --output "$OUTPUT_NAME" --transform 90
|
||||
;;
|
||||
"Right Side Up")
|
||||
wlr-randr --output "$OUTPUT_NAME" --transform 270
|
||||
;;
|
||||
*)
|
||||
echo "Connector $CONNECTOR_ID: Unsupported rotation: $ROTATION_LABEL"
|
||||
;;
|
||||
esac
|
||||
done < <(echo "$CONNECTORS" | jq -rc .[])
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
. /usr/share/cage-ui/cage-ui-autorotate.sh
|
||||
|
||||
if [ -d /etc/cage-ui ]; then
|
||||
for script in /etc/cage-ui/*.sh; do
|
||||
# shellcheck source=/dev/null # since we do not control these scripts
|
||||
|
|
Loading…
Reference in a new issue