Aloha everyone!
I attached a script that I thought I could share with everyone for
your help. This Python3 script only works on Unix systems. It prints the
current state of the lid. This can be used to make a script that
performs some action when the lid is closed or open. The script is
licensed under LGPLv3 and I will soon upload it to my Launchpad account.
Enjoy!
Mahalo,
devyncjohn...@gmail.com
#!/usr/bin/env python3
#Made by Devyn Collier Johnson, NCLA, Linux+, LPIC-1, DCTS
<devyncjohn...@gmail.com>
# LGPLv3 - 2013. (Devyn Collier Johnson, NCLA, Linux+, LPIC-1, DCTS)©
#This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as
#published by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
# This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
#You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.
import subprocess; print(subprocess.getoutput('cat
/proc/acpi/button/lid/LID/state | awk \'{ print $2 }\''))
--
http://mail.python.org/mailman/listinfo/python-list