#!/usr/bin/env bash
case "$1" in
  status)
    powerprofilesctl get | grep -q power-saver && echo true || echo false
    ;;
  *)
    if powerprofilesctl get | grep -q power-saver; then
      powerprofilesctl set balanced 2>/dev/null || true
      echo false
    else
      powerprofilesctl set power-saver 2>/dev/null || true
      echo true
    fi
    ;;
esac
