Skip to content

Instantly share code, notes, and snippets.

@ricsiga
Last active July 10, 2017 09:03
Show Gist options
  • Save ricsiga/ef59f57dfe726c71c9739d51df6546fe to your computer and use it in GitHub Desktop.
Save ricsiga/ef59f57dfe726c71c9739d51df6546fe to your computer and use it in GitHub Desktop.
Catch lid open events on Ubuntu 16.04

create two files:

  • /etc/acpi/events/lm_lid
  • /etc/acpi/lid.sh (chmod +x /etc/acpi/lid.sh)

restart acpid service:

  • systemctl restart acpid.service
#!/bin/sh
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
rmmod iwlmvm iwlwifi && modprobe iwlwifi
fi
event=button/lid.*
action=/etc/acpi/lid.sh
@sweisman
Copy link

Is there some way to use this to prevent the actions from happening?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment