Skip to content

Instantly share code, notes, and snippets.

@dmitriysafronov
Forked from JoveYu/lenovo-fn-q.sh
Last active March 30, 2023 13:44
Show Gist options
  • Save dmitriysafronov/bc6784fe1a7318e611cd36458277c7d8 to your computer and use it in GitHub Desktop.
Save dmitriysafronov/bc6784fe1a7318e611cd36458277c7d8 to your computer and use it in GitHub Desktop.
Linux Lenovo Legion 82K6 Fn+Q Power Mode Script
#!/bin/bash
ACPI_BALANCE="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x000FB001"
ACPI_POWER="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0012B001"
ACPI_ECO="\_SB_.PC00.LPCB.EC0_.VPC0.DYTC 0x0013B001"
ACPI_MODE="\_SB_.PC00.LPCB.EC0_.SPMO"
MODE=$(sudo sh -c "echo '$ACPI_MODE' > /proc/acpi/call; tr -d '\0' < /proc/acpi/call")
MODE=${MODE:2}
TARGET=$(((MODE+1)%3))
case $TARGET in
0)
sudo sh -c "echo '$ACPI_BALANCE'> /proc/acpi/call; cat /proc/acpi/call; printf '\n'"
notify-send "Power Mode" "Intelligent Cooling"
;;
1)
sudo sh -c "echo '$ACPI_POWER' > /proc/acpi/call; cat /proc/acpi/call; printf '\n'"
notify-send "Power Mode" "Extreme Performance"
;;
2)
sudo sh -c "echo '$ACPI_ECO' > /proc/acpi/call; cat /proc/acpi/call; printf '\n'"
notify-send "Power Mode" "Battery Saving "
;;
esac
@logical-and
Copy link

logical-and commented Mar 30, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment