Comment by timonoko

3 days ago

@grok solved the termux being too dark problem:

In .bashrc:

  # Full brightness on entry
  termux-brightness 255
  
  # Auto-brightness based on light sensor on exit 
  LIGHT_VALUE=$(termux-sensor -s stk3a5x_als -n 1 | jq '.. | .values? | select(. != null) | .[0]')
  if [ -n "$LIGHT_VALUE" ]; then
      if (( $(echo "$LIGHT_VALUE > 1000" | bc -l) )); then
   trap 'termux-brightness auto' exit
      else
   trap 'termux-brightness 50' exit
      fi
  fi