Drv-lid-switch Role¶
Description: No description available
Variables¶
author: Kevin Veen-Birkenbach
description: Fixes incorrect lid switch behavior on Linux laptops by setting up hibernation and configuring systemd.
license: Infinito.Nexus NonCommercial License
license_url: https://s.infinito.nexus/license
company: Kevin Veen-Birkenbach
Consulting & Coaching Solutions https://www.veen.world
min_ansible_version: 2.9
platforms: [{‘name’: ‘Archlinux’, ‘versions’: [‘rolling’]}]
galaxy_tags: [‘lid’, ‘laptop’, ‘power’, ‘hibernate’, ‘systemd’, ‘archlinux’]
repository: https://s.infinito.nexus/code
issue_tracker_url: https://s.infinito.nexus/issues
documentation: https://docs.infinito.nexus/
README¶
Driver Lid Switch 🛑💻¶
Description¶
This Ansible role configures lid switch behavior on Linux systems where the default behavior does not work correctly—particularly on laptops like the HP Spectre x360 14-ef2777ng running Manjaro Linux, Wayland, and GNOME. By default, closing the lid can trigger hibernation or suspend incorrectly, even while docked or on external power.
This role integrates
`setup-hibernate <https://github.com/kevinveenbirkenbach/setup-hibernate>`__
to configure hibernation support and sets systemd rules to define proper
lid switch behavior based on power state.
Overview¶
This role addresses a common issue on Linux laptops: closing the lid
while docked or plugged in leads to unintended sleep or hibernation. It
installs the necessary hibernation tools and updates
/etc/systemd/logind.conf to:
Hibernate on lid close when on battery
Lock the session when on AC power or docked
Purpose¶
The purpose of this role is to enforce a consistent and predictable lid switch behavior across power states, improving usability on laptops that otherwise behave unpredictably when the lid is closed.
Features¶
Installs ``setup-hibernate``: Uses
pkgmgrto install and initialize hibernation support.Systemd Integration: Applies proper
logind.confsettings for lid switch handling.Power-aware Configuration: Differentiates between battery, AC power, and docked state.
Idempotent Design: Ensures safe re-runs and minimal unnecessary restarts.