diff --git a/auto-cpufreq-installer b/auto-cpufreq-installer index 4d76f03..8685682 100755 --- a/auto-cpufreq-installer +++ b/auto-cpufreq-installer @@ -183,6 +183,10 @@ function tool_remove { [ -f $srv_remove ] && rm $srv_remove [ -f $stats_file ] && rm $stats_file + # enable GNOME power profiles in case it was disabled by auto-cpufreq + systemctl start power-profiles-daemon + systemctl enable power-profiles-daemon + separator echo -e "\nauto-cpufreq tool and all its supporting files successfully removed." separator diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index 1cc86a5..8d9ff1f 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -352,6 +352,9 @@ def remove(): else: print("* Turn on bluetooth on boot [skipping] (package providing bluetooth access is not present)") + # enable gnome power profiles + gnome_power_enable() + # run auto-cpufreq daemon install script call("/usr/bin/auto-cpufreq-remove", shell=True) @@ -1083,3 +1086,33 @@ def running_daemon(): elif os.getenv("PKG_MARKER") == "SNAP" and dcheck == "enabled": daemon_running_msg() exit(1) + +# disable gnome >= 40 power profiles (live) +def gnome_power_disable_live(): + gnome_power_stats = call(["systemctl", "is-active", "--quiet", "power-profiles-daemon"]) + if(gnome_power_stats == 0): + print("Disabling GNOME power profiles") + call(["systemctl", "stop", "power-profiles-daemon"]) + #call(["systemctl", "mask", "power-profiles-daemon"]) + else: + print("GNOME power already disabled") + +# disable gnome >= 40 power profiles (install) +def gnome_power_disable(): + gnome_power_stats = call(["systemctl", "is-active", "--quiet", "power-profiles-daemon"]) + if(gnome_power_stats == 0): + print("Disabling GNOME power profiles") + call(["systemctl", "stop", "power-profiles-daemon"]) + call(["systemctl", "disable", "power-profiles-daemon"]) + else: + print("GNOME power already disabled") + +# enable gnome >= 40 power profiles (uninstall) +def gnome_power_enable(): + gnome_power_stats = call(["systemctl", "is-active", "--quiet", "power-profiles-daemon"]) + if(gnome_power_stats == 0): + print("Enabling GNOME power profiles") + call(["systemctl", "start", "power-profiles-daemon"]) + call(["systemctl", "enable", "power-profiles-daemon"]) + else: + print("GNOME power already enabled") \ No newline at end of file diff --git a/bin/auto-cpufreq b/bin/auto-cpufreq index 86060fe..a1ff4b4 100755 --- a/bin/auto-cpufreq +++ b/bin/auto-cpufreq @@ -83,6 +83,7 @@ def main(config, daemon, debug, install, live, log, monitor, stats, version, don elif live: config_info_dialog() print("\nNote: You can quit live mode by pressing \"ctrl+c\"") + gnome_power_disable_live() time.sleep(1) while True: root_check() @@ -138,6 +139,7 @@ def main(config, daemon, debug, install, live, log, monitor, stats, version, don if os.getenv('PKG_MARKER') == "SNAP": root_check() running_daemon() + gnome_power_disable() gov_check() run("snapctl set daemon=enabled", shell=True) run("snapctl start --enable auto-cpufreq", shell=True) @@ -145,6 +147,7 @@ def main(config, daemon, debug, install, live, log, monitor, stats, version, don else: root_check() running_daemon() + gnome_power_disable() gov_check() deploy_daemon() deploy_complete_msg() diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2855a30..c1607ec 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: auto-cpufreq base: core20 -version: '1.7.2' +version: '1.8.0' summary: Automatic CPU speed & power optimizer for Linux description: | Automatic CPU speed & power optimizer for Linux based on active