Initial dotfiles for GPD Pocket 3
Tracks auto-rotation daemon, display scale, touch/pen calibration, libwacom entry, and system udev/xorg configs for DSI-1 panel setup. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Auto Rotate
|
||||
Comment=Screen auto-rotation for GPD Pocket 3 using accelerometer
|
||||
Exec=/home/tim-evans/.local/bin/auto-rotate
|
||||
Hidden=false
|
||||
NoDisplay=false
|
||||
X-GNOME-Autostart-enabled=true
|
||||
@@ -0,0 +1,29 @@
|
||||
<monitors version="1">
|
||||
<configuration>
|
||||
<clone>no</clone>
|
||||
<output name="DSI-1">
|
||||
<vendor>???</vendor>
|
||||
<product>0x0000</product>
|
||||
<serial>0x00000000</serial>
|
||||
<width>1200</width>
|
||||
<height>1920</height>
|
||||
<rate>60</rate>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<rotation>right</rotation>
|
||||
<reflect_x>no</reflect_x>
|
||||
<reflect_y>no</reflect_y>
|
||||
<primary>yes</primary>
|
||||
</output>
|
||||
<output name="HDMI-1">
|
||||
</output>
|
||||
<output name="DP-1">
|
||||
</output>
|
||||
<output name="DP-2">
|
||||
</output>
|
||||
<output name="DP-3">
|
||||
</output>
|
||||
<output name="DP-4">
|
||||
</output>
|
||||
</configuration>
|
||||
</monitors>
|
||||
Executable
+54
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
# Auto-rotation daemon for GPD Pocket 3
|
||||
# Reads orientation from iio-sensor-proxy via monitor-sensor
|
||||
# Maps to xrandr rotations for DSI-1 (physically portrait panel)
|
||||
|
||||
DISPLAY="${DISPLAY:-:0}"
|
||||
XAUTHORITY="${XAUTHORITY:-/home/tim-evans/.Xauthority}"
|
||||
export DISPLAY XAUTHORITY
|
||||
|
||||
TOUCH="GXTP7380:00 27C6:0113"
|
||||
STYLUS="GXTP7380:00 27C6:0113 Stylus"
|
||||
OUTPUT="DSI-1"
|
||||
|
||||
apply_rotation() {
|
||||
local orient="$1"
|
||||
local xrot touch_matrix
|
||||
|
||||
# CTM = R_left * R_display, because udev/libinput pre-applies R_right.
|
||||
# The CTM must undo the libinput base then apply the current display rotation.
|
||||
case "$orient" in
|
||||
right-up)
|
||||
xrot="right"
|
||||
touch_matrix="1 0 0 0 1 0 0 0 1" # identity (libinput already = right)
|
||||
;;
|
||||
bottom-up)
|
||||
xrot="inverted"
|
||||
touch_matrix="0 1 0 -1 0 1 0 0 1" # R_right
|
||||
;;
|
||||
left-up)
|
||||
xrot="left"
|
||||
touch_matrix="-1 0 1 0 -1 1 0 0 1" # R_inverted (180°)
|
||||
;;
|
||||
normal)
|
||||
xrot="normal"
|
||||
touch_matrix="0 -1 1 1 0 0 0 0 1" # R_left
|
||||
;;
|
||||
*)
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
xrandr --output "$OUTPUT" --rotate "$xrot" --scale 0.64x0.64
|
||||
xinput set-prop "$TOUCH" "Coordinate Transformation Matrix" $touch_matrix
|
||||
xinput set-prop "$STYLUS" "Coordinate Transformation Matrix" $touch_matrix
|
||||
}
|
||||
|
||||
# Apply scale immediately on startup (monitors.xml doesn't persist the transform)
|
||||
xrandr --output "$OUTPUT" --scale 0.64x0.64
|
||||
|
||||
monitor-sensor 2>/dev/null | while IFS= read -r line; do
|
||||
if [[ "$line" =~ "Accelerometer orientation changed: "(.+) ]]; then
|
||||
apply_rotation "${BASH_REMATCH[1]}"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,16 @@
|
||||
# GPD Pocket 3 - Goodix GXTP7380 touch + pen sensor
|
||||
# Vendor: 27C6 (Goodix), Product: 0113
|
||||
|
||||
[Device]
|
||||
Name=GPD Pocket 3 Pen
|
||||
ModelName=GXTP7380
|
||||
DeviceMatch=i2c:27c6:0113
|
||||
Class=ISDV4
|
||||
Width=7
|
||||
Height=5
|
||||
IntegratedIn=Display;System
|
||||
|
||||
[Features]
|
||||
Stylus=true
|
||||
Touch=true
|
||||
Styli=0xfffff;0xffffe;
|
||||
Executable
+48
@@ -0,0 +1,48 @@
|
||||
#!/bin/bash
|
||||
# Install dotfiles by symlinking user-space files and deploying system files.
|
||||
# Run from anywhere; resolves paths relative to this script.
|
||||
|
||||
set -e
|
||||
DOTFILES="$(cd "$(dirname "$0")" && pwd)"
|
||||
HOME_FILES=(
|
||||
".local/bin/auto-rotate"
|
||||
".local/share/libwacom/gpd-pocket3-0113.tablet"
|
||||
".config/autostart/auto-rotate.desktop"
|
||||
".config/monitors.xml"
|
||||
)
|
||||
|
||||
echo "==> Symlinking user files..."
|
||||
for f in "${HOME_FILES[@]}"; do
|
||||
src="$DOTFILES/$f"
|
||||
dst="$HOME/$f"
|
||||
mkdir -p "$(dirname "$dst")"
|
||||
if [ -L "$dst" ] && [ "$(readlink "$dst")" = "$src" ]; then
|
||||
echo " already linked: $dst"
|
||||
elif [ -e "$dst" ]; then
|
||||
echo " backing up existing: $dst -> $dst.bak"
|
||||
mv "$dst" "$dst.bak"
|
||||
ln -s "$src" "$dst"
|
||||
else
|
||||
ln -s "$src" "$dst"
|
||||
echo " linked: $dst"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "==> Deploying system files (requires sudo)..."
|
||||
SYSTEM_FILES=(
|
||||
"etc/udev/rules.d/99-gpd-pocket3-touch.rules"
|
||||
"etc/X11/xorg.conf.d/99-touchscreen.conf"
|
||||
"usr/local/bin/rotate.sh"
|
||||
)
|
||||
for f in "${SYSTEM_FILES[@]}"; do
|
||||
src="$DOTFILES/system/$f"
|
||||
dst="/$f"
|
||||
sudo install -Dm644 "$src" "$dst"
|
||||
echo " installed: $dst"
|
||||
done
|
||||
sudo chmod +x /usr/local/bin/rotate.sh
|
||||
sudo udevadm control --reload-rules
|
||||
|
||||
echo ""
|
||||
echo "Done. Log out and back in (or reboot) to apply autostart changes."
|
||||
@@ -0,0 +1,5 @@
|
||||
Section "InputClass"
|
||||
Identifier "calibration"
|
||||
MatchProduct "GXTP7380"
|
||||
Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1"
|
||||
EndSection
|
||||
@@ -0,0 +1,2 @@
|
||||
ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380:00 27C6:0113", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
|
||||
ACTION=="add", KERNEL=="event[0-9]*", ATTRS{name}=="GXTP7380:00 27C6:0113 Stylus", ENV{LIBINPUT_CALIBRATION_MATRIX}="0 1 0 -1 0 1"
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
# GPD Pocket 3 screen rotation with hotkeys
|
||||
# Cycles: right -> inverted -> left -> normal
|
||||
|
||||
id_touchscreen="16"
|
||||
id_stylus="17"
|
||||
R_0="0 1 0 -1 0 1 0 0 1"
|
||||
R_90="-1 0 1 0 -1 1 0 0 1"
|
||||
R_180="0 -1 1 1 0 0 0 0 1"
|
||||
R_270="1 0 0 0 1 0 0 0 1"
|
||||
|
||||
screen_orientation=$(xrandr --query --verbose | grep DSI-1 | awk '{print $5}')
|
||||
|
||||
case "$screen_orientation" in
|
||||
"right" )
|
||||
xinput set-prop $id_touchscreen 'Coordinate Transformation Matrix' $R_90
|
||||
xinput set-prop $id_stylus 'Coordinate Transformation Matrix' $R_90
|
||||
xrandr --output DSI-1 --rotate inverted
|
||||
;;
|
||||
"inverted" )
|
||||
xinput set-prop $id_touchscreen 'Coordinate Transformation Matrix' $R_180
|
||||
xinput set-prop $id_stylus 'Coordinate Transformation Matrix' $R_180
|
||||
xrandr --output DSI-1 --rotate left
|
||||
;;
|
||||
"left" )
|
||||
xinput set-prop $id_touchscreen 'Coordinate Transformation Matrix' $R_270
|
||||
xinput set-prop $id_stylus 'Coordinate Transformation Matrix' $R_270
|
||||
xrandr --output DSI-1 --rotate normal
|
||||
;;
|
||||
"normal" )
|
||||
xinput set-prop $id_touchscreen 'Coordinate Transformation Matrix' $R_0
|
||||
xinput set-prop $id_stylus 'Coordinate Transformation Matrix' $R_0
|
||||
xrandr --output DSI-1 --rotate right
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user