How wdbm/spin works
Purpose and Operating Model
spin is a Linux laptop-tablet mode utility for X11 systems. It automates input-device and orientation behavior as convertible hardware changes posture, while also allowing manual control. The package is centered on python_spin/__init__.py, with installation metadata in setup.py.
Entry Points
The installed command is spin, supporting:
• Default graphical operation.
• Headless operation via spin --no_GUI.
• Additional command-line options exposed through spin --help.
The package implementation and likely CLI/bootstrap logic are in:
• python_spin/__init__.py
• setup.py
Device-State Automation
The primary control loop detects changes relevant to convertible use:
1. Start in laptop configuration.
2. Detect a transition between laptop and tablet states.
3. Enable or disable the touchpad and pointing stick (“nipple”) to match that state.
4. Apply display/input orientation changes where required.
This behavior is provided in both GUI and non-GUI modes. The core device-state boundary is the local X11 input/display stack; this repository is not a network service.
Relevant paths:
• python_spin/__init__.py
• README.md
Stylus and Palm-Rejection Flow
A separate input-policy flow monitors stylus proximity. When a stylus is detected, spin disables the touchscreen to prevent accidental palm input; it restores expected behavior when stylus proximity ends. This depends on X11 exposing the relevant input devices and event information.
Relevant paths:
• python_spin/__init__.py
• README.md
User Interface and Manual Controls
The default runtime includes a PyQt5 graphical interface for observing or manually applying display orientation and input-device settings. The same automatic policies remain active in GUI mode. Headless mode retains automation without the graphical layer.
Relevant paths:
• python_spin/__init__.py
• setup.py
Runtime, Packaging, and Desktop Integration
Material runtime dependencies are Linux, X11, and PyQt5. The package is distributed through Python packaging metadata in setup.py. A desktop launcher is provided for system-wide installation:
• python_spin/static/spin.desktop
• setup.py
The README references a launcher icon (spin.svg), but that asset is not present in the supplied tree; deployment may retrieve it externally rather than package it.
Experimental Acceleration Control
An optional, disabled-by-default acceleration-control capability can be enabled from the GUI. It is a secondary policy layer rather than part of the required laptop/tablet and stylus flows.
Relevant paths:
• python_spin/__init__.py
• README.md
Main entry points: __init__.py spin command · setup.py Python package metadata · spin.desktop Desktop launcher · README.md Usage documentation
Components 14
Packaging & Launch
- Python package metadata · Defines installation and the spin command.
setup.py - Desktop launcher
python_spin/static/spin.desktop - Usage documentation · Documents modes, policies, and dependencies.
README.md
Spin Runtime
- spin command · Selects GUI or --no_GUI operation.
python_spin/__init__.py - Runtime controller · Coordinates automatic policies and device actions.
python_spin/__init__.py - PyQt5 GUI · Shows and manually applies orientation and input settings.
python_spin/__init__.py - Headless mode · Runs policies without the graphical layer.
python_spin/__init__.py
Device Policies
- Laptop/tablet detection
python_spin/__init__.py - Posture input policy · Enables or disables touchpad and pointing stick by posture.
python_spin/__init__.py - Orientation policy
python_spin/__init__.py - Stylus palm rejection · Disables touchscreen while the stylus is in proximity.
python_spin/__init__.py - Acceleration control · Disabled by default and enabled from the GUI.
python_spin/__init__.py
Local Platform
- X11 input & display stack · Provides device state, events, and display/input control.
- Linux system
Connections 21
- Python package metadata → spin command: installs
- Python package metadata → Desktop launcher: packages
- Desktop launcher → spin command: launches
- spin command → Runtime controller: starts
- spin command → PyQt5 GUI: default mode
- spin command → Headless mode: --no_GUI
- PyQt5 GUI → Runtime controller: runs automation
- Headless mode → Runtime controller: runs automation
- PyQt5 GUI → Orientation policy: manual controls
- PyQt5 GUI → Acceleration control: enables
- Runtime controller → Laptop/tablet detection: monitors
- Runtime controller → Stylus palm rejection: monitors
- Laptop/tablet detection → Posture input policy: state transition
- Laptop/tablet detection → Orientation policy: orientation change
- Laptop/tablet detection → X11 input & display stack: reads state
- Stylus palm rejection → X11 input & display stack: reads proximity and controls touchscreen
- Posture input policy → X11 input & display stack: controls touchpad and pointing stick
- Orientation policy → X11 input & display stack: applies orientation
- Acceleration control → X11 input & display stack: applies optional control
- X11 input & display stack → Linux system: runs on
- Usage documentation → spin command: documents