Compare commits

..

10 Commits

Author SHA1 Message Date
260a39d734 Update script names
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2023-10-03 14:33:48 +01:00
95c3fb7660 Update touchpad identifier
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2023-09-02 10:48:05 +03:00
7c159bd497 Clean up
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2023-05-08 10:56:53 +01:00
d759fea31b Add modprobe.d files
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2023-05-08 02:24:22 +01:00
85718e2bbd Update power saving script 2022-04-14 00:36:04 +03:00
16e71fef1e Update power script notifications 2022-02-08 15:21:16 +00:00
458652a7de tfw I had mouse accel on this entire time :( 2022-02-04 11:15:03 +04:00
e87066957a Finally learned how xorg config files work 2022-02-04 11:10:56 +04:00
99cf81dbf9 Revert power udev rule 2021-12-31 00:33:27 +02:00
a16f334d3b Update 'README.md' 2021-12-30 14:28:51 +02:00
13 changed files with 81 additions and 72 deletions

View File

@@ -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

View 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
View 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

View File

@@ -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
View 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

View File

@@ -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

View File

@@ -0,0 +1 @@
blacklist sp5100_tco

1
modprobe.d/thinkpad.conf Normal file
View File

@@ -0,0 +1 @@
options thinkpad_acpi fan_control=1

2
modprobe.d/touchpad.conf Normal file
View File

@@ -0,0 +1,2 @@
softdep i2c_hid pre: pinctrl_amd
softdep usbhid pre: pinctrl_amd

View File

@@ -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"

View File

@@ -1,6 +0,0 @@
Section "Screen"
Identifier "Screen 0"
Subsection "Display"
Modes "2560x1600_165"
EndSubsection
EndSection