Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

On Arch Linux on my laptop, I have acpid control the brightness level based on AC plug events. Plugging in gives me max brightness and running on battery sets it at the minimum.

My problem is that when I start the laptop, the brightness is always at the highest. That is, there isn't anything to trigger the brightness change, so it runs with the highest brightness.

How can I make it so that the brightness will set correctly on startup? I was thinking of creating a systemd service as a potential solution, but I have never written one before and I wanted to hold out for any alternative (potentially better) methods before I start.

UPDATE: I ended up using a udev rule, I was unaware of its ability to control things like brightness. I still have to keep acpid, however, since udev is apparently unable to pick up my laptop close event.

Anyway, here is the link to the rule I found: https://github.com/Unia/powersave/blob/master/rules/50-powersave.rules

share|improve this question
2  
Use a tmpfile: see the Arch Wiki entry... –  jasonwryan Apr 16 '13 at 6:17
2  
Post and accept your own answer if you have already found one. –  mtahmed Apr 16 '13 at 7:56
add comment

1 Answer

I borrowed Unia's udev rule to solve my problem of brightness on startup. It ended up letting me (almost) free myself from acpid.

SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="0", RUN+="/usr/bin/powersave true"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_ONLINE}=="1", RUN+="/usr/bin/powersave false"
KERNEL=="sr0", SUBSYSTEM=="block", ENV{POWER_SUPPLY_ONLINE}=="0", ENV{UDISKS_DISABLE_POLLING}="1"
KERNEL=="sr0", SUBSYSTEM=="block", ENV{POWER_SUPPLY_ONLINE}=="1", ENV{UDISKS_DISABLE_POLLING}="0"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.