You are not logged in.

#1 2015-12-09 08:15:04

wchouser3
Member
From: Indiana USA
Registered: 2013-08-13
Posts: 161
Website

how do I get backlight to dim automatically when switching to battery

I got an HP with a Radeon driver (open-source) I use "Light" (from the AUR) to control the screen brightness. Is there a udev rule or something i can write to change the backlight depending on ACPI events, specifically the power being plugged and unplugged? I don't want to install a bulky power manager.

Thanks


If you can't be helpful, don't say anything at all. Fair enough?

Offline

#2 2015-12-10 21:27:13

halocaridina
Member
From: US
Registered: 2014-07-21
Posts: 77

Re: how do I get backlight to dim automatically when switching to battery

I use this combination of rules in /etc/udev/rules.d.

98-backlight.rules
# Adjust screen brightness according to power state
# 1st rule for when on AC
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority", RUN+="/usr/bin/xbacklight -set 75"
# 2nd rule for when on battery
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority", RUN+="/usr/bin/xbacklight -set 35"
99-backlight_notification.rules
# Notification sound when screen brightness is changed according to power state
# When unplugging
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="0", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority" RUN+="/usr/local/bin/brightness_notification.sh"
# When plugging in
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Mains", ATTR{online}=="1", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/YOUR_USERNAME/.Xauthority" RUN+="/usr/local/bin/brightness_notification.sh"
/usr/local/bin/brightness_notification.sh
#!/bin/bash

/usr/bin/aplay /home/YOUR_USERNAME/.i3/sounds/Click1.wav

4X Intel(R) Xeon(R) CPU E7-8870 @ 2.40GHz; 256GiB; 11TB EXT4; SL6.8
2X Intel(R) Xeon(R) CPU E5-2680 @ 2.70GHz; 256GiB; 3.4TB EXT4; SL6.8
Thinkpad X250; Broadwell-ULT Core i5; 8GiB, 525GB Crucial_CT525MX3; Arch
Thinkpad T440S; Haswell-ULT Core i7; 12GiB, 512GB SanDisk X210; Arch

Offline

Board footer

Powered by FluxBB