commit c6806fdcc88b76341141b44c98e653a0ef9f033c Author: Tim Evans Date: Wed Jun 24 21:51:20 2026 +0100 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 diff --git a/.config/autostart/auto-rotate.desktop b/.config/autostart/auto-rotate.desktop new file mode 100644 index 0000000..1641aca --- /dev/null +++ b/.config/autostart/auto-rotate.desktop @@ -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 diff --git a/.config/monitors.xml b/.config/monitors.xml new file mode 100644 index 0000000..d509c96 --- /dev/null +++ b/.config/monitors.xml @@ -0,0 +1,29 @@ + + + no + + ??? + 0x0000 + 0x00000000 + 1200 + 1920 + 60 + 0 + 0 + right + no + no + yes + + + + + + + + + + + + + diff --git a/.local/bin/auto-rotate b/.local/bin/auto-rotate new file mode 100755 index 0000000..e7e2395 --- /dev/null +++ b/.local/bin/auto-rotate @@ -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 diff --git a/.local/share/libwacom/gpd-pocket3-0113.tablet b/.local/share/libwacom/gpd-pocket3-0113.tablet new file mode 100644 index 0000000..6eb9dfc --- /dev/null +++ b/.local/share/libwacom/gpd-pocket3-0113.tablet @@ -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; diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..a4c3ff3 --- /dev/null +++ b/install.sh @@ -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." diff --git a/system/etc/X11/xorg.conf.d/99-touchscreen.conf b/system/etc/X11/xorg.conf.d/99-touchscreen.conf new file mode 100644 index 0000000..7716467 --- /dev/null +++ b/system/etc/X11/xorg.conf.d/99-touchscreen.conf @@ -0,0 +1,5 @@ +Section "InputClass" + Identifier "calibration" + MatchProduct "GXTP7380" + Option "TransformationMatrix" "0 1 0 -1 0 1 0 0 1" +EndSection diff --git a/system/etc/udev/rules.d/99-gpd-pocket3-touch.rules b/system/etc/udev/rules.d/99-gpd-pocket3-touch.rules new file mode 100644 index 0000000..14d3633 --- /dev/null +++ b/system/etc/udev/rules.d/99-gpd-pocket3-touch.rules @@ -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" diff --git a/system/usr/local/bin/rotate.sh b/system/usr/local/bin/rotate.sh new file mode 100644 index 0000000..d68a04f --- /dev/null +++ b/system/usr/local/bin/rotate.sh @@ -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