laptop_hacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
laptop_hacks [2018/09/19 16:25] – [Power Disconnect/Connect events] admin | laptop_hacks [2020/02/08 16:41] (current) – [Laptop Hacks] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
=====Laptop Hacks===== | =====Laptop Hacks===== | ||
- | Ho boy, this got difficult really quickly - in 2011 I had everything working on my laptop (Dell XPS-15 L502X) with the LXDE spin of fedora plus fluxbox. After a quick spurt of travel using all the laptoppy things like conserving battery life, suspend/ | + | Ho boy, this got difficult really quickly - in 2011 I had everything working on my laptop (Dell XPS-15 L502X) with the LXDE spin of fedora plus fluxbox. After a quick spurt of travel using all the laptoppy things like conserving battery life, suspend/ |
Maybe it'll help you too - but you will almost certainly need to some make tweaks for your particular setup. | Maybe it'll help you too - but you will almost certainly need to some make tweaks for your particular setup. | ||
Line 46: | Line 46: | ||
These events come through DBus, so I run this in my '' | These events come through DBus, so I run this in my '' | ||
- | # if there' | + | # if there' |
upower -e |grep -q battery && { | upower -e |grep -q battery && { | ||
power-monitor & | power-monitor & | ||
Line 238: | Line 238: | ||
and run '' | and run '' | ||
+ | |||
+ | brightness is this: | ||
+ | |||
+ | #!/bin/bash | ||
+ | | ||
+ | # since xbacklight isn't working (nouveau?) | ||
+ | # https:// | ||
+ | | ||
+ | # needs to be run as root | ||
+ | | ||
+ | NEW_VALUE=${1: | ||
+ | | ||
+ | # base dir for backlight class | ||
+ | basedir="/ | ||
+ | | ||
+ | # get the backlight handler | ||
+ | handler=$basedir$(ls $basedir |head -n 1)"/" | ||
+ | | ||
+ | # get current brightness | ||
+ | old_brightness=$(cat $handler" | ||
+ | | ||
+ | # get max brightness | ||
+ | max_brightness=$(cat $handler" | ||
+ | | ||
+ | # 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" | ||
+ | } | ||
+ | | ||
====Disable nouveau==== | ====Disable nouveau==== | ||
laptop_hacks.1537395944.txt.gz · Last modified: 2018/09/19 16:25 by admin