mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-27 07:34:25 +02:00
Stop power-profiles-daemon in live mode (#350)
* Stop power-profiles-daemon on live mode * switch to gnome_power_detect_install
This commit is contained in:
parent
73d3c26882
commit
1673583304
@ -31,6 +31,7 @@ def does_command_exists(cmd):
|
|||||||
systemctl_exists = does_command_exists("systemctl")
|
systemctl_exists = does_command_exists("systemctl")
|
||||||
bluetoothctl_exists = does_command_exists("bluetoothctl")
|
bluetoothctl_exists = does_command_exists("bluetoothctl")
|
||||||
tlp_stat_exists = does_command_exists("tlp-stat")
|
tlp_stat_exists = does_command_exists("tlp-stat")
|
||||||
|
powerprofilesctl_exists = does_command_exists("powerprofilesctl")
|
||||||
|
|
||||||
# detect if gnome power profile service is running
|
# detect if gnome power profile service is running
|
||||||
if os.getenv("PKG_MARKER") != "SNAP":
|
if os.getenv("PKG_MARKER") != "SNAP":
|
||||||
@ -94,7 +95,7 @@ def gnome_power_detect_install():
|
|||||||
)
|
)
|
||||||
print("Detected running GNOME Power Profiles daemon service!")
|
print("Detected running GNOME Power Profiles daemon service!")
|
||||||
print("This daemon might interfere with auto-cpufreq and has been disabled.\n")
|
print("This daemon might interfere with auto-cpufreq and has been disabled.\n")
|
||||||
print('Disabled daemon is not automatically disabled in "live" and "monitor" mode and')
|
print('This daemon is not automatically disabled in "monitor" mode and')
|
||||||
print("will be enabled after auto-cpufreq is removed.")
|
print("will be enabled after auto-cpufreq is removed.")
|
||||||
|
|
||||||
|
|
||||||
@ -109,18 +110,24 @@ def gnome_power_detect_snap():
|
|||||||
print("python3 power_helper.py --gnome_power_disable")
|
print("python3 power_helper.py --gnome_power_disable")
|
||||||
|
|
||||||
|
|
||||||
# disable gnome >= 40 power profiles (live)
|
# stops gnome >= 40 power profiles (live)
|
||||||
def gnome_power_disable_live():
|
def gnome_power_stop_live():
|
||||||
if gnome_power_status == 0:
|
if systemctl_exists:
|
||||||
call(["powerprofilesctl", "set", "balanced"])
|
if gnome_power_status == 0 and powerprofilesctl_exists:
|
||||||
call(["systemctl", "stop", "power-profiles-daemon"])
|
call(["powerprofilesctl", "set", "balanced"])
|
||||||
|
call(["systemctl", "stop", "power-profiles-daemon"])
|
||||||
|
|
||||||
|
# starts gnome >= 40 power profiles (live)
|
||||||
|
def gnome_power_start_live():
|
||||||
|
if systemctl_exists:
|
||||||
|
call(["systemctl", "start", "power-profiles-daemon"])
|
||||||
|
|
||||||
|
|
||||||
# disable gnome >= 40 power profiles (install)
|
# disable gnome >= 40 power profiles (install)
|
||||||
def gnome_power_svc_disable():
|
def gnome_power_svc_disable():
|
||||||
if systemctl_exists:
|
if systemctl_exists:
|
||||||
# set balanced profile before disabling it
|
# set balanced profile if its running before disabling it
|
||||||
if gnome_power_status == 0:
|
if gnome_power_status == 0 and powerprofilesctl_exists:
|
||||||
call(["powerprofilesctl", "set", "balanced"])
|
call(["powerprofilesctl", "set", "balanced"])
|
||||||
|
|
||||||
# always disable power-profiles-daemon
|
# always disable power-profiles-daemon
|
||||||
|
@ -108,17 +108,23 @@ def main(config, daemon, debug, install, live, log, monitor, stats, version, don
|
|||||||
gnome_power_detect_snap()
|
gnome_power_detect_snap()
|
||||||
tlp_service_detect_snap()
|
tlp_service_detect_snap()
|
||||||
else:
|
else:
|
||||||
gnome_power_detect()
|
gnome_power_detect_install()
|
||||||
|
gnome_power_stop_live()
|
||||||
tlp_service_detect()
|
tlp_service_detect()
|
||||||
while True:
|
while True:
|
||||||
running_daemon()
|
try:
|
||||||
footer()
|
running_daemon()
|
||||||
gov_check()
|
footer()
|
||||||
cpufreqctl()
|
gov_check()
|
||||||
distro_info()
|
cpufreqctl()
|
||||||
sysinfo()
|
distro_info()
|
||||||
set_autofreq()
|
sysinfo()
|
||||||
countdown(5)
|
set_autofreq()
|
||||||
|
countdown(5)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
gnome_power_start_live()
|
||||||
|
print("")
|
||||||
|
sys.exit()
|
||||||
elif stats:
|
elif stats:
|
||||||
config_info_dialog()
|
config_info_dialog()
|
||||||
print('\nNote: You can quit stats mode by pressing "ctrl+c"')
|
print('\nNote: You can quit stats mode by pressing "ctrl+c"')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user