Merge branch 'non-systemd-gnome-power'
This commit is contained in:
commit
1909cc87c1
|
@ -21,33 +21,36 @@ def helper_opts():
|
||||||
|
|
||||||
# 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":
|
||||||
try:
|
if which("systemctl") is not None:
|
||||||
gnome_power_stats = call(["systemctl", "is-active", "--quiet", "power-profiles-daemon"])
|
try:
|
||||||
except:
|
gnome_power_stats = call(["systemctl", "is-active", "--quiet", "power-profiles-daemon"])
|
||||||
print("\nUnable to determine init system")
|
except:
|
||||||
print("If this causes any problems, please submit an issue:")
|
print("\nUnable to determine init system")
|
||||||
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
print("If this causes any problems, please submit an issue:")
|
||||||
|
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
||||||
|
|
||||||
# alert in case gnome power profile service is running
|
# alert in case gnome power profile service is running
|
||||||
def gnome_power_detect():
|
def gnome_power_detect():
|
||||||
if gnome_power_stats == 0:
|
if which("systemctl") is not None:
|
||||||
print("\n----------------------------------- Warning -----------------------------------\n")
|
if gnome_power_stats == 0:
|
||||||
print("Detected running GNOME Power Profiles daemon service!")
|
print("\n----------------------------------- Warning -----------------------------------\n")
|
||||||
print("This daemon might interfere with auto-cpufreq and should be disabled.")
|
print("Detected running GNOME Power Profiles daemon service!")
|
||||||
print("\nSteps to perform this action using auto-cpufreq: power_helper script:")
|
print("This daemon might interfere with auto-cpufreq and should be disabled.")
|
||||||
print("git clone https://github.com/AdnanHodzic/auto-cpufreq.git")
|
print("\nSteps to perform this action using auto-cpufreq: power_helper script:")
|
||||||
print("cd auto-cpufreq/auto_cpufreq")
|
print("git clone https://github.com/AdnanHodzic/auto-cpufreq.git")
|
||||||
print("python3 power_helper.py --gnome_power_disable")
|
print("cd auto-cpufreq/auto_cpufreq")
|
||||||
|
print("python3 power_helper.py --gnome_power_disable")
|
||||||
|
|
||||||
|
|
||||||
# automatically disable gnome power profile service in case it's running during install
|
# automatically disable gnome power profile service in case it's running during install
|
||||||
def gnome_power_detect_install():
|
def gnome_power_detect_install():
|
||||||
if gnome_power_stats == 0:
|
if which("systemctl") is not None:
|
||||||
print("\n----------------------------------- Warning -----------------------------------\n")
|
if gnome_power_stats == 0:
|
||||||
print("Detected running GNOME Power Profiles daemon service!")
|
print("\n----------------------------------- Warning -----------------------------------\n")
|
||||||
print("This daemon might interfere with auto-cpufreq and has been disabled.\n")
|
print("Detected running GNOME Power Profiles daemon service!")
|
||||||
print("Disabled daemon is not automatically disabled in \"live\" and \"monitor\" mode and")
|
print("This daemon might interfere with auto-cpufreq and has been disabled.\n")
|
||||||
print("will be enabled after auto-cpufreq is removed.")
|
print("Disabled daemon is not automatically disabled in \"live\" and \"monitor\" mode and")
|
||||||
|
print("will be enabled after auto-cpufreq is removed.")
|
||||||
|
|
||||||
# notification on snap
|
# notification on snap
|
||||||
def gnome_power_detect_snap():
|
def gnome_power_detect_snap():
|
||||||
|
@ -68,41 +71,44 @@ def gnome_power_disable_live():
|
||||||
|
|
||||||
# disable gnome >= 40 power profiles (install)
|
# disable gnome >= 40 power profiles (install)
|
||||||
def gnome_power_svc_disable():
|
def gnome_power_svc_disable():
|
||||||
try:
|
if which("systemctl") is not None:
|
||||||
print("\n* Disabling GNOME power profiles")
|
try:
|
||||||
call(["systemctl", "stop", "power-profiles-daemon"])
|
print("\n* Disabling GNOME power profiles")
|
||||||
call(["systemctl", "disable", "power-profiles-daemon"])
|
call(["systemctl", "stop", "power-profiles-daemon"])
|
||||||
call(["systemctl", "mask", "power-profiles-daemon"])
|
call(["systemctl", "disable", "power-profiles-daemon"])
|
||||||
call(["systemctl", "daemon-reload"])
|
call(["systemctl", "mask", "power-profiles-daemon"])
|
||||||
except:
|
call(["systemctl", "daemon-reload"])
|
||||||
print("\nUnable to disable GNOME power profiles")
|
except:
|
||||||
print("If this causes any problems, please submit an issue:")
|
print("\nUnable to disable GNOME power profiles")
|
||||||
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
print("If this causes any problems, please submit an issue:")
|
||||||
|
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
||||||
|
|
||||||
|
|
||||||
# enable gnome >= 40 power profiles (uninstall)
|
# enable gnome >= 40 power profiles (uninstall)
|
||||||
def gnome_power_svc_enable():
|
def gnome_power_svc_enable():
|
||||||
try:
|
if which("systemctl") is not None:
|
||||||
print("\n* Enabling GNOME power profiles")
|
try:
|
||||||
call(["systemctl", "unmask", "power-profiles-daemon"])
|
print("\n* Enabling GNOME power profiles")
|
||||||
call(["systemctl", "start", "power-profiles-daemon"])
|
call(["systemctl", "unmask", "power-profiles-daemon"])
|
||||||
call(["systemctl", "enable", "power-profiles-daemon"])
|
call(["systemctl", "start", "power-profiles-daemon"])
|
||||||
call(["systemctl", "daemon-reload"])
|
call(["systemctl", "enable", "power-profiles-daemon"])
|
||||||
except:
|
call(["systemctl", "daemon-reload"])
|
||||||
print("\nUnable to enable GNOME power profiles")
|
except:
|
||||||
print("If this causes any problems, please submit an issue:")
|
print("\nUnable to enable GNOME power profiles")
|
||||||
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
print("If this causes any problems, please submit an issue:")
|
||||||
|
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
||||||
|
|
||||||
|
|
||||||
# gnome power profiles current status
|
# gnome power profiles current status
|
||||||
def gnome_power_svc_status():
|
def gnome_power_svc_status():
|
||||||
try:
|
if which("systemctl") is not None:
|
||||||
print("* GNOME power profiles status")
|
try:
|
||||||
call(["systemctl", "status", "power-profiles-daemon"])
|
print("* GNOME power profiles status")
|
||||||
except:
|
call(["systemctl", "status", "power-profiles-daemon"])
|
||||||
print("\nUnable to see GNOME power profiles status")
|
except:
|
||||||
print("If this causes any problems, please submit an issue:")
|
print("\nUnable to see GNOME power profiles status")
|
||||||
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
print("If this causes any problems, please submit an issue:")
|
||||||
|
print("https://github.com/AdnanHodzic/auto-cpufreq/issues")
|
||||||
|
|
||||||
|
|
||||||
# disable bluetooth on boot
|
# disable bluetooth on boot
|
||||||
|
@ -161,10 +167,11 @@ def bluetooth_on_notif_snap():
|
||||||
|
|
||||||
# gnome power removal reminder
|
# gnome power removal reminder
|
||||||
def gnome_power_rm_reminder():
|
def gnome_power_rm_reminder():
|
||||||
if gnome_power_stats != 0:
|
if which("systemctl") is not None:
|
||||||
print("\n----------------------------------- Warning -----------------------------------\n")
|
if gnome_power_stats != 0:
|
||||||
print("Detected GNOME Power Profiles daemon service is stopped!")
|
print("\n----------------------------------- Warning -----------------------------------\n")
|
||||||
print("This service will now be enabled and started again.")
|
print("Detected GNOME Power Profiles daemon service is stopped!")
|
||||||
|
print("This service will now be enabled and started again.")
|
||||||
|
|
||||||
def gnome_power_rm_reminder_snap():
|
def gnome_power_rm_reminder_snap():
|
||||||
print("\n----------------------------------- Warning -----------------------------------\n")
|
print("\n----------------------------------- Warning -----------------------------------\n")
|
||||||
|
|
Loading…
Reference in New Issue