6 releases (1 stable)

1.0.0 Oct 4, 2023
0.1.5 Sep 13, 2022
0.1.4 May 12, 2022
0.1.3 Jan 4, 2020
0.1.1 Aug 17, 2019

#131 in Unix APIs

Download history 36/week @ 2024-02-26 73/week @ 2024-03-04 37/week @ 2024-03-11 2/week @ 2024-03-18 2/week @ 2024-03-25 32/week @ 2024-04-01 7/week @ 2024-04-08 2/week @ 2024-04-15 12/week @ 2024-04-22 5/week @ 2024-05-13 5/week @ 2024-05-20 35/week @ 2024-05-27 18/week @ 2024-06-03 26/week @ 2024-06-10

85 downloads per month

MIT license

647 lines



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).



Available in:

Arch User Repository: rot8-git

Void Package: rot8

Nixpkgs: 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


$ cargo install rot8


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)
--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
--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.


~254K SLoC