#!/usr/bin/bash # veilor-power — power profile switcher # Usage: veilor-power [save|mid|perf|status] _switch() { sudo /usr/bin/tuned-adm profile "$1" } _status() { local profile gov epp boost asus freq profile=$(tuned-adm active 2>/dev/null | awk '{print $NF}') gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null) epp=$(cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference 2>/dev/null) boost=$(cat /sys/devices/system/cpu/cpufreq/boost 2>/dev/null) asus=$(cat /sys/devices/platform/asus-nb-wmi/throttle_thermal_policy 2>/dev/null || echo "n/a") freq=$(awk '{printf "%.0f MHz", $1/1000}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq 2>/dev/null) echo "Profile : $profile" echo "Governor: $gov | EPP: $epp | Boost: $boost" echo "ASUS TTP: $asus (0=perf 1=balanced 2=silent) | Cur freq: $freq" } case "$1" in save|powersave|s) _switch veilor-powersave ;; mid|balanced|b) _switch veilor-balanced ;; perf|performance|p) _switch veilor-performance ;; status|"") _status ;; *) echo "Usage: veilor-power [save|mid|perf|status]" echo " save — max battery (boost off, lowest PPT)" echo " mid — balanced (boost on, mid PPT)" echo " perf — performance (boost on, full PPT)" echo " status / no arg — show current state" ;; esac