From 73d3c268823e3570a1796ca4c5cd519c359f8fc1 Mon Sep 17 00:00:00 2001
From: bobslept <38557801+bobslept@users.noreply.github.com>
Date: Fri, 7 Jan 2022 21:26:39 +0100
Subject: [PATCH] Set Balanced mode on power-profiles-daemon (#349)

---
 auto_cpufreq/power_helper.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/auto_cpufreq/power_helper.py b/auto_cpufreq/power_helper.py
index ff5b8e1..a473895 100644
--- a/auto_cpufreq/power_helper.py
+++ b/auto_cpufreq/power_helper.py
@@ -112,12 +112,18 @@ def gnome_power_detect_snap():
 # disable gnome >= 40 power profiles (live)
 def gnome_power_disable_live():
     if gnome_power_status == 0:
+        call(["powerprofilesctl", "set", "balanced"])
         call(["systemctl", "stop", "power-profiles-daemon"])
 
 
 # disable gnome >= 40 power profiles (install)
 def gnome_power_svc_disable():
     if systemctl_exists:
+        # set balanced profile before disabling it
+        if gnome_power_status == 0:
+            call(["powerprofilesctl", "set", "balanced"])
+
+        # always disable power-profiles-daemon
         try:
             print("\n* Disabling GNOME power profiles")
             call(["systemctl", "stop", "power-profiles-daemon"])