Micron Document
config snippets: rotate screen for ppkb

I call this script on startup to rotate the display when the keyboard is attached. I'll probably replace the name with a variable and move it to the settings file, but for now it's hard coded.

T383838rotate.sh:

T282828
T8b949e#!/bin/bash
. ~/bin/settings.sh

rotate_rightTff7b72(Tff7b72) Tff7b72{
xrandr -o right
xinput set-prop Ta5d6ff"pointer:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff0 T79c0ff1 T79c0ff0 -1 T79c0ff0 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff1
xinput set-prop Ta5d6ff"keyboard:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff0 T79c0ff1 T79c0ff0 -1 T79c0ff0 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff1
Tff7b72}

rotate_leftTff7b72(Tff7b72) Tff7b72{
xrandr -o left
xinput set-prop Ta5d6ff"pointer:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff0 -1 T79c0ff1 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1
xinput set-prop Ta5d6ff"keyboard:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff0 -1 T79c0ff1 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1
Tff7b72}

rotate_normalTff7b72(Tff7b72) Tff7b72{
xrandr -o normal
xinput set-prop Ta5d6ff"pointer:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1
xinput set-prop Ta5d6ff"keyboard:Goodix Capacitive TouchScreen" --typeTff7b72=float Ta5d6ff"Coordinate Transformation Matrix" T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1 T79c0ff0 T79c0ff0 T79c0ff0 T79c0ff1
Tff7b72}

Tff7b72if is_kb_present Tb4b4b4; Tff7b72then
rotate_right
Tff7b72fi


T383838settings.sh:

T282828
T8b949e#!/bin/bash
T8b949e#
T8b949e# Some common settings about the hafl env on pinephone.
T8b949e#

T8b949e##
T8b949e# 0 exit when more than the internal battery is present
is_kb_presentTff7b72(Tff7b72) Tff7b72{
Tffa657local Te6edf3BATTERIESTff7b72=Tff7b72( Tff7b72$(ls -d /sys/class/power_supply/*-batteryTff7b72) Tff7b72)
Tffa657test Tffd700${#Te6edf3BATTERIESTb4b4b4[@]Tffd700} -gt T79c0ff1
Tff7b72}


Tags: pinephone, pinephonepro

Tags
Navigation
Backlinks


created: 2023-02-15

(re)generated: 2026-07-17