项目作者: efernau

项目描述 :
screen rotation daemon
高级语言: Rust
项目地址: git://github.com/efernau/rot8.git
创建时间: 2019-05-18T20:10:15Z
项目社区:https://github.com/efernau/rot8

开源协议:MIT License

下载


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.

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

or

  1. $ cargo install rot8

usage

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

  1. $ swaymsg input <INPUTDEVICE> map_to_output <OUTPUTDEVICE>

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

  1. exec rot8

For X11 set Touchscreen Device

  1. rot8 --touchscreen <TOUCHSCREEN>

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

There are the following args (defaults):

  1. --sleep // Set millis to sleep between rotation checks (500)
  2. --display // Set Display Device (eDP-1)
  3. --touchscreen // Set Touchscreen Device X11, allows multiple devices (ELAN0732:00 04F3:22E1)
  4. --keyboard // Set keyboard to deactivate upon rotation, for Sway only
  5. --threshold // Set a rotation threshold between 0 and 1, higher is more sensitive (0.5)
  6. --normalization-factor // Set factor for sensor value normalization (1e6)
  7. --invert-x // Invert readings from the HW x axis
  8. --invert-y // Invert readings from the HW y axis
  9. --invert-z // Invert readings from the HW z axis
  10. --invert-xy // Map HW axes to internal x and y respectively (xy, yx, zy, yz, xz, zx)
  11. --oneshot // Updates the screen rotation just once instead of continuously
  12. --beforehooks // Execute a custom script before rotation
  13. --hooks // Execute a custom script after the rotation has finished
  14. --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.