BASH   76

lightswitch bash

Guest on 21st April 2022 01:33:40 AM

  1. #!/bin/bash
  2.  
  3. # To the end of /etc/sudoers, add
  4. # ALL ALL = (ALL) NOPASSWD: /usr/bin/tee /sys/class/leds/tpacpi\:\:thinklight/brightness
  5.  
  6. led="/sys/class/leds/tpacpi::thinklight/brightness"
  7. brightness=0
  8. if grep -q 0 "$led"; then
  9.   brightness=1
  10. fi
  11. echo "$brightness" | sudo /usr/bin/tee "$led"

Raw Paste


Login or Register to edit or fork this paste. It's free.