Skip to content

Instantly share code, notes, and snippets.

@Cybolic
Created March 23, 2017 12:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cybolic/8ba4b6350826c8e5ad5eb23dcbf627d2 to your computer and use it in GitHub Desktop.
Save Cybolic/8ba4b6350826c8e5ad5eb23dcbf627d2 to your computer and use it in GitHub Desktop.
CPU governor selector for Argos
#!/usr/bin/env bash
echo "CPU | iconName=cpu"
echo "---"
echo "---"
GOVERNORS=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors)
SELECTED=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
for governor in $GOVERNORS; do
# Capitalize the governor name
governor_name="$(echo $governor | cut -c1 | tr [:lower:] [:upper:])$(echo $governor | cut -c2-)"
# Mark current governor in bold
if [[ "$SELECTED" == "$governor" ]]; then
governor_name="<b>${governor_name}</b>"
fi
# Output name and command
echo "${governor_name} | useMarkup=true refresh=true terminal=false bash='echo $governor | pkexec tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment