All Projects → alesya-h → linux_detect_tablet_mode

alesya-h / linux_detect_tablet_mode

Licence: MIT license
Detect if your laptop is in normal or tablet mode. Useful for Yoga laptops to disable keyboard/trackpoint/touchpad in a tablet mode

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to linux detect tablet mode

Booking Management Dashboard
flutter Booking Management Dashboard responsive (web,mobile,tablet)
Stars: ✭ 69 (-37.27%)
Mutual labels:  tablet
Ngx Webcam
A simple Angular webcam component / pure & minimal, no flash-fallback
Stars: ✭ 148 (+34.55%)
Mutual labels:  tablet
Xf86 Input Wacom
X.Org driver for Wacom devices
Stars: ✭ 201 (+82.73%)
Mutual labels:  tablet
Material Bottomnavigation
Bottom Navigation widget component inspired by the Google Material Design Guidelines at https://www.google.com/design/spec/components/bottom-navigation.html
Stars: ✭ 1,375 (+1150%)
Mutual labels:  tablet
Android Player
LUSH Player for Mobile, Tablet & TV
Stars: ✭ 129 (+17.27%)
Mutual labels:  tablet
Boo
Boo - A beautiful, clean and responsive theme for Ghost.
Stars: ✭ 176 (+60%)
Mutual labels:  tablet
Egjs Flicking
🎠 ♻️ Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
Stars: ✭ 937 (+751.82%)
Mutual labels:  tablet
Hackintosh-ASUS-A455LF-Notebook
EFI Folder for ASUS A455LF-WX039D Notebook Series with Clover/OpenCore Legacy or UEFI
Stars: ✭ 27 (-75.45%)
Mutual labels:  laptop
Lazy
Kule Lazy4 / CSS Framework
Stars: ✭ 147 (+33.64%)
Mutual labels:  tablet
Device Detector Js
A precise user agent parser and device detector written in TypeScript
Stars: ✭ 193 (+75.45%)
Mutual labels:  tablet
React Native Size Matters
A lightweight, zero-dependencies, React-Native utility belt for scaling the size of your apps UI across different sized devices.
Stars: ✭ 1,706 (+1450.91%)
Mutual labels:  tablet
Subwaytooter
Mastodon client app for Android
Stars: ✭ 118 (+7.27%)
Mutual labels:  tablet
Termuxarch
Experience the pleasure of the Linux command prompt in Android, Chromebook, Fire OS and Windows on smartphone, smartTV, tablet and wearable https://termuxarch.github.io/TermuxArch/
Stars: ✭ 183 (+66.36%)
Mutual labels:  tablet
Lines Are Beautiful
C++ File API for the reMarkable tablet
Stars: ✭ 73 (-33.64%)
Mutual labels:  tablet
Buildapks
Really quickly build APKs on handheld device (smartphone or tablet) in Amazon, Android, Chromebook and Windows📲 See https://buildapks.github.io/docsBuildAPKs/setup to start building APKs.
Stars: ✭ 218 (+98.18%)
Mutual labels:  tablet
Imbmw
BMW iBus .NET MF SDK and hardware
Stars: ✭ 50 (-54.55%)
Mutual labels:  tablet
Libwacom
libwacom is a tablet description library
Stars: ✭ 169 (+53.64%)
Mutual labels:  tablet
media-blender
Easy and predictable SASS/SCSS media queries
Stars: ✭ 26 (-76.36%)
Mutual labels:  tablet
Magicmirror
🔮 ReactNative smart mirror project
Stars: ✭ 243 (+120.91%)
Mutual labels:  tablet
React Native Popover View
A well-tested, adaptable, lightweight <Popover> component for react-native
Stars: ✭ 191 (+73.64%)
Mutual labels:  tablet

Tablet mode detection and setup scripts for linux

What it does

It uses libinput debug-events to detect switches to normal and tablet mode, and executes commands for switching into that mode, which are specified in a config file. Generally you would put there commands to disable/enable a keyboard/touchpad/trackpoint, show/hide an on-screen keyboard, toggle some desktop environment panels, and the like.

Supported devices

All devices that have a tablet mode switch supported by libinput. As far as I understand this is a standard mechanism for this functionality nowadays. Tested devices:

  • ThinkPad X1 Yoga Gen2 (it was developed for it)
  • Thinkpad X1 Yoga Gen3
  • Thinkpad X1 Yoga Gen4
  • Thinkpad Yoga 11e Gen6
  • Lenovo IdeaPad Flex 5i Gen 7
  • Samsung Galaxy Book Flex2 5G

If it works on your device, please tell me and I'll add it to the list (or just submit a pull request yourself). To check if your device is supported, run stdbuf -oL libinput debug-events|grep switch, flip your laptop between normal and tablet mode, and see if it printed anything. If you don't see any switch events, your device will not work with these scripts.

Installation

  1. Add your user to the input group (sudo gpasswd --add username input) and relogin to apply group membership.
  2. Install ruby and stdbuf (most likely you already have them preinstalled)
  3. Clone this repo somewhere, and optionally symlink watch_tablet into any directory in your $PATH
  4. Copy a config file into ~/.config/watch_tablet.yml
  5. Adjust the config (see below)
  6. Test it by running watch_tablet in a terminal and flipping your laptop to tablet and back. You should see commands from the config being executed. Press Ctrl+C to terminate it.
  7. After you confirmed that everything works, add watch_tablet & to your ~/.xinitrc
  8. Restart your desktop session and enjoy

Arch Linux

If you have an Arch-based distribution, you can install it using this AUR package

Configuration

input_device is a path to the device that provides the tablet mode switch. To find it you may run stdbuf -oL libinput debug-events|grep switch and notice something like event4 in the leftmost column. That would correspond to /dev/input/event4. Device numbers may be unstable across reboots, so you may consider doing ls -lh /dev/input/by-path and finding a symlink to that device. For X1 Yoga Gen2 it's /dev/input/by-path/platform-thinkpad_acpi-event.

modes.laptop, modes.tablet - this contain commands that will be executed when mode changes. Most likely this will contain xinput enable and xinput disable commands to enable/disable kb/touchpad/trackpoint (just run xinput to look them up). You may use any other commands to adjust your desktop environment (e.g. hide or show additional panels, increase button size, hide/show onscreen keyboard etc.)

Example:

input_device: /dev/input/by-path/platform-thinkpad_acpi-event
modes:
  laptop:
    # - xinput enable "Wacom Pen and multitouch sensor Finger"
    - xinput enable "AT Translated Set 2 keyboard"
    - xinput enable "SynPS/2 Synaptics TouchPad"
    - xinput enable "TPPS/2 IBM TrackPoint"
  tablet:
    # - xinput disable "Wacom Pen and multitouch sensor Finger"
    - xinput disable "AT Translated Set 2 keyboard"
    - xinput disable "SynPS/2 Synaptics TouchPad"
    - xinput disable "TPPS/2 IBM TrackPoint"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].