HP Spectre Tablet Mode on CachyOS & Niri
tldr - my fancy 2 in 1 laptop/tablet hybrid wasn’t doing its thing and using a combination of tools and waydroid I was able to make it useful here are the steps.
I bought one of those 2 in 1 laptops a few years ago well the HP Spectre specifically and while its nice it came with Windows by default. Which was whatever until I decided I’m on a crusade against using Windows on any of my screens in silent protest of it just being bad.
While I’ve fallen in love now with using niri and CachyOS on all my screens I did realize there was one particular shortcoming on my ever so fancy and probably overkill 2-in-1.. Tablet mode no longer really worked.
So I employed the powers of AI, Google and some good ol’ trial and error and came up with this stack. It’ll get the screen rotating, and auto launch android when in tablet mode.
1. Enable Hardware Detection
HP Spectres need the intel_vbtn driver to recognize the hinge flip.
# Load the driver
sudo modprobe intel_vbtn
# Persist on reboot
echo "intel_vbtn" | sudo tee /etc/modules-load.d/intel_vbtn.conf
2. Sensors & Screen Rotation
Install the bridge between your accelerometer and the display.
sudo pacman -S iio-sensor-proxy
sudo systemctl enable --now iio-sensor-proxy
# Install the rotator daemon
paru -S rot8
3. Waydroid
Since niri isn’t exactly designed for tablet mode, the tablet mode experience is kind of limited. Luckily we can install and run android on linux with waydroid.
sudo pacman -S waydroid
You’ll need to initialize Waydroid and choose the image you want to run (with or without Google Play). For example, to install with GApps:
sudo waydroid init -s GAPPS -f
4. The Automation Script
This script listens for the specific string reported by the Spectre’s sensors and will auto launch waydroid when in tablet mode.
File: ~/bin/tablet-mode.sh
#!/bin/bash
# Listen for the specific tablet switch event
libinput debug-events | while read -r line; do
if echo "$line" | grep -q "switch tablet-mode state 1"; then
# Tablet mode activated
waydroid show-full-ui
elif echo "$line" | grep -q "switch tablet-mode state 0"; then
# Tablet mode deactivated
waydroid session stop
fi
done
5. Niri Integration
Add these to your ~/.config/niri/config.kdl to automate the whole stack.
spawn-at-startup "rot8"
spawn-at-startup "/home/shinda/bin/tablet-mode.sh"