Files
obsidian/tank/programming/arch on surface.md
T
2026-05-07 14:39:10 +02:00

381 lines
7.4 KiB
Markdown
Executable File

Here's a **hypothetical but realistic Arch setup** for a Surface Pro tablet with all the touch/tablet features:
---
## **Base System Setup**
**1. Installation with Surface kernel:**
```bash
# Install base Arch
# After base install, add linux-surface repo
# Add the linux-surface repository key
wget -qO - https://raw.githubusercontent.com/linux-surface/linux-surface/master/pkg/keys/surface.asc | sudo pacman-key --add -
sudo pacman-key --finger 56C464BAAC421453
sudo pacman-key --lsign-key 56C464BAAC421453
# Add repo to /etc/pacman.conf
[linux-surface]
Server = https://pkg.surfacelinux.com/arch/
# Update and install Surface kernel
sudo pacman -Syu
sudo pacman -S linux-surface linux-surface-headers iptsd
```
**2. Core tablet packages:**
```bash
# Surface-specific firmware and drivers
sudo pacman -S libwacom # Wacom/stylus support
sudo pacman -S iptsd # Surface touchscreen daemon
sudo systemctl enable iptsd
# Camera support
sudo pacman -S linux-firmware
# Surface cameras need special firmware from linux-surface
```
---
## **Desktop Environment: GNOME (Best Touch Support)**
**Install GNOME with Wayland:**
```bash
sudo pacman -S gnome gnome-extra
sudo pacman -S gdm
sudo systemctl enable gdm
# Touch-specific tools
sudo pacman -S gnome-shell-extension-appindicator
sudo pacman -S gnome-browser-connector
```
**GNOME gives you out-of-box:**
- Automatic screen rotation
- Touch gestures (swipe between workspaces)
- On-screen keyboard (built-in)
- Pinch-to-zoom
- Good HiDPI scaling
---
## **Screen Rotation**
**Auto-rotation with iio-sensor-proxy:**
```bash
sudo pacman -S iio-sensor-proxy
sudo systemctl enable iio-sensor-proxy
# Test rotation sensor
monitor-sensor
```
**Manual rotation keybinds (if needed):**
```bash
# Create a script ~/bin/rotate.sh
#!/bin/bash
case $(xrandr --query --verbose | grep 'connected primary' | cut -d' ' -f5) in
normal)
xrandr --output eDP-1 --rotate right
;;
right)
xrandr --output eDP-1 --rotate inverted
;;
inverted)
xrandr --output eDP-1 --rotate left
;;
left)
xrandr --output eDP-1 --rotate normal
;;
esac
```
---
## **Battery Optimization**
**TLP (automatic power management):**
```bash
sudo pacman -S tlp tlp-rdw
sudo systemctl enable tlp
sudo systemctl start tlp
# Configure /etc/tlp.conf for aggressive power saving
sudo nano /etc/tlp.conf
# Key settings:
TLP_DEFAULT_MODE=BAT
CPU_SCALING_GOVERNOR_ON_BAT=powersave
RUNTIME_PM_ON_BAT=auto
```
**Additional power tools:**
```bash
sudo pacman -S powertop # Power usage analysis
sudo pacman -S thermald # Thermal management
sudo systemctl enable thermald
# Run powertop calibration once
sudo powertop --calibrate
```
**Check battery stats:**
```bash
sudo pacman -S acpi
acpi -V # Show battery info
```
---
## **Touch & Stylus Support**
**Stylus configuration:**
```bash
sudo pacman -S xf86-input-wacom
# Surface Pen should work automatically with iptsd + libwacom
# For pressure sensitivity in apps
sudo pacman -S xournalpp # Note-taking with pen
sudo pacman -S krita # Drawing with pressure
sudo pacman -S gimp
```
**On-screen keyboard alternatives:**
```bash
# GNOME has built-in OSK, but alternatives:
yay -S onboard # Feature-rich OSK
yay -S squeekboard # Mobile-focused OSK
```
**Touch gestures (if not using GNOME):**
```bash
yay -S libinput-gestures
yay -S gestures # GUI for libinput-gestures
# Configure swipes, pinches, etc.
```
---
## **Camera Support**
**Video/camera stack:**
```bash
sudo pacman -S v4l-utils # Video4Linux utilities
sudo pacman -S cheese # Test webcam
sudo pacan -S pipewire pipewire-pulse wireplumber
# Check cameras
v4l2-ctl --list-devices
# Surface cameras need IPU3 firmware
# Should be in linux-surface kernel already
```
---
## **WiFi & Bluetooth**
```bash
sudo pacman -S networkmanager network-manager-applet
sudo systemctl enable NetworkManager
sudo pacman -S bluez bluez-utils
sudo systemctl enable bluetooth
```
---
## **Audio**
```bash
sudo pacman -S pipewire pipewire-alsa pipewire-pulse pipewire-jack
sudo pacman -S wireplumber
```
---
## **HiDPI Scaling**
**For GNOME:**
```bash
# Settings > Displays > Scale (100%, 200%, etc.)
# Or via gsettings:
gsettings set org.gnome.desktop.interface scaling-factor 2
```
**For Wayland fractional scaling:**
```bash
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"
```
---
## **Type Cover (Keyboard) Support**
Should work automatically, but ensure:
```bash
# Check keyboard detected
libinput list-devices
# Keyboard backlight control
yay -S surface-control
# Or manually:
echo 1 | sudo tee /sys/class/leds/surface::kbd_backlight/brightness
```
---
## **Useful Tablet Apps**
```bash
# Note-taking
sudo pacman -S xournalpp # Best for stylus notes
yay -S rnote # Rust-based note app
# PDF annotation
sudo pacman -S okular
yay -S xournal++
# Drawing
sudo pacman -S krita inkscape
# E-reading
sudo pacman -S foliate # E-book reader
sudo pacman -S zathura # PDF reader
# Touch-friendly file manager
sudo pacman -S nautilus # GNOME Files
```
---
## **Performance Tweaks**
**Reduce swappiness:**
```bash
echo "vm.swappiness=10" | sudo tee -a /etc/sysctl.d/99-swappiness.conf
```
**Enable ZRAM (compressed RAM):**
```bash
sudo pacman -S zram-generator
sudo nano /etc/systemd/zram-generator.conf
[zram0]
zram-size = ram / 2
compression-algorithm = zstd
```
**Trim SSD weekly:**
```bash
sudo systemctl enable fstrim.timer
```
---
## **Testing Everything**
**Rotation:**
```bash
monitor-sensor # Rotate device, watch output
```
**Battery:**
```bash
sudo tlp-stat -b # Battery stats
sudo powertop # Power consumption
```
**Touch:**
```bash
libinput debug-events # Watch touch events
```
**Stylus:**
```bash
xsetwacom list devices # List stylus
```
**Camera:**
```bash
cheese # Open camera app
```
---
## **Alternative: KDE Plasma**
If you prefer KDE over GNOME:
```bash
sudo pacman -S plasma-meta kde-applications
sudo pacman -S plasma-wayland-session
# KDE has:
# - Good touch support
# - Better customization
# - Onboard for OSK
# - Screen rotation works
# - More lightweight than GNOME
```
---
## **Common Issues & Fixes**
**Camera not working:**
```bash
# Update firmware
sudo pacman -Syu
# Check dmesg for IPU3 errors
dmesg | grep -i ipu3
```
**Stylus not detected:**
```bash
sudo systemctl restart iptsd
# Check if iptsd is running
systemctl status iptsd
```
**Battery draining fast:**
```bash
sudo powertop --auto-tune
# Add to systemd service for persistence
```
**Screen rotation not working:**
```bash
# Check sensor
monitor-sensor
# May need to install iio-sensor-proxy-git from AUR
yay -S iio-sensor-proxy-git
```
---
## **Maintenance**
```bash
# Update system + Surface kernel
sudo pacman -Syu
# Check for Surface-specific updates
# linux-surface team releases patches regularly
```
---
This setup gives you:
✅ Automatic rotation
✅ Battery optimization (6-8 hours typical)
✅ Working cameras (front + rear)
✅ Stylus with pressure sensitivity
✅ Touch gestures
✅ On-screen keyboard
✅ Type Cover support
✅ Good performance
The key is **linux-surface kernel + GNOME/KDE + proper power management**. It won't be *exactly* like iPad smoothness, but it's very usable as a daily driver tablet.
Want me to elaborate on any specific part?