GPU throttle on lock
Problem
KDE Plasma kscreenlocker/powerdevil bug causing GPU to loop at high activity when screen is locked, wasting power and generating heat.
Solution
Systemd service that automatically throttles the discrete GPU (RX 7600 XT) to low performance mode when screen locks, and restores to auto mode when unlocked.
System Information
- OS: Arch Linux x86_64
- Kernel: 6.12.56-1-lts
- DE: KDE Plasma 6.5.1
- GPU (Discrete): AMD Radeon RX 7600 XT (card1 - PCI ID 1002:7480)
- GPU (Integrated): AMD Raphael iGPU (card0 - PCI ID 1002:164E)
- Date Implemented: November 2, 2025
Implementation Steps
1. Created GPU Throttle Script
File: /usr/local/bin/gpu-lock-throttle.sh
GPU_CARD="/sys/class/drm/card1/device/power_dpm_force_performance_level"
LOG_FILE="/var/log/gpu-throttle.log"
log_message() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
}
case "$1" in
lock)
echo "low" > "$GPU_CARD"
log_message "GPU throttled to low (screen locked)"
;;
unlock)
echo "auto" > "$GPU_CARD"
log_message "GPU restored to auto (screen unlocked)"
;;
*)
echo "Usage: $0 {lock|unlock}"
exit 1
;;
esac
Made executable:
sudo chmod +x /usr/local/bin/gpu-lock-throttle.sh
2. Created Lock Monitor Script
File: /usr/local/bin/gpu-lock-monitor.sh
# Monitor DBus for lock/unlock signals
dbus-monitor --session "type='signal',interface='org.freedesktop.ScreenSaver'" | while read -r line; do
if echo "$line" | grep -q "boolean true"; then
# Screen locked
pkexec /usr/local/bin/gpu-lock-throttle.sh lock
elif echo "$line" | grep -q "boolean false"; then
# Screen unlocked
pkexec /usr/local/bin/gpu-lock-throttle.sh unlock
fi
done
Made executable:
sudo chmod +x /usr/local/bin/gpu-lock-monitor.sh
3. Created Systemd User Service
File: ~/.config/systemd/user/gpu-throttle-on-lock.service
[Unit]
Description=Throttle GPU on screen lock
After=graphical-session.target
[Service]
Type=simple
ExecStart=/usr/local/bin/gpu-lock-monitor.sh
Restart=on-failure
[Install]
WantedBy=default.target
4. Created Polkit Rule for Password-less Execution
File: /etc/polkit-1/rules.d/50-gpu-throttle.rules
polkit.addRule(function(action, subject) {
if (action.id == "org.freedesktop.policykit.exec" &&
action.lookup("program") == "/usr/local/bin/gpu-lock-throttle.sh" &&
subject.user == "phil") {
return polkit.Result.YES;
}
});
5. Enabled and Started Service
systemctl --user enable gpu-throttle-on-lock.service
systemctl --user start gpu-throttle-on-lock.service