Merge pull request #167 from accek/lid-closed
Disable Howdy if lid is closed
This commit is contained in:
commit
5db34e226c
2 changed files with 9 additions and 0 deletions
|
|
@ -15,6 +15,9 @@ suppress_unknown = false
|
||||||
# Disable Howdy in remote shells
|
# Disable Howdy in remote shells
|
||||||
ignore_ssh = true
|
ignore_ssh = true
|
||||||
|
|
||||||
|
# Disable Howdy if lid is closed
|
||||||
|
ignore_closed_lid = true
|
||||||
|
|
||||||
# Auto dismiss lock screen on confirmation
|
# Auto dismiss lock screen on confirmation
|
||||||
# Will run loginctl unlock-sessions after every auth
|
# Will run loginctl unlock-sessions after every auth
|
||||||
# Experimental, can behave incorrectly on some systems
|
# Experimental, can behave incorrectly on some systems
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
import glob
|
||||||
|
|
||||||
# pam-python is running python 2, so we use the old module here
|
# pam-python is running python 2, so we use the old module here
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
|
|
@ -25,6 +26,11 @@ def doAuth(pamh):
|
||||||
if "SSH_CONNECTION" in os.environ or "SSH_CLIENT" in os.environ or "SSHD_OPTS" in os.environ:
|
if "SSH_CONNECTION" in os.environ or "SSH_CLIENT" in os.environ or "SSHD_OPTS" in os.environ:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
# Abort if lid is closed
|
||||||
|
if config.getboolean("core", "ignore_closed_lid"):
|
||||||
|
if any('closed' in open(f).read() for f in glob.glob('/proc/acpi/button/lid/*/state')):
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
# Alert the user that we are doing face detection
|
# Alert the user that we are doing face detection
|
||||||
if config.get("core", "detection_notice") == "true":
|
if config.get("core", "detection_notice") == "true":
|
||||||
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Attempting face detection"))
|
pamh.conversation(pamh.Message(pamh.PAM_TEXT_INFO, "Attempting face detection"))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue