Skip to content

Instantly share code, notes, and snippets.

@rubo77 rubo77/lid.sh.post Secret
Last active Aug 29, 2015

Embed
What would you like to do?
This script reacts if laptop lid is opened or closed in Ubuntu 11.10 (Oneiric Ocelot)
#!/bin/sh
#########################################################################
## Script written by Ruben Barkow ##
## ##
## Description: This script reacts if laptop lid is opened or ##
## closed in Ubuntu 11.10 (Oneiric Ocelot). ##
## ##
## This script can be freely redistributed, modified and used. ##
## Any redistribution must include the information of authors. ##
## ##
## THIS SCRIPT HAS NO WARRANTY! ##
#########################################################################
grep -q close /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
echo close>>/tmp/screen.lid
fi
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
echo open>>/tmp/screen.lid
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.