From 2d35a00c03cf56f4bf91be3547cb4527bd5431b7 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka <jakub@jirutka.cz> Date: Mon, 11 Jul 2022 21:49:07 +0200 Subject: [PATCH] community/acpid: improve power button handler * Some devices don't generate button/power:PWRF, just button/power:PBTN. * Notebooks usually don't have a separate sleep button, so use the power button for sleep. --- community/acpid/APKBUILD | 4 ++-- community/acpid/handler.sh | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/community/acpid/APKBUILD b/community/acpid/APKBUILD index 81a982879073..d3e6b3a6514b 100644 --- a/community/acpid/APKBUILD +++ b/community/acpid/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Jakub Jirutka <jakub@jirutka.cz> pkgname=acpid pkgver=2.0.33 -pkgrel=1 +pkgrel=2 pkgdesc="The ACPI Daemon (acpid) With Netlink Support" url="https://sourceforge.net/projects/acpid2/" arch="all" @@ -57,7 +57,7 @@ openrc() { sha512sums=" 491a58c62fcad44dc57cbd9294437fbc215c2ec99a030286601cd1956ea504e723e61b11b315983073d66aace1997bc40e6421475f6073298f60b8dcda2add75 acpid-2.0.33.tar.xz -2c029c5dd3ed4593317328da13ffcd547a80d7dc9690886c7fcf7ee8324884d9a94e333d4ba9c4b886dc05146d1ad220452f1cfc76d8e3eb6ce48ca568709595 handler.sh +41b206253f49ae587ff8436c307b453a88e0751fbd3c8e75a3af27b92113b3496c9fb59cb7daed06339005ef70735d8d1eb0c0c6c42b52b700992dcb28217757 handler.sh daf2510f202377a4db9b52448e4805bc4468c66f507cd4e676dc589306b716043c653ff18b697a4c37e5a005123a64a0278f3e4980504d98dd42ac9e95a3443f power-supply-ac f6df3e75198e779826c187038804ba80e7a445567342ac912ff4e5d894ce936fb9347146c302c7d7c9bbc8b3a0e47aeee9d23a4b297ee37e3938b7310a1b5ad9 lid-closed 2e04e5c8a428bfc653b4d56f5a2ff4472169a094ed9eee4b02ea88c755848e4803a0edeb054e152516ee50cb67c8c2be2c43e2e9db9dc80b7fcf218b8907ef6c anything diff --git a/community/acpid/handler.sh b/community/acpid/handler.sh index 412ac023112f..2530acbc662b 100644 --- a/community/acpid/handler.sh +++ b/community/acpid/handler.sh @@ -11,10 +11,14 @@ alias log='logger -t acpid' # <dev-class>:<dev-name>:<notif-value>:<sup-value> case "$1:$2:$3:$4" in -button/power:PWRF:*) +button/power:PWRF:* | button/power:PBTN:*) log 'Power button pressed' - # Shutdown the system unless it has a lid (notebook). - [ -e /proc/acpi/button/lid/LID ] || poweroff + # If we have a lid (notebook), suspend to RAM, otherwise power off. + if [ -e /proc/acpi/button/lid/LID ]; then + zzz + else + poweroff + fi ;; button/sleep:SLPB:*) log 'Sleep button pressed' -- GitLab