mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-23 21:55:09 +02:00
Remove GNOME Power Profiles Daemon performance install
This commit is contained in:
parent
f574257dc4
commit
471611de7d
@ -129,7 +129,7 @@ def gnome_power_start_live():
|
|||||||
def gnome_power_svc_enable():
|
def gnome_power_svc_enable():
|
||||||
if systemctl_exists:
|
if systemctl_exists:
|
||||||
try:
|
try:
|
||||||
print("\n* Enabling GNOME power profiles")
|
print("* Enabling GNOME power profiles\n")
|
||||||
call(["systemctl", "unmask", "power-profiles-daemon"])
|
call(["systemctl", "unmask", "power-profiles-daemon"])
|
||||||
call(["systemctl", "start", "power-profiles-daemon"])
|
call(["systemctl", "start", "power-profiles-daemon"])
|
||||||
call(["systemctl", "enable", "power-profiles-daemon"])
|
call(["systemctl", "enable", "power-profiles-daemon"])
|
||||||
@ -256,95 +256,50 @@ def disable_power_profiles_daemon():
|
|||||||
|
|
||||||
# default gnome_power_svc_disable func (balanced)
|
# default gnome_power_svc_disable func (balanced)
|
||||||
def gnome_power_svc_disable():
|
def gnome_power_svc_disable():
|
||||||
if systemctl_exists:
|
|
||||||
# set balanced profile if its running before disabling it
|
|
||||||
if gnome_power_status == 0 and powerprofilesctl_exists:
|
|
||||||
print("Using profile: ", "balanced")
|
|
||||||
call(["powerprofilesctl", "set", "balanced"])
|
|
||||||
|
|
||||||
disable_power_profiles_daemon()
|
# check if snap package installed
|
||||||
|
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
|
||||||
# default gnome_power_svc_disable func (performance)
|
stdout=subprocess.DEVNULL,
|
||||||
def gnome_power_svc_disable_performance():
|
stderr=subprocess.STDOUT)
|
||||||
if systemctl_exists:
|
|
||||||
# set performance profile if its running before disabling it
|
|
||||||
if gnome_power_status == 0 and powerprofilesctl_exists:
|
|
||||||
print("Using profile: ", "performance")
|
|
||||||
call(["powerprofilesctl", "set", "performance"])
|
|
||||||
|
|
||||||
disable_power_profiles_daemon()
|
|
||||||
|
|
||||||
|
|
||||||
# cli
|
|
||||||
@click.pass_context
|
|
||||||
# external gnome power srevice disable function
|
|
||||||
def gnome_power_svc_disable_ext(ctx, power_selection):
|
|
||||||
raw_power_disable = ctx.params["gnome_power_disable"]
|
|
||||||
gnome_power_disable = str(raw_power_disable).replace('[','').replace(']','').replace(",", "").replace("(","").replace(")","").replace("'","")
|
|
||||||
|
|
||||||
if systemctl_exists:
|
if systemctl_exists:
|
||||||
# 0 is active
|
# 0 is active
|
||||||
if gnome_power_status != 0:
|
if gnome_power_status != 0:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
|
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
# check if snapd is present and if snap package is installed | 0 is success
|
# check if snapd is present and if snap package is installed | 0 is success
|
||||||
if snap_pkg_check == 0:
|
if snap_pkg_check == 0:
|
||||||
print("Power Profiles Daemon is already disabled, re-enable by running:\n"
|
print("GNOME Power Profiles Daemon is already disabled, it can be re-enabled by running:\n"
|
||||||
|
"sudo python3 power_helper.py --gnome_power_enable\n"
|
||||||
|
)
|
||||||
|
elif snap_pkg_check == 1:
|
||||||
|
print("auto-cpufreq snap package not installed, GNOME Power Profiles Daemon should be enabled:\n"
|
||||||
|
"sudo python3 power_helper.py --gnome_power_enable"
|
||||||
|
)
|
||||||
|
|
||||||
|
except:
|
||||||
|
# snapd not found on the system
|
||||||
|
print("There was a problem, couldn't determine GNOME Power Profiles Daemon")
|
||||||
|
|
||||||
|
if gnome_power_status == 0 and powerprofilesctl_exists:
|
||||||
|
|
||||||
|
if snap_pkg_check == 1:
|
||||||
|
print("auto-cpufreq snap package not installed.\n\nGNOME Power Profiles Daemon should be enabled:\n"
|
||||||
"sudo python3 power_helper.py --gnome_power_enable\n"
|
"sudo python3 power_helper.py --gnome_power_enable\n"
|
||||||
"\nfollowed by running:\n"
|
|
||||||
"sudo python3 power_helper.py --gnome_power_disable"
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
# snapd present, snap package not installed
|
print("auto-cpufreq snap package installed, GNOME Power Profiles Daemon should be disabled.\n")
|
||||||
print("Power Profiles Daemon is already disabled, first remove auto-cpufreq:\n"
|
print("Using profile: ", "balanced")
|
||||||
"sudo auto-cpufreq --remove\n"
|
call(["powerprofilesctl", "set", "balanced"])
|
||||||
"\nfollowed by installing auto-cpufreq in performance mode:\n"
|
|
||||||
"sudo auto-cpufreq --install_performance"
|
|
||||||
)
|
|
||||||
|
|
||||||
except FileNotFoundError:
|
|
||||||
# snapd not found on the system
|
|
||||||
print("Power Profiles Daemon is already disabled, first remove auto-cpufreq:\n"
|
|
||||||
"sudo auto-cpufreq --remove\n"
|
|
||||||
"\nfollowed by installing auto-cpufreq in performance mode:\n"
|
|
||||||
"sudo auto-cpufreq --install_performance"
|
|
||||||
)
|
|
||||||
|
|
||||||
# set balanced profile if its running before disabling it
|
|
||||||
if gnome_power_status == 0 and powerprofilesctl_exists:
|
|
||||||
# 0 is success (snap package is installed)
|
|
||||||
|
|
||||||
try:
|
|
||||||
snap_pkg_check = call(['snap', 'list', '|', 'grep', 'auto-cpufreq'],
|
|
||||||
stdout=subprocess.DEVNULL,
|
|
||||||
stderr=subprocess.STDOUT)
|
|
||||||
|
|
||||||
if snap_pkg_check == 0:
|
|
||||||
#if snap_exist == 0 and snap_pkg_install == 0:
|
|
||||||
print("Using profile: ", gnome_power_disable)
|
|
||||||
call(["powerprofilesctl", "set", gnome_power_disable])
|
|
||||||
|
|
||||||
disable_power_profiles_daemon()
|
disable_power_profiles_daemon()
|
||||||
else:
|
|
||||||
print("Install auto-cpufreq in performance mode by running:\n"
|
|
||||||
"sudo auto-cpufreq --install_performance\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("Install auto-cpufreq in performance mode by running:\n"
|
|
||||||
"sudo auto-cpufreq --install_performance\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
|
# cli
|
||||||
@click.command()
|
@click.command()
|
||||||
@click.option("--gnome_power_disable", help="Disable GNOME Power profiles service (default: balanced), reference:\n https://bit.ly/3bjVZW1", type=click.Choice(['balanced', 'performance'], case_sensitive=False))
|
#@click.option("--gnome_power_disable", help="Disable GNOME Power profiles service (default: balanced), reference:\n https://bit.ly/3bjVZW1", type=click.Choice(['balanced', 'performance'], case_sensitive=False))
|
||||||
|
@click.option("--gnome_power_disable", is_flag=True, help="Disable GNOME Power profiles service")
|
||||||
# ToDo:
|
# ToDo:
|
||||||
# * update readme/docs
|
# * update readme/docs
|
||||||
@click.option("--power_selection", hidden=True)
|
|
||||||
@click.option("--gnome_power_enable", is_flag=True, help="Enable GNOME Power profiles service")
|
@click.option("--gnome_power_enable", is_flag=True, help="Enable GNOME Power profiles service")
|
||||||
|
|
||||||
@click.option("--gnome_power_status", is_flag=True, help="Get status of GNOME Power profiles service"
|
@click.option("--gnome_power_status", is_flag=True, help="Get status of GNOME Power profiles service"
|
||||||
@ -352,7 +307,6 @@ def gnome_power_svc_disable_ext(ctx, power_selection):
|
|||||||
@click.option("--bluetooth_boot_on", is_flag=True, help="Turn on Bluetooth on boot")
|
@click.option("--bluetooth_boot_on", is_flag=True, help="Turn on Bluetooth on boot")
|
||||||
@click.option("--bluetooth_boot_off", is_flag=True, help="Turn off Bluetooth on boot")
|
@click.option("--bluetooth_boot_off", is_flag=True, help="Turn off Bluetooth on boot")
|
||||||
def main(
|
def main(
|
||||||
power_selection,
|
|
||||||
gnome_power_enable,
|
gnome_power_enable,
|
||||||
gnome_power_disable,
|
gnome_power_disable,
|
||||||
gnome_power_status,
|
gnome_power_status,
|
||||||
@ -377,7 +331,7 @@ def main(
|
|||||||
elif gnome_power_disable:
|
elif gnome_power_disable:
|
||||||
header()
|
header()
|
||||||
root_check()
|
root_check()
|
||||||
gnome_power_svc_disable_ext(power_selection)
|
gnome_power_svc_disable()
|
||||||
helper_opts()
|
helper_opts()
|
||||||
footer()
|
footer()
|
||||||
elif gnome_power_status:
|
elif gnome_power_status:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user