You are not logged in.

#1 2022-06-17 13:05:46

zw
Member
Registered: 2022-05-31
Posts: 19

Brightness always at 50% after suspending

I installed Arch on a Macbook Pro 9,2 using the archinstall script with the LXQt desktop environment. I have also installed the Openbox and leftwm window managers.

In all three window managers, closing the laptop lid causes the backlight to turn off and seems to suspend the defice. But after opening the laptop lid (which triggers a suspend), the brightness is always reset to 50%. Same thing with restarting the computer.

My goal is to have the brightness return to whatever value it was at previously.

I do not know which program handles my computer's behavior upon closing/opening the laptop lid. I read online that it can be handled by either the window manager or by systemd itself, but I never configured anything relating to this, so I assume that the controller is systemd, but how can I find out for sure?

I have only slightly modified the contents of /etc/systemd/logind.conf:

[Login]
#NAutoVTs=6
#ReserveVT=6
KillUserProcesses=yes
#KillOnlyUsers=
#KillExcludeUsers=root
#InhibitDelayMaxSec=5
#UserStopDelaySec=10
#HandlePowerKey=poweroff
#HandlePowerKeyLongPress=ignore
#HandleRebootKey=reboot
#HandleRebootKeyLongPress=poweroff
#HandleSuspendKey=suspend
#HandleSuspendKeyLongPress=hibernate
#HandleHibernateKey=hibernate
#HandleHibernateKeyLongPress=ignore
#HandleLidSwitch=suspend
#HandleLidSwitchExternalPower=suspend
#HandleLidSwitchDocked=ignore
#PowerKeyIgnoreInhibited=no
#SuspendKeyIgnoreInhibited=no
#HibernateKeyIgnoreInhibited=no
#LidSwitchIgnoreInhibited=yes
#RebootKeyIgnoreInhibited=no
#HoldoffTimeoutSec=30s
#IdleAction=ignore
#IdleActionSec=30min
#RuntimeDirectorySize=10%
#RuntimeDirectoryInodesMax=
#RemoveIPC=yes
#InhibitorsMax=8192
#SessionsMax=8192

FWIW, I am able to control the screen backlight using the command brightnessctl --device="intel_backlight" set 5%. By including this command in my startup script for each window manager, I can solve the restart problem, but I still will have 50% brightness at the sddm login screen, so I would prefer a solution at the systemd level if possible.

Offline

#2 2022-06-18 11:00:48

zw
Member
Registered: 2022-05-31
Posts: 19

Re: Brightness always at 50% after suspending

I saw a similar issue on the Linux Mint forum and was able to create a workaround along similar lines. You can put this shell script in the /lib/systemd/system-sleep/ directory and it will run the pre) block when going to sleep and the post) block when waking:

#!/bin/sh
case $1 in
    pre)
        brightnessctl --device="intel_backlight" g > /tmp/backlight-brightness
        ;;
    post)
        brightnessctl --device="intel_backlight" set $(cat /tmp/backlight-brightness)
        rm -f /tmp/backlight-brightness
        ;;
esac

Then sudo chmod +x /lib/systemd/system-sleep/restore-backlight-brightness to make it executable.

I don't consider this a complete fix, though, because according to the system-sleep man page, "scripts or binaries dropped in /usr/lib/systemd/system-sleep/ are intended for local use only and should be considered hacks."

Offline

Board footer

Powered by FluxBB