commit 315ab9e5b60f5811979500a7526a4ff51c38ff03
parent ab203592b6089d8fc214261aea97990eae1335fd
Author: Damian Myrda <damian@prime8.dev>
Date: Tue, 7 Apr 2026 12:11:43 -0500
refine battery tuned profile and ppd mapping
Diffstat:
5 files changed, 49 insertions(+), 43 deletions(-)
diff --git a/programs/tuned/battery-optimized/script.sh b/programs/tuned/battery-optimized/script.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/bash
+
+. /usr/lib/tuned/functions
+
+start() {
+ if command -v asusctl >/dev/null 2>&1; then
+ asusctl profile set Quiet || true
+ asusctl fan-curve --enable-fan-curves true --mod-profile quiet || true
+ fi
+ return 0
+}
+
+stop() {
+ return 0
+}
+
+process $@
diff --git a/programs/tuned/battery-optimized/tuned.conf b/programs/tuned/battery-optimized/tuned.conf
@@ -9,8 +9,8 @@ include=balanced-battery
# Blacklist SD card reader to save power (remove line if you use SD cards)
rtsx_pci=-r
[cpu]
-energy_performance_preference=power
-boost=0
+energy_performance_preference=balance_power
+boost=1
[net]
wifi_power_save=5
[audio]
@@ -27,10 +27,8 @@ kernel.nmi_watchdog=0
# Enable laptop mode - delays disk writes to reduce wakeups
vm.laptop_mode=5
[sysfs]
-# Platform profile - force low-power
+# Platform profile - keep fans quieter on battery
/sys/firmware/acpi/platform_profile=quiet
-# Disable CPU boost on battery
-/sys/devices/system/cpu/cpufreq/boost=0
# USB autosuspend for Logitech Receiver
/sys/bus/usb/devices/3-1/power/control=auto
# USB autosuspend for ITE Device (keyboard backlight controller)
@@ -74,3 +72,6 @@ vm.laptop_mode=5
# PCI Runtime PM - USB4 Router and NPU
/sys/bus/pci/devices/0000:67:00.0/power/control=auto
/sys/bus/pci/devices/0000:67:00.5/power/control=auto
+
+[script]
+script=${i:PROFILE_DIR}/script.sh
diff --git a/programs/tuned/network-optimized/disable-wifi-powersave.sh b/programs/tuned/network-optimized/disable-wifi-powersave.sh
@@ -1,26 +0,0 @@
-#!/bin/bash
-# Disable WiFi power save immediately and install NetworkManager dispatcher
-
-# 1. Disable power save right now (if WiFi is already up)
-for iface in $(iw dev 2>/dev/null | grep Interface | awk '{print $2}'); do
- iw dev "$iface" set power_save off 2>/dev/null && echo "Disabled power save on $iface"
-done
-
-# 2. Install dispatcher for persistent handling across reconnections
-DISPATCHER_FILE="/etc/NetworkManager/dispatcher.d/99-disable-wifi-powersave"
-
-if [ ! -f "$DISPATCHER_FILE" ]; then
- mkdir -p /etc/NetworkManager/dispatcher.d
- cat >"$DISPATCHER_FILE" <<'EOF'
-#!/bin/bash
-# Disable WiFi power save when connection goes up
-
-if [ "$2" = "up" ] || [ "$2" = "connectivity-change" ]; then
- for iface in $(iw dev 2>/dev/null | grep Interface | awk '{print $2}'); do
- iw dev "$iface" set power_save off 2>/dev/null
- done
-fi
-EOF
- chmod +x "$DISPATCHER_FILE"
- echo "Installed NetworkManager dispatcher: $DISPATCHER_FILE"
-fi
diff --git a/programs/tuned/network-optimized/tuned.conf b/programs/tuned/network-optimized/tuned.conf
@@ -1,12 +0,0 @@
-#
-# Custom tuned profile: network-optimized
-# Combines network-latency with WiFi power save disabled
-#
-
-[main]
-summary=Network optimized: Low latency + No WiFi power save
-include=network-latency
-
-[script]
-timeout=10
-script=${i:PROFILE_DIR}/disable-wifi-powersave.sh
diff --git a/setup.sh b/setup.sh
@@ -246,6 +246,32 @@ fi
# Symlink configs
"$SCRIPT_DIR/link.sh"
+# Map tuned-ppd balanced mode to battery-optimized profile
+if [ -d "/etc/tuned/profiles/battery-optimized" ]; then
+ echo "Configuring tuned-ppd profile mapping..."
+ sudo tee /etc/tuned/ppd.conf >/dev/null <<'EOF'
+[main]
+# The default PPD profile
+default=balanced
+battery_detection=true
+sysfs_acpi_monitor=true
+
+[profiles]
+# PPD = TuneD
+power-saver=powersave
+balanced=battery-optimized
+performance=throughput-performance
+
+[battery]
+# PPD = TuneD
+balanced=battery-optimized
+EOF
+
+ if systemctl list-unit-files --type=service | grep -q '^tuned-ppd\.service'; then
+ sudo systemctl restart tuned-ppd.service || true
+ fi
+fi
+
# Change default shell to fish
if command -v fish &>/dev/null; then
if [ "$SHELL" != "$(which fish)" ]; then