Shorted driver- to drv-

This commit is contained in:
2025-07-09 03:49:01 +02:00
parent f548faa80f
commit 3fdd900ed8
20 changed files with 12 additions and 12 deletions

View File

@@ -0,0 +1,38 @@
# 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 `pkgmgr` to install and initialize hibernation support.
- **Systemd Integration:** Applies proper `logind.conf` settings 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.
## Further Resources
- https://chatgpt.com/share/67ed14d0-4220-800f-a592-82513553fb97
- https://chatgpt.com/share/67ed1520-8a54-800f-98a5-12372413994a
- https://chatgpt.com/share/67ed158b-66d4-800f-b418-e52460c225ce
## Credits 📝
Developed and maintained by **Kevin Veen-Birkenbach**.
Learn more at [www.veen.world](https://www.veen.world)
Part of the [CyMaIS Project](https://github.com/kevinveenbirkenbach/cymais)
License: [CyMaIS NonCommercial License (CNCL)](https://s.veen.world/cncl)

View File

@@ -0,0 +1,6 @@
---
- name: Restart systemd-logind
become: yes
systemd:
name: systemd-logind
state: restarted

View File

@@ -0,0 +1,25 @@
---
galaxy_info:
author: "Kevin Veen-Birkenbach"
description: "Fixes incorrect lid switch behavior on Linux laptops by setting up hibernation and configuring systemd."
license: "CyMaIS NonCommercial License (CNCL)"
license_url: "https://s.veen.world/cncl"
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.veen.world/cymais
issue_tracker_url: https://s.veen.world/cymaisissues
documentation: https://s.veen.world/cymais

View File

@@ -0,0 +1,40 @@
---
- name: "pkgmgr install"
include_role:
name: pkgmgr-install
vars:
package_name: setup-hibernate
- name: Setup hibernate
command: setup-hibernate --non-interactive
become: true
- name: Configure systemd lid switch behavior to hibernate on lid close (battery), lock on AC and docked
become: yes
lineinfile:
path: /etc/systemd/logind.conf
regexp: '^#?HandleLidSwitch='
line: 'HandleLidSwitch=hibernate'
backup: yes
notify: Restart systemd-logind
become: true
- name: Configure systemd to lock session when lid is closed on external power
become: yes
lineinfile:
path: /etc/systemd/logind.conf
regexp: '^#?HandleLidSwitchExternalPower='
line: 'HandleLidSwitchExternalPower=lock'
backup: yes
notify: Restart systemd-logind
become: true
- name: Configure systemd to lock session when lid is closed while docked
become: yes
lineinfile:
path: /etc/systemd/logind.conf
regexp: '^#?HandleLidSwitchDocked='
line: 'HandleLidSwitchDocked=lock'
backup: yes
notify: Restart systemd-logind
become: true