MCPcopy Index your code
hub / github.com/efernau/rot8

github.com/efernau/rot8 @v1.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.1 ↗ · + Follow
23 symbols 34 edges 5 files 2 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

rot8

Rust

automatic display rotation using built-in accelerometer

Automatically rotate modern Linux desktop screen and input devices. Handy for convertible touchscreen notebooks like HP Spectre x360, Lenovo IdeaPad Flex or Linux phone like Pinephone.

Compatible with X11 and Wayland compositors which support the wlr_output_management_v1 protocol (Like sway and hyprland).

installation

packages

Arch User Repository: rot8-git

GNU Guix Package: rot8

Nixpkgs: rot8

Void Package: rot8

manually build from source

Rust language and the cargo package manager are required to build the binary.

$ git clone https://github.com/efernau/rot8
$ cd rot8 && cargo build --release
$ cp target/release/rot8  /usr/bin/rot8

or

$ cargo install rot8

usage

Map your inputs to the output device as necessary. e.g. for sway:


$ swaymsg input <INPUTDEVICE> map_to_output <OUTPUTDEVICE>

Call rot8 from your compositor configuration. e.g. for sway:


exec rot8

For X11 set Touchscreen Device


rot8 --touchscreen <TOUCHSCREEN>

This will start the daemon running, continuously checking for rotations.

There are the following args (defaults):


--sleep                 // Set millis to sleep between rotation checks (500)
--display               // Set Display Device (eDP-1)
--device                // Set accelerometer device (/sys/bus/iio/devices/iio:device*)
--touchscreen           // Set Touchscreen Device X11, allows multiple devices (ELAN0732:00 04F3:22E1)
--keyboard              // Set keyboard to deactivate upon rotation, for Sway only
--threshold             // Set a rotation threshold between 0 and 1, higher is more sensitive (0.5)
--normalization-factor  // Set factor for sensor value normalization (1e6)
--invert-x              // Invert readings from the HW x axis
--invert-y              // Invert readings from the HW y axis
--invert-z              // Invert readings from the HW z axis
--invert-xy             // Map HW axes to internal x and y respectively (xy, yx, zy, yz, xz, zx)
--oneshot               // Updates the screen rotation just once instead of continuously
--beforehooks           // Execute a custom script before rotation
--hooks                 // Execute a custom script after the rotation has finished
--version               // Returns the rot8 version

You may need to play with the normalization factor (try multiples of 10) and the axis inversions to get the accelerometer readings to calculate right.

Extension points exported contracts — how you extend this code

DisplayManager (Interface)
(no doc) [3 implementers]
src/backends/mod.rs

Core symbols most depended-on inside this repo

process_exists
called by 3
src/main.rs
transform_to_env
called by 2
src/main.rs
read_socket
called by 2
src/backends/wlroots.rs
change_rotation_state
called by 1
src/backends/xorg.rs
get_rotation_state
called by 1
src/backends/xorg.rs
write_socket
called by 1
src/backends/wlroots.rs
update_configuration
called by 1
src/backends/wlroots.rs
main
called by 0
src/main.rs

Shape

Method 14
Class 5
Function 3
Interface 1

Languages

Rust100%

Modules by API surface

src/backends/wlroots.rs9 symbols
src/backends/sway.rs5 symbols
src/main.rs4 symbols
src/backends/xorg.rs4 symbols
src/backends/mod.rs1 symbols

For agents

$ claude mcp add rot8 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact