Guest User

Untitled

a guest
Nov 22nd, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. newState=$1
  4. startFile="/sys/class/power_supply/BAT0/charge_start_threshold"
  5. stopFile="/sys/class/power_supply/BAT0/charge_stop_threshold"
  6.  
  7. if [ $newState == "help" ]
  8. then
  9. echo "full 0-100 ; desk 45-50 ; daily 75-80"
  10. fi
  11.  
  12. if [ $newState == "full" ]
  13. then
  14. echo 0 | sudo tee $startFile
  15. echo 100 | sudo tee $stopFile
  16. fi
  17.  
  18. if [ $newState == "desk" ]
  19. then
  20. echo 45 | sudo tee $startFile
  21. echo 50 | sudo tee $stopFile
  22. fi
  23.  
  24. if [ $newState == "daily" ]
  25. then
  26. echo 75 | sudo tee $startFile
  27. echo 80 | sudo tee $stopFile
  28. fi
  29.  
  30. echo "start threshold is set to $(cat $startFile)"
  31. echo "stop threshold is set to $(cat $stopFile)"
  32.  
Advertisement
Add Comment
Please, Sign In to add comment