24 lines
786 B
Bash
24 lines
786 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# prevent detection of lid state by unbinding it from the driver because for
|
||
|
# whatever fucking reason some fucking software keeps detecting it and
|
||
|
# suspending the laptop despite that being turned off
|
||
|
echo -n "Disabling lid switch... "
|
||
|
pushd /sys/bus/acpi/drivers/button/ > /dev/null
|
||
|
|
||
|
# get a list of registered buttons for ACPI actions (the janky way)
|
||
|
TEMP=$(find -maxdepth 1 -type l)
|
||
|
# go through the list and if the button has "LID" in its device path file, unbind it
|
||
|
while [ -n "$TEMP" ];
|
||
|
do
|
||
|
if [ $(grep -c "LID" $(echo "$TEMP" | head -n1)/path 2>/dev/null) -gt 0 ] 2>/dev/null
|
||
|
then
|
||
|
echo "$TEMP" | head -n1 | sed 's/^.\///' > unbind
|
||
|
fi
|
||
|
TEMP=$(echo "$TEMP" | sed "1d")
|
||
|
done
|
||
|
|
||
|
popd > /dev/null
|
||
|
echo "Done."
|
||
|
# lid button hopefully disabled
|