Skip to content

SIGUSR1 gets queued up when idle inhibitor is active #51

Open
@daenney

Description

@daenney

This one's a bit peculiar. When an idle inhibitor is active (I use Waybar's idle_inhibitor module for this, which uses the associated Wayland protocol) sending a SIGUSR1 to swayidle does nothing (this is correct, since the system can't be considered idle). However, the second you turn off the idle inhibitor swayidle believes the system is idle, and thus locks.

I think this is confusing and unexpected, especially since idle inhibition can be active for long periods of time after which your system might surprise lock on you if you forgot you triggered swayidle some way (for example through a lockcmd shortcut in sway).

I would expect that while the idle inhibitor is active, swayidle would discard requests to enter idle state, instead of seemingly delaying processing them.

~ ❯❯❯ /usr/bin/swayidle -w -d \
      timeout 300 'swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png' \
      timeout 600 'swaymsg "output * dpms off"' \
      resume 'swaymsg "output * dpms on"' \
      lock 'swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png' \
      before-sleep 'swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png'
Got timeout
Register idle timeout at 300000 ms
Setup idle
Command: swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Got timeout
Register idle timeout at 600000 ms
Setup idle
Command: swaymsg "output * dpms off"
Setup resume
Command: swaymsg "output * dpms on"
Got lock
Command: swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Setup lock hook: swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Got before-sleep
Command: swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Setup sleep lock: swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Got sleep lock: 11
Register with timeout: 600000
Register with timeout: 300000

---> Sent SIGUSR1

Got SIGUSR1
Register with timeout: 0
Register with timeout: 0
idle state
Cmd exec swaymsg "output * dpms off"
Spawned process swaymsg "output * dpms off"
idle state
Cmd exec swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Spawned process swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
active state
Register with timeout: 600000
Cmd exec swaymsg "output * dpms on"
Spawned process swaymsg "output * dpms on"
active state
Register with timeout: 300000

---> Activate Idle inhibitor
---> Sent SIGUSR1

Got SIGUSR1
Register with timeout: 0
Register with timeout: 0

---> Deactivate idle inhibitor

idle state
Cmd exec swaymsg "output * dpms off"
Spawned process swaymsg "output * dpms off"
idle state
Cmd exec swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Spawned process swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
active state
Register with timeout: 600000
Cmd exec swaymsg "output * dpms on"
Spawned process swaymsg "output * dpms on"
active state
Register with timeout: 300000

If I send multiple SIGUSR1's while the idle inhibitor is active you get this instead:

Got SIGUSR1
Register with timeout: 0
Register with timeout: 0
Got SIGUSR1
Register with timeout: 0
Register with timeout: 0
Got SIGUSR1
Register with timeout: 0
Register with timeout: 0
Got SIGUSR1
Register with timeout: 0
Register with timeout: 0

---> Deactivate idle inhibitor

idle state
Cmd exec swaymsg "output * dpms off"
Spawned process swaymsg "output * dpms off"
idle state
Cmd exec swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
Spawned process swaylock -f -c 000000 -i /home/daenney/Pictures/Rainbow_Dash_Wallpaper.png
active state
Register with timeout: 600000
Cmd exec swaymsg "output * dpms on"
Spawned process swaymsg "output * dpms on"
active state
Register with timeout: 300000

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions