Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeouts are handled in the "wrong" order with SIGUSR1 #54

Open
jomority opened this issue Jan 27, 2020 · 7 comments
Open

timeouts are handled in the "wrong" order with SIGUSR1 #54

jomority opened this issue Jan 27, 2020 · 7 comments

Comments

@jomority
Copy link

When enabling idle state through with SIGUSR1 (pkill -USR1 swayidle), the events are processed in the reversed order than if they are activated through the regular timeout.

Take for example the following configuration:

swayidle -w -d \
    timeout 300 'swaylock-blur -- -f' \
    timeout 600 'swaymsg "output * dpms off"' \
    resume 'swaymsg "output * dpms on"'

Normally, first (after 5min) the screen gets locked by swaylock(-blur), and then (after 10min) the screen gets blanked.
With USR1, these commands are executed in the opposite order: First the screen gets blanked, then it gets locked.
This is a problem in this case, because swaylock-blur needs the display to generate the lock image for swaylock.

Is this behavior intentional?

A workaround would be to use timeout 600 'sh -c \'sleep 3 && swaymsg "output * dpms off"\'&', but this seems to be buggy (the display doesn't turn on anymore).

@emersion
Copy link
Member

Is this behavior intentional?

Right now the order is undefined. What would be the "right behaviour"?

  • Execute commands in the order specified on the CLI?
  • Sort by timeout value?
  • Something else?

@jomority
Copy link
Author

I would expect it to be sorted by timeout value.
Currently it seems to be the reversed CLI or reversed timeout order.

@maringuu
Copy link
Contributor

I would also expect them to be sorted by timeout value.
Still I think that sorting by order specified in the config/CLI would be the right approach since it allows custom ordering and does not disallow ordering by timeout value.

@nlbrown2
Copy link

nlbrown2 commented Feb 8, 2021

I'd also expect them to be handled by timeout value, the same way they are handled when the computer is left idle. I think it would be (and is) weird that timeouts are handled differently between being idle and SIGUSR1. If desired, I can try to put up a pull request for this, but I'd like to do so only if there is a chance it will be merged.

@emersion
Copy link
Member

emersion commented Feb 8, 2021

Maybe it can be as simple as reversing a list insertion order (wl_list_insert inserts at head-of-list, need to add .prev to insert at end-of-list). Explicitly sorting by timeout value will be more involved, not sure we want that extra complexity.

@nlbrown2
Copy link

nlbrown2 commented Feb 8, 2021

This would allow for sorting by order in CLI, right? Just want to confirm I understand what you're saying.

Either way, I think having some defined order would be a nice improvement. If sorting by CLI is easiest, then I think that's a fine solution.

@aryklein
Copy link

aryklein commented Jun 3, 2022

Try executing pkill twice:

pkill -USR1 swayidle && pkill -USR1 swayidle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants