[ltp] Re: Suspend five minutes after closing lid.

Alex Polite linux-thinkpad@linux-thinkpad.org
Sun, 9 Sep 2007 12:30:00 +0200


Thanks every one for your input. Here's the ruby script I ended up
with. I initiate it from .gnomerc The good thing about this approach
is that there's no need to keep track of any processes. It also checks
that the lid has really been closed for a consecutive run of five
minutes.


fh = open("/proc/acpi/button/lid/LID/state")
step = 30
limit = 60*5
array = []
while 1
  array.push(fh.read())
  fh.rewind
  if array.length > limit/step
    array.shift

    if not array.join.index("open")
      `s2ram`
    end
  end
  sleep step
end


-- 
http://polite.se