Closed tukusejssirs closed 2 years ago
This issue is related to #42, which might describe the same issue, but a bit different use case.
It seems like I’ve made a mistake in the code of the issues description. I misquoted $(< /dev/shm/kbbl_prev); rm -f /dev/shm/kbbl_prev
instead of only $(< /dev/shm/kbbl_prev)
.
The following is a working code:
exec swayidle -w timeout 5 '
if pgrep -x swaylock; then
swaymsg "output * dpms off"
brightnessctl -d "tpacpi::kbd_backlight" g > /dev/shm/kbbl_prev
brightnessctl -qd "tpacpi::kbd_backlight" s 0; fi
' resume '
if [ -f /dev/shm/kbbl_prev ]; then
swaymsg "output * dpms on"
brightnessctl -qd "tpacpi::kbd_backlight" s "$(< /dev/shm/kbbl_prev)"
rm -f /dev/shm/kbbl_prev
fi
'
I have the following in my Sway config:
What it does is when
swaylock
is running, after timeout of 5 seconds turn off the screen and the keyboard backlight.Everything behaves as expected, but when
swaylock
is not running and I let the system be idle for at least 5 seconds, then move my TrackPoint, the keyboard backlight is turned off.The culprit is the
/dev/shm/kbbl_prev
file. If it contains0
(which turns the keyboard backlight off), but also I think there is an issue inswayidle
, because it should:true
branch ofif
intimout
whenswaylock
is not running;resume
, it should remove/dev/shm/kbbl_prev
, but it fails to do so.Anyway, if someone knows of a better way to let the
resume
part know what was the previous state of the keyboard backlight (in my case, it can be one of0
,1
or2
), I’d be very, very greatful.