{"id":43930146,"url":"https://github.com/alesya-h/linux_detect_tablet_mode","last_synced_at":"2026-02-06T23:39:04.840Z","repository":{"id":38381530,"uuid":"109069556","full_name":"alesya-h/linux_detect_tablet_mode","owner":"alesya-h","description":"Detect if your laptop is in normal or tablet mode. Useful for Yoga laptops to disable keyboard/trackpoint/touchpad in a tablet mode","archived":false,"fork":false,"pushed_at":"2024-12-03T02:44:44.000Z","size":40,"stargazers_count":138,"open_issues_count":8,"forks_count":29,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-12-03T03:32:10.884Z","etag":null,"topics":["2in1","laptop","libinput","linux","tablet"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alesya-h.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-01T01:06:34.000Z","updated_at":"2024-12-03T02:44:48.000Z","dependencies_parsed_at":"2024-12-03T10:02:08.167Z","dependency_job_id":null,"html_url":"https://github.com/alesya-h/linux_detect_tablet_mode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alesya-h/linux_detect_tablet_mode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesya-h%2Flinux_detect_tablet_mode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesya-h%2Flinux_detect_tablet_mode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesya-h%2Flinux_detect_tablet_mode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesya-h%2Flinux_detect_tablet_mode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alesya-h","download_url":"https://codeload.github.com/alesya-h/linux_detect_tablet_mode/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alesya-h%2Flinux_detect_tablet_mode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29180636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T23:15:33.022Z","status":"ssl_error","status_checked_at":"2026-02-06T23:15:09.128Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2in1","laptop","libinput","linux","tablet"],"created_at":"2026-02-06T23:39:01.557Z","updated_at":"2026-02-06T23:39:04.832Z","avatar_url":"https://github.com/alesya-h.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tablet mode detection and setup scripts for linux\n\n## What it does\n\nIt uses `libinput debug-events` to detect switches to normal and tablet mode,\nand executes commands for switching into that mode, which are specified in\na config file. Generally you would put there commands to disable/enable a\nkeyboard/touchpad/trackpoint, show/hide an on-screen keyboard, toggle some desktop\nenvironment panels, and the like.\n\n## Supported devices\n\nAll devices that have a tablet mode switch supported by libinput. As far as I understand\nthis is a standard mechanism for this functionality nowadays. Tested devices:\n\n- ThinkPad X1 Yoga Gen2 (it was developed for it)\n- Thinkpad X1 Yoga Gen3\n- Thinkpad X1 Yoga Gen4\n- Thinkpad X1 Yoga Gen6\n- Thinkpad Yoga 11e Gen6\n- Thinkpad X370 Yoga\n- Lenovo IdeaPad Flex 5i Gen 7\n- Samsung Galaxy Book Flex2 5G\n- Dell XPS 13 9310 2-in-1\n- ASUS ZenBook 15 Flip OLED UP6502ZD\n- ASUS TP200SA\n\nIf it works on your device, please tell me and I'll add it to the list (or just submit a pull request yourself).\nTo check if your device is supported, run `stdbuf -oL libinput debug-events|grep switch`, flip your laptop between\nnormal and tablet mode, and see if it printed anything. If you don't see any switch events, your device will\nnot work with these scripts.\n\n## Installation\n\n1. Add your user to the `input` group (`sudo gpasswd --add username input`) and relogin to apply group membership.\n2. Install ruby and stdbuf (most likely you already have them preinstalled)\n3. Clone this repo somewhere, and optionally symlink `watch_tablet` into any directory in your $PATH\n4. Copy a config file into `~/.config/watch_tablet.yml`\n5. Adjust the config (see below)\n6. 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.\n7. After you confirmed that everything works, add `watch_tablet \u0026` to your `~/.xinitrc`\n8. Restart your desktop session and enjoy\n\n### Arch Linux\n\nIf you have an Arch-based distribution, you can install it using [this AUR package](https://aur.archlinux.org/packages/detect-tablet-mode-git/)\n\n\n## Configuration\n\n`input_device` is a path to the device that provides the tablet mode switch. To find it you\nmay run `stdbuf -oL libinput debug-events|grep switch` and notice something like `event4` in\nthe leftmost column. That would correspond to /dev/input/event4. Device numbers may be unstable\nacross reboots, so you may consider doing `ls -lh /dev/input/by-path` and finding a symlink to\nthat device. For X1 Yoga Gen2 it's `/dev/input/by-path/platform-thinkpad_acpi-event`.\n\n`modes.laptop`, `modes.tablet` - this contain commands that will be executed when mode changes.\nMost likely this will contain `xinput enable` and `xinput disable` commands to enable/disable\nkb/touchpad/trackpoint (just run `xinput` to look them up). You may use any other commands\nto adjust your desktop environment (e.g. hide or show additional panels, increase button size,\nhide/show onscreen keyboard etc.)\n\nExample:\n\n```yaml\ninput_device: /dev/input/by-path/platform-thinkpad_acpi-event\nmodes:\n  laptop:\n    # - xinput enable \"Wacom Pen and multitouch sensor Finger\"\n    - xinput enable \"AT Translated Set 2 keyboard\"\n    - xinput enable \"SynPS/2 Synaptics TouchPad\"\n    - xinput enable \"TPPS/2 IBM TrackPoint\"\n  tablet:\n    # - xinput disable \"Wacom Pen and multitouch sensor Finger\"\n    - xinput disable \"AT Translated Set 2 keyboard\"\n    - xinput disable \"SynPS/2 Synaptics TouchPad\"\n    - xinput disable \"TPPS/2 IBM TrackPoint\"\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesya-h%2Flinux_detect_tablet_mode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falesya-h%2Flinux_detect_tablet_mode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falesya-h%2Flinux_detect_tablet_mode/lists"}