Joined: July 2004
||Posted: April 12 2007,13:45
As usual, I can't help but pick at little optimization opportunities.
Is it necessary to check the "state" file _AND_ set a state variable explicitly?
To reduce redundancy and filesize, you can check the state file once and determine your action from that.
If you have only two possible options, "elif" is unnecessary
This is untested, since i don't have/use acpid or a laptop =o)
The LIDSTATE especially may not work, since i have no idea what the state file looks like.
|Code Sample |
if [ "$LIDSTATE" == "closed" ]; then
# Run commands to set you as 'away'.
# Run commands to set you as 'Online'.
Also seems to me that one second is a pretty high frequency. Raising that number would be easier on your processor. It's just an opinion, though.