nix/module/powersave/Script.nix

28 lines
435 B
Nix

# Script to control CPU boost.
{ controlFile, enable, disable, ... }: {
script = ''
function toggle() {
if status; then
echo ${disable} > ${controlFile}
else
echo ${enable} > ${controlFile}
fi
true
}
function waybar() {
status || echo -n "󰓅"
}
function status() {
local current=$(cat ${controlFile})
local enabled="${enable}"
[[ "''${current}" = "''${enabled}" ]]
}
''${@}
'';
}