Code Sample |
#!/bin/bash LIDSTATE="open" while true do sleep 1s if grep open /proc/acpi/button/lid/C162/state >> /dev/null && [ "$LIDSTATE" == "closed" ]; then LIDSTATE="open" # Run commands to set you as 'Online'. elif grep closed /proc/acpi/button/lid/C162/state >> /dev/null; then LIDSTATE="closed" # Run commands to set you as 'away'. fi done |
Code Sample |
#!/bin/bash while true do sleep 1s LIDSTATE=`cat /proc/acpi/button/lid/C162/state` if [ "$LIDSTATE" == "closed" ]; then # Run commands to set you as 'away'. else # Run commands to set you as 'Online'. fi done |
Code Sample |
$ cat /proc/acpi/button/lid/C162/state state: open |