From 64af2b4ec64371a06d7a4de508ea3e63858132a6 Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Sat, 24 Aug 2024 12:15:18 +0200 Subject: [PATCH] Make certain dialogs clearer & fix superfluous snap message --- auto_cpufreq/power_helper.py | 20 ++++++++++++-------- scripts/auto-cpufreq-install.sh | 6 +++--- scripts/auto-cpufreq-remove.sh | 4 ++-- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/auto_cpufreq/power_helper.py b/auto_cpufreq/power_helper.py index 4b502e7..0abe6b5 100644 --- a/auto_cpufreq/power_helper.py +++ b/auto_cpufreq/power_helper.py @@ -58,8 +58,12 @@ def gnome_power_detect(): if systemctl_exists and not bool(gnome_power_status): warning() print("Detected running GNOME Power Profiles daemon service!") - print("This daemon might interfere with auto-cpufreq and will be automatically disabled.") - print("\nSteps to perform this action using auto-cpufreq: power_helper script:") + print("\nThis daemon might interfere with auto-cpufreq and will be automatically") + print("disabled when auto-cpufreq daemon is installed and") + print("it will be re-enabled after auto-cpufreq is removed.") + + print("\nOnly necessary to be manually done on Snap package installs!") + print("Steps to perform this action using auto-cpufreq: power_helper script:") print(f"git clone {GITHUB}.git") print("cd auto-cpufreq/auto_cpufreq") print("python3 power_helper.py --gnome_power_disable") @@ -70,9 +74,9 @@ def gnome_power_detect_install(): if systemctl_exists and not bool(gnome_power_status): warning() print("Detected running GNOME Power Profiles daemon service!") - print("This daemon might interfere with auto-cpufreq and has been disabled.\n") + print("\nThis daemon might interfere with auto-cpufreq and has been disabled.\n") print('This daemon is not automatically disabled in "monitor" mode and') - print("will be enabled after auto-cpufreq is removed.\n") + print("will be enabled after auto-cpufreq daemon is removed.") # notification on snap @@ -128,7 +132,7 @@ def gnome_power_svc_status(): def bluetooth_disable(): if IS_INSTALLED_WITH_SNAP: bluetooth_notif_snap() elif bluetoothctl_exists: - print("* Turn off bluetooth on boot") + print("* Turn off bluetooth on boot (can be turned on any time later on!)") btconf = Path("/etc/bluetooth/main.conf") try: orig_set = "AutoEnable=true" @@ -175,7 +179,7 @@ def gnome_power_rm_reminder(): if systemctl_exists and bool(gnome_power_status): warning() print("Detected GNOME Power Profiles daemon service is stopped!") - print("This service will now be enabled and started again.") + print("This service will now be enabled and started again.\n") def gnome_power_rm_reminder_snap(): @@ -229,8 +233,8 @@ def gnome_power_svc_disable(): print("There was a problem, couldn't determine GNOME Power Profiles Daemon") snap_pkg_check = 0 - if not bool(gnome_power_status) and powerprofilesctl_exists: - if snap_pkg_check == 1: + if snap_pkg_check == 1: + if not bool(gnome_power_status) and powerprofilesctl_exists: print("auto-cpufreq snap package not installed.\nGNOME Power Profiles Daemon should be enabled, run:\n\n" "sudo python3 power_helper.py --gnome_power_enable" ) diff --git a/scripts/auto-cpufreq-install.sh b/scripts/auto-cpufreq-install.sh index c1ba37c..1e962aa 100755 --- a/scripts/auto-cpufreq-install.sh +++ b/scripts/auto-cpufreq-install.sh @@ -7,9 +7,9 @@ MID="$((`tput cols` / 2))" echo -printf "%0.s─" $(seq $((MID-(${#1}/2)-2))) +printf "%0.s─" $(seq $(( (MID-(${#1}/2)-2) / 2 ))) printf " Running auto-cpufreq daemon install script " -printf "%0.s─" $(seq $((MID-(${#1}/2)-2))) +printf "%0.s─" $(seq $(( (MID-(${#1}/2)-2) / 2 ))) echo; echo # root check @@ -69,7 +69,7 @@ case "$(ps h -o comm 1)" in fi ;; systemd) - echo -e "\n* Deploying auto-cpufreq systemd unit file" + echo -e "Deploying auto-cpufreq systemd unit file" cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq.service /etc/systemd/system/auto-cpufreq.service echo -e "\n* Reloading systemd manager configuration" diff --git a/scripts/auto-cpufreq-remove.sh b/scripts/auto-cpufreq-remove.sh index 8c1f83a..66636a1 100755 --- a/scripts/auto-cpufreq-remove.sh +++ b/scripts/auto-cpufreq-remove.sh @@ -7,9 +7,9 @@ MID="$((`tput cols` / 2))" echo -printf "%0.s─" $(seq $((MID-(${#1}/2)-2))) +printf "%0.s─" $(seq $(( (MID-(${#1}/2)-2) / 2 ))) printf " Running auto-cpufreq daemon removal script " -printf "%0.s─" $(seq $((MID-(${#1}/2)-2))) +printf "%0.s─" $(seq $(( (MID-(${#1}/2)-2) / 2 ))) echo; echo # root check