Compare commits
10 Commits
e129a1db38
...
260a39d734
Author | SHA1 | Date | |
---|---|---|---|
260a39d734 | |||
95c3fb7660 | |||
7c159bd497 | |||
d759fea31b | |||
85718e2bbd | |||
16e71fef1e | |||
458652a7de | |||
e87066957a | |||
99cf81dbf9 | |||
a16f334d3b |
17
README.md
17
README.md
@@ -4,15 +4,22 @@ 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.
|
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
|
- `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
|
- `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
|
- `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`.
|
||||||
|
|
||||||
|
- `sp5100-watchdog.conf`: Disables the sp5100 watchdog module which causes watchdot warnings in the kernel log
|
||||||
|
- `thinkpad.conf`: Sets fan_control=1 for thinkpad_acpi to enable fan control
|
||||||
|
- `touchpad.conf`: Fixes a module-loading race condition that causes the touchpad to not work on boot
|
||||||
|
|
||||||
Files in the `udev` folder should be placed in `/etc/udev/rules.d` and owned by `root`.
|
Files in the `udev` folder should be placed in `/etc/udev/rules.d` and owned by `root`.
|
||||||
|
|
||||||
- `backlight.rules`: Gives normal users access to backlight controls
|
- `backlight.rules`: Gives normal users access to backlight controls
|
||||||
- `touchpad_input.rules`: Maps the touchpad's variable `/dev/input/event*` path to the static `/dev/input/touchpad` for VFIO passthrough
|
- `touchpad_input.rules`: Maps the touchpad's variable `/dev/input/event*` path to the static `/dev/input/touchpad` for VFIO passthrough
|
||||||
|
|
||||||
FIles in the `xorg` folder should be placed in `/etc/X11/xorg.conf.d` and owned by `root`.
|
Files in the `X11` folder should be placed in `/usr/share/X11/xorg.conf.d` and owned by `root`.
|
||||||
|
|
||||||
- `10-monitor.conf`: Enables 165Hz on boot.
|
- `10-nvidia-refresh-rate.conf`: Enables 165Hz on boot when using the nvidia driver
|
||||||
|
- `20-mouse-options.conf`: Sets options for touchpad and mouse
|
||||||
|
6
X11/10-nvidia-refresh-rate.conf
Normal file
6
X11/10-nvidia-refresh-rate.conf
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Section "Screen"
|
||||||
|
Identifier "Screen 0"
|
||||||
|
Subsection "Display"
|
||||||
|
Modes "2560x1600_165"
|
||||||
|
EndSubsection
|
||||||
|
EndSection
|
15
X11/20-mouse-options.conf
Normal file
15
X11/20-mouse-options.conf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
Section "InputClass"
|
||||||
|
Identifier "SYNA2BA6:00 06CB:CE44 Touchpad"
|
||||||
|
MatchProduct "SYNA2BA6:00 06CB:CE44 Touchpad"
|
||||||
|
Option "TransformationMatrix" "5 0 0 0 5 0 0 0 1"
|
||||||
|
Option "AccelProfile" "flat"
|
||||||
|
Option "NaturalScrolling" "on"
|
||||||
|
Option "Tapping" "off"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "pointer:Razer Razer DeathAdder Elite"
|
||||||
|
MatchProduct "Razer Razer DeathAdder Elite"
|
||||||
|
MatchIsPointer "on"
|
||||||
|
Option "AccelProfile" "flat"
|
||||||
|
EndSection
|
@@ -9,7 +9,9 @@ if [ "$Mode" -eq "1" ]
|
|||||||
then
|
then
|
||||||
echo 0 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
|
echo 0 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
|
||||||
echo "Battery Conservation Mode is now inactive"
|
echo "Battery Conservation Mode is now inactive"
|
||||||
|
sudo -u nick DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Battery Conservation Mode is now inactive"
|
||||||
else
|
else
|
||||||
echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
|
echo 1 > /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode
|
||||||
echo "Battery Conservation Mode is now active"
|
echo "Battery Conservation Mode is now active"
|
||||||
|
sudo -u nick DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Battery Conservation Mode is now active"
|
||||||
fi
|
fi
|
42
bin/power-saving-mode
Normal file
42
bin/power-saving-mode
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Run as sudo
|
||||||
|
[ "$UID" -eq 0 ] || exec sudo -E "$0" "$@"
|
||||||
|
|
||||||
|
STATE_FILE="/tmp/power_saving_mode"
|
||||||
|
[ -f "$STATE_FILE" ] && STATE=$(cat "$STATE_FILE") || STATE="performance"
|
||||||
|
|
||||||
|
if [ "$STATE" == "powersave" ]; then
|
||||||
|
# Set CPU scaling governor
|
||||||
|
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 _ 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
|
||||||
|
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 _ 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
|
@@ -1,59 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Run as sudo
|
|
||||||
[ "$UID" -eq 0 ] || exec sudo -E "$0" "$@"
|
|
||||||
|
|
||||||
if grep -q powersave "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor";
|
|
||||||
then
|
|
||||||
# Set CPU scaling governor
|
|
||||||
for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor;
|
|
||||||
do
|
|
||||||
echo "schedutil" > $file;
|
|
||||||
done
|
|
||||||
# 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
|
|
||||||
# Set composition settings
|
|
||||||
sed -i 's/100:class_g/95:class_g/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/background_opacity: 1.00/background_opacity: 0.95/g' /home/nick/.config/alacritty/alacritty.yml
|
|
||||||
sed -i 's/"glassit.alpha": 255,/"glassit.alpha": 242,/g' /home/nick/.config/Code/User/settings.json
|
|
||||||
sed -i 's/blur-background = false;/blur-background = true;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/shadow = false;/shadow = true;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/fading = false;/fading = true;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
# Restart compositor
|
|
||||||
pkill picom
|
|
||||||
sleep .2
|
|
||||||
picom -b
|
|
||||||
# Done
|
|
||||||
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
|
|
||||||
# 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
|
|
||||||
# Kill music visualizer
|
|
||||||
pkill glava
|
|
||||||
# Set composition settings
|
|
||||||
sed -i 's/95:class_g/100:class_g/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/background_opacity: 0.95/background_opacity: 1.00/g' /home/nick/.config/alacritty/alacritty.yml
|
|
||||||
sed -i 's/"glassit.alpha": 242,/"glassit.alpha": 255,/g' /home/nick/.config/Code/User/settings.json
|
|
||||||
sed -i 's/blur-background = true;/blur-background = false;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/shadow = true;/shadow = false;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
sed -i 's/fading = true;/fading = false;/g' /home/nick/.config/picom/picom.conf
|
|
||||||
# Restart compositor
|
|
||||||
pkill picom
|
|
||||||
sleep .2
|
|
||||||
picom -b
|
|
||||||
# Done
|
|
||||||
sudo -u nick DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus notify-send "Power Saving Mode is now active"
|
|
||||||
fi
|
|
1
modprobe.d/sp5100-watchdog.conf
Normal file
1
modprobe.d/sp5100-watchdog.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
blacklist sp5100_tco
|
1
modprobe.d/thinkpad.conf
Normal file
1
modprobe.d/thinkpad.conf
Normal file
@@ -0,0 +1 @@
|
|||||||
|
options thinkpad_acpi fan_control=1
|
2
modprobe.d/touchpad.conf
Normal file
2
modprobe.d/touchpad.conf
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
softdep i2c_hid pre: pinctrl_amd
|
||||||
|
softdep usbhid pre: pinctrl_amd
|
@@ -1,2 +0,0 @@
|
|||||||
ACTION=="add", SUBSYSTEM=="pci", TEST=="power/control" ATTR{power/control}="auto"
|
|
||||||
ACTION=="add", SUBSYSTEM=="usb", TEST=="power/control" ATTR{power/control}="auto"
|
|
@@ -1,6 +0,0 @@
|
|||||||
Section "Screen"
|
|
||||||
Identifier "Screen 0"
|
|
||||||
Subsection "Display"
|
|
||||||
Modes "2560x1600_165"
|
|
||||||
EndSubsection
|
|
||||||
EndSection
|
|
Reference in New Issue
Block a user