Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rubo77
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rubo77/1a3320fda5a47fdebde7 to your computer and use it in GitHub Desktop.
Save rubo77/1a3320fda5a47fdebde7 to your computer and use it in GitHub Desktop.
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