Last active
January 26, 2025 22:15
-
-
Save JoveYu/7502a96214b877c2d8867f42754430ec to your computer and use it in GitHub Desktop.
Linux Lenovo Fn+Q Power Mode Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ACPI_BALANCE="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x000FB001" | |
ACPI_POWER="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0012B001" | |
ACPI_ECO="\_SB.PCI0.LPC0.EC0.VPC0.DYTC 0x0013B001" | |
ACPI_MODE="\_SB.PCI0.LPC0.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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would you suggest we add acpi to the user group of commands? As currently this app requires sudo password anytime we try to trigger/call in via the shortcut.
Or should we add this script to be executed without password for root?