Closed orschiro closed 10 years ago
I was hoping that the After target will resolve a specific issue that I encountered. I start the following service on resume:
~ cat /usr/lib/systemd/system/powersaving-resume.service
[Unit]
Description=Run powersaving settings on resume
After=suspend.target
[Service]
Type=oneshot
ExecStart=/usr/bin/powersaving-helper
[Install]
WantedBy=suspend.target
This executes a brightness setting:
~ cat /usr/bin/powersaving-off
#!/bin/bash
# Turn off powersaving
echo "Running powersaving on AC"
# Setting environmental variables
export DISPLAY=:0
export XAUTHORITY=/home/orschiro/.Xauthority
# screen power saving
echo 14 > /sys/class/backlight/acpi_video0/brightness
This works perfectly without sxlock running on resume, too. However, for some reasons sxlock blocks the brightness from being changed.
Do you have any idea why this could happen?
Does the blacking of the screen somehow block the DISPLAY variable?
You do not need any DISPLAY
or XAUTHORITY
for changing values under /sys
, this should work even from console.
The interesting part is that sleep.target
contains StopWhenUnneeded=yes
, whereas suspend.target
and hibernate.target
do not. The quick fix for you is to use After=sleep.target
for your service, but this might be a bug in systemd.
@lahwaacz
Thanks, issue resolved by using After=sleep.target
!
This fixes some compatibility issues on resume with other application. Thus it is better to run sxlock after the suspend.target.