User Tools

Site Tools


laptop_hacks

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
laptop_hacks [2018/10/25 15:52] – [Power Disconnect/Connect events] adminlaptop_hacks [2020/02/08 16:40] – [Power Disconnect/Connect events] admin
Line 238: Line 238:
  
 and run ''systemctl enable bhepple-resume.service'' and run ''systemctl enable bhepple-resume.service''
 +
 +brightness is this:
 +
 +  #!/bin/bash
 +  
 +  # since xbacklight isn't working (nouveau?)
 +  # https://bbs.archlinux.org/viewtopic.php?id=134972 and modified:
 +  
 +  # needs to be run as root
 +  
 +  NEW_VALUE=${1:-0}
 +  
 +  # base dir for backlight class
 +  basedir="/sys/class/backlight/"
 +  
 +  # get the backlight handler
 +  handler=$basedir$(ls $basedir |head -n 1)"/"
 +  
 +  # get current brightness
 +  old_brightness=$(cat $handler"brightness")
 +  
 +  # get max brightness
 +  max_brightness=$(cat $handler"max_brightness")
 +  
 +  # get current brightness %
 +  old_brightness_p=$(( 100 * $old_brightness / $max_brightness ))
 +  
 +  # calculate new brightness %
 +  if [[ $NEW_VALUE == [+-]* ]]; then
 +      new_brightness_p=$(($old_brightness_p + $NEW_VALUE))
 +  else
 +      new_brightness_p=$NEW_VALUE
 +  fi
 +  
 +  # calculate new brightness value
 +  new_brightness=$(( $max_brightness * $new_brightness_p / 100 ))
 +  
 +  (( new_brightness <= max_brightness && new_brightness >= 0 )) && {
 +      # set the new brightness value
 +      echo $new_brightness > $handler"brightness"
 +  }
 +  
 ====Disable nouveau==== ====Disable nouveau====
  
laptop_hacks.txt · Last modified: 2020/02/08 16:41 by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki