diff --git a/auto_cpufreq/bin/auto_cpufreq.py b/auto_cpufreq/bin/auto_cpufreq.py index 15849ca..7192366 100755 --- a/auto_cpufreq/bin/auto_cpufreq.py +++ b/auto_cpufreq/bin/auto_cpufreq.py @@ -114,7 +114,7 @@ def main(monitor, live, daemon, install, update, remove, force, config, stats, g config_info_dialog() root_check() file_stats() - if IS_INSTALLED_WITH_SNAP and dcheck == "enabled": + if IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "enabled": gnome_power_detect_snap() tlp_service_detect_snap() elif not IS_INSTALLED_WITH_SNAP: diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index 2e74c42..21ad7c4 100755 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -15,7 +15,7 @@ from warnings import filterwarnings from auto_cpufreq.config.config import config from auto_cpufreq.globals import ( - ALL_GOVERNORS, AVAILABLE_GOVERNORS, AVAILABLE_GOVERNORS_SORTED, GITHUB, IS_INSTALLED_WITH_AUR, IS_INSTALLED_WITH_SNAP, POWER_SUPPLY_DIR + ALL_GOVERNORS, AVAILABLE_GOVERNORS, AVAILABLE_GOVERNORS_SORTED, GITHUB, IS_INSTALLED_WITH_AUR, IS_INSTALLED_WITH_SNAP, POWER_SUPPLY_DIR, SNAP_DAEMON_CHECK ) from auto_cpufreq.power_helper import * @@ -55,9 +55,6 @@ else: auto_cpufreq_stats_path = Path("/var/run/auto-cpufreq.stats") governor_override_state = Path("/opt/auto-cpufreq/override.pickle") -# daemon check -dcheck = getoutput("snapctl get daemon") - def file_stats(): global auto_cpufreq_stats_file auto_cpufreq_stats_file = open(auto_cpufreq_stats_path, "w") @@ -917,7 +914,7 @@ def running_daemon_check(): if is_running("auto-cpufreq", "--daemon"): daemon_running_msg() exit(1) - elif IS_INSTALLED_WITH_SNAP and dcheck == "enabled": + elif IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "enabled": daemon_running_msg() exit(1) @@ -926,6 +923,6 @@ def not_running_daemon_check(): if not is_running("auto-cpufreq", "--daemon"): daemon_not_running_msg() exit(1) - elif IS_INSTALLED_WITH_SNAP and dcheck == "disabled": + elif IS_INSTALLED_WITH_SNAP and SNAP_DAEMON_CHECK == "disabled": daemon_not_running_msg() exit(1) diff --git a/auto_cpufreq/globals.py b/auto_cpufreq/globals.py index d19c992..1339baf 100644 --- a/auto_cpufreq/globals.py +++ b/auto_cpufreq/globals.py @@ -10,3 +10,4 @@ GITHUB = "https://github.com/AdnanHodzic/auto-cpufreq" IS_INSTALLED_WITH_AUR = path.isfile("/etc/arch-release") and bool(getoutput("pacman -Qs auto-cpufreq")) IS_INSTALLED_WITH_SNAP = getenv("PKG_MARKER") == "SNAP" POWER_SUPPLY_DIR = "/sys/class/power_supply/" +SNAP_DAEMON_CHECK = getoutput("snapctl get daemon") \ No newline at end of file