8000 Automatically disable GNOME power profiles on install · aroundthfur/auto-cpufreq@db68390 · GitHub
[go: up one dir, main page]

Skip to content

Commit db68390

Browse files
committed
Automatically disable GNOME power profiles on install
1 parent fc5ac16 commit db68390

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

auto_cpufreq/core.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ def deploy_daemon():
312312
shutil.copy(SCRIPTS_DIR / "auto-cpufreq-remove.sh", "/usr/bin/auto-cpufreq-remove")
313313

314314
# output warning if gnome power profile is running
315-
gnome_power_detect()
315+
gnome_power_detect_install()
316+
gnome_power_svc_disable()
316317

317318
call("/usr/bin/auto-cpufreq-install", shell=True)
318319

@@ -331,6 +332,7 @@ def remove():
331332

332333
# output warning if gnome power profile is stopped
333334
gnome_power_rm_reminder()
335+
gnome_power_svc_enable()
334336

335337
# run auto-cpufreq daemon remove script
336338
call("/usr/bin/auto-cpufreq-remove", shell=True)

auto_cpufreq/power_helper.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ def gnome_power_detect():
3434
print("cd auto-cpufreq/auto_cpufreq")
3535
print("python3 power_helper.py --gnome-power-disable")
3636

37+
# automatically disable gnome power profile service in case it's running during install
38+
def gnome_power_detect_install():
39+
if gnome_power_stats == 0:
40+
print("\n----------------------------------- Warning -----------------------------------\n")
41+
print("Detected running GNOME Power Profiles daemon service!")
42+
print("This daemon might interfere with auto-cpufreq and has been disabled.")
43+
print("\nSteps to enabled disabled deamon (not recommended!) using auto-cpufreq: power_helper script:")
44+
print("git clone https://github.com/AdnanHodzic/auto-cpufreq.git")
45+
print("cd auto-cpufreq/auto_cpufreq")
46+
print("python3 power_helper.py --gnome-power-enable")
47+
3748

3849
# notification on snap
3950
def gnome_power_detect_snap():
@@ -54,25 +65,19 @@ def gnome_power_disable_live():
5465

5566
# disable gnome >= 40 power profiles (install)
5667
def gnome_power_svc_disable():
57-
if(gnome_power_stats == 0):
58-
print("* Disabling GNOME power profiles")
68+
print("\n* Disabling GNOME power profiles")
5969
call(["systemctl", "stop", "power-profiles-daemon"])
6070
call(["systemctl", "disable", "power-profiles-daemon"])
6171
call(["systemctl", "mask", "power-profiles-daemon"])
6272
call(["systemctl", "daemon-reload"])
63-
else:
64-
print("* GNOME power profiles already disabled")
6573

6674
# enable gnome >= 40 power profiles (uninstall)
6775
def gnome_power_svc_enable():
68-
if(gnome_power_stats != 0):
69-
print("* Enabling GNOME power profiles")
76+
print("\n* Enabling GNOME power profiles")
7077
call(["systemctl", "unmask", "power-profiles-daemon"])
7178
call(["systemctl", "start", "power-profiles-daemon"])
7279
call(["systemctl", "enable", "power-profiles-daemon"])
7380
call(["systemctl", "daemon-reload"])
74-
else:
75-
print("* GNOME power profiles already enabled")
7681

7782

7883
# gnome power profiles current status
@@ -140,12 +145,7 @@ def gnome_power_rm_reminder():
140145
if gnome_power_stats != 0:
141146
print("\n----------------------------------- Warning -----------------------------------\n")
142147
print("Detected GNOME Power Profiles daemon service is stopped!")
143-
print("Now it's recommended to enable this service.")
144-
print("\nSteps to perform this action using auto-cpufreq: power_helper script:")
145-
print("git clone https://github.com/AdnanHodzic/auto-cpufreq.git")
146-
print("cd auto-cpufreq/auto_cpufreq")
147-
print("python3 power_helper.py --gnome-power-enable")
148-
148+
print("This service will now be enabled again.")
149149

150150
def gnome_power_rm_reminder_snap():
151151
print("\n----------------------------------- Warning -----------------------------------\n")

0 commit comments

Comments
 (0)
0