regolith-linux / regolith-powerd

Daemon to sync gsd power settings with Regolith on Wayland. Provides idle state functionality and sets power button action
1 stars 1 forks source link

Display won't suspend #10

Open Xeboc opened 2 days ago

Xeboc commented 2 days ago

I cannot seem to get the displays to sleep on my Intel Nuc desktop. The swayidle command that this program builds doesn't seem to handle a condition where I have screen blanking enabled in the gdm config, but automatic suspend off.

There's no dpms off command as part of the timeout, only as part of the sleep commands. This is the swayidle command being generated:

swayidle -w timeout 60
export curr_brightness=$(light)
echo $curr_brightness | tee $XDG_RUNTIME_DIR/screen_brightness_old.var
if [ 1 -eq "$(echo "${curr_brightness} > 30" | bc)" ]; then
light -S 30
fi
resume light -S $(cat $XDG_RUNTIME_DIR/screen_brightness_old.var)
before-sleep swaymsg output '*' dpms off;$(trawlcat wm.program.lock "gtklock -d --background $(trawlcat regolith.lockscreen.wallpaper.file /dev/null)");playerctl -a pause;sleep 1
after-resume swaymsg output '*' dpms on lock $(trawlcat wm.program.lock "gtklock -d --background $(trawlcat regolith.lockscreen.wallpaper.file /dev/null)")

on_ac_power exits with 1, since there are no (or incorrect) hardware indicators for main power:

on_ac_power 

echo $?
1
dconf dump /org/gnome/settings-daemon/plugins/power/

power-button-action='suspend'
sleep-inactive-ac-type='nothing'
sleep-inactive-battery-type='nothing'

Rust is a little tricky for me to read and there aren't many comments in this code, so I can't quite spot the issue. It appears as though the actions for on ac power (idle_action_ac_opt) are checked against on_ac_power.

Maybe this program could use systemd-ac-power?

systemd-ac-power

echo $?
0

Or maybe it is something else? Any suggestions?

kgilmer commented 7 hours ago

CC @SoumyaRanjanPatnaik