Update script names
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
@@ -4,9 +4,9 @@ Repository with various scripts/configs for Arch Linux on the Lenovo Legion 7 (2
|
||||
|
||||
Scripts in the `bin` folder should be placed in `/usr/local/bin` or a similar directory and given execute permissions.
|
||||
|
||||
- `brightness_up` and `brightness_down`: See which GPU is connected and control brightness using ACPI
|
||||
- `conservation_mode`: Toggle battery conservation mode which limits charge to 60% to preserve its health
|
||||
- `power_saving_mode`: Change CPU governor, brightness, and refresh rate to extend battery life
|
||||
- `brightness-up` and `brightness-down`: See which GPU is connected and control brightness using ACPI
|
||||
- `conservation-mode`: Toggle battery conservation mode which limits charge to 60% to preserve its health
|
||||
- `power-saving-mode`: Change CPU governor, brightness, and refresh rate to extend battery life
|
||||
|
||||
Files in the `modprobe.d` folder should be placed in `/etc/modprobe.d` and owned by `root`.
|
||||
|
||||
|
@@ -3,42 +3,40 @@
|
||||
# Run as sudo
|
||||
[ "$UID" -eq 0 ] || exec sudo -E "$0" "$@"
|
||||
|
||||
if grep -q powersave "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor";
|
||||
then
|
||||
STATE_FILE="/tmp/power_saving_mode"
|
||||
[ -f "$STATE_FILE" ] && STATE=$(cat "$STATE_FILE") || STATE="performance"
|
||||
|
||||
if [ "$STATE" == "powersave" ]; then
|
||||
# Set CPU scaling governor
|
||||
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
|
||||
do
|
||||
echo "schedutil" > $file;
|
||||
done
|
||||
cpupower frequency-set -g performance
|
||||
# Set refresh rate
|
||||
xrandr --output DP-4 --mode 2560x1600 --rate 165 > /dev/null 2>&1
|
||||
xrandr --output eDP --mode 2560x1600 --rate 165 > /dev/null 2>&1
|
||||
xrandr --output eDP-1 --mode 2560x1600 --rate 165 > /dev/null 2>&1
|
||||
# Set brightness
|
||||
for i in {1..4}; do brightness_up; done
|
||||
for _ in {1..4}; do brightness-up; done
|
||||
# Restart compositor
|
||||
pkill picom
|
||||
picom -b
|
||||
# Done
|
||||
echo "Power Saving Mode is now inactive"
|
||||
echo "performance" > "$STATE_FILE"
|
||||
sudo -u nick DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Power Saving Mode is now inactive"
|
||||
else
|
||||
# Set CPU scaling governor
|
||||
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
|
||||
do
|
||||
echo "powersave" > $file;
|
||||
done
|
||||
cpupower frequency-set -g powersave
|
||||
# Set refresh rate
|
||||
xrandr --output DP-4 --mode 2560x1600 --rate 60 > /dev/null 2>&1
|
||||
xrandr --output eDP --mode 2560x1600 --rate 60 > /dev/null 2>&1
|
||||
xrandr --output eDP-1 --mode 2560x1600 --rate 60 > /dev/null 2>&1
|
||||
# Set brightness
|
||||
for i in {1..4}; do brightness_down; done
|
||||
for _ in {1..4}; do brightness-down; done
|
||||
# Kill music visualizer
|
||||
pkill glava
|
||||
# Kill compositor
|
||||
pkill picom
|
||||
# Done
|
||||
echo "Power Saving Mode is now active"
|
||||
echo "powersave" > "$STATE_FILE"
|
||||
sudo -u nick DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Power Saving Mode is now active"
|
||||
fi
|
Reference in New Issue
Block a user