Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust CPU frequency scaling on desktop to run in "performance" governor #162

Merged
merged 2 commits into from Feb 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions auto_cpufreq/core.py
Expand Up @@ -117,10 +117,16 @@ def charging():
"""
power_dir = "/sys/class/power_supply/"

# AC adapter states: 0, 1, unknown
ac_info = getoutput(f"grep . {power_dir}A*/online").splitlines()
# if there's one ac-adapter on-line, ac_state is True
ac_state = any(['1' in ac.split(':')[-1] for ac in ac_info])
computer_type = getoutput('hostnamectl status | grep Chassis | cut -f2 -d \":\" | tr -d \' \'')

if computer_type == "laptop":
# AC adapter states: 0, 1, unknown
ac_info = getoutput(f"grep . {power_dir}A*/online").splitlines()
# if there's one ac-adapter on-line, ac_state is True
ac_state = any(['1' in ac.split(':')[-1] for ac in ac_info])
else:
# if desktop ac_state is true
ac_state = True

# Possible values: Charging, Discharging, Unknown
battery_info = getoutput(f"grep . {power_dir}BAT*/status")
Expand Down