laptop_hacks
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
laptop_hacks [2017/08/16 19:03] – [Laptop Hacks] 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. | ||
- | Why go through all this? Why not just use a full DE like KDE or gnome to take care of it? With KDE the best I could get (without digging just as deep as I have done here) was about 4 hours of battery life. By doing the hard work and understanding what's going on I can get up to 6.5 hours! Not bad. | + | Why go through all this? Why not just use a full DE like KDE or gnome to take care of it? With KDE the best I could get was about 4 hours of battery life. By doing the hard work and understanding what's going on I can get up to 6.5 hours! Not bad. |
====Who' | ====Who' | ||
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 && power-monitor & | + | upower -e |grep -q battery && |
+ | | ||
+ | xfce4-power-manager & | ||
+ | } | ||
Where, '' | Where, '' | ||
Line 54: | Line 57: | ||
| | ||
# needs to run as normal user under X (so that battery-alarm can popup) | # needs to run as normal user under X (so that battery-alarm can popup) | ||
+ | # requires dbus-python | ||
| | ||
import gobject, os, sys | import gobject, os, sys | ||
Line 218: | Line 222: | ||
| | ||
exit 0 | exit 0 | ||
+ | | ||
+ | To run stuff on ' | ||
+ | |||
+ | [Unit] | ||
+ | Description=Run on ' | ||
+ | After=suspend.target | ||
+ | | ||
+ | [Service] | ||
+ | User=root | ||
+ | Type=oneshot | ||
+ | ExecStart=/ | ||
+ | | ||
+ | [Install] | ||
+ | WantedBy=suspend.target | ||
+ | |||
+ | 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.1502931796.txt.gz · Last modified: 2017/08/16 19:03 by admin