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
swayidle does not light up a screen upon pressing a key #2914
Comments
This is expected. Outputs are turned back on only if I'd also like a way to say to swayidle "please turn my outputs off", not sure if it's in scope. |
Maybe sway needs something like a oneshot
|
@SirCmpwn why did you close it? Shall I open a separate issue, unrelated to swayidle, on not being able to light up a screen? |
I mistook this for the earlier issue and thought I had forgotten to close it. |
You can light up a screen. Just run |
I was just stumbling upon the same thing, my usecase is: After that, swayidle exits only when the display comes back on. |
The problem is that swayidle wouldn't even get a resume event in that case, because the compositor only sends it if it considers it was idle when activity happens (can't really go around and notify every listener everytime something moves) We need to add a way to tell the compositor "from here on notify me the next time something happens" or something similar; I don't think there's any way to do that with the current protocols. Maybe just set a 0s idle timeout? Have you tried something like this (can improve the pkill if it works)? |
@martinetd: this won't work for multiple reasons: timeout 0 is not possible right now; but mainly, swayidle will not exit and thus the pkill will never be reached. However, it's of course limited in that it still doesn't detect other "dpms off" calls - but those could just be replaced with a 'oneshot ... off resume on' which could even be its own shortcut (swayidle --now?) or an alias. |
I have no idea what you're saying here. I just tried with timeout 1 and get what I would expect, but anyway as I said this can be improved and made into oneshot/whatever as you want it's just a user program (and you can always just fork it/maintain a local patch if Sircmpwn doesn't want to see that) Anyway, the interesting part of what I posted earlier is that you won't get a resume event unless you setup idle, so you need to create an immediate timer and fix that "timeout 0". No idle, no resume. |
I think, a way to move forward would be an addition to a protocol between |
As others have pointed out, this could be done by just handling SIGUSR1 in |
I've looked at the swayidle code now, and considered a few different things to accomplish this:
@Hi-Angel's solution seems also reasonable, though this would require a new RPC mechanism (or maybe just a registering a new WL event?), however, it would also likely cause side-effects, like in case a user wants to turn a secondary display off permanently. Thoughts? |
thought: read what I said; your "new protocol" is exactly requesting a new idle timer, possibly off the same manager, with a 0 timeout. |
Not necessarily, if combined with your 3-rd point. |
@martinetd but this means that now you can't set a timer to, say, 600 sec. to disable screens automatically. |
No. timers can coexist with different timings with no problem, you can have how many timers or how many idle managers you want in parallel. See what I wrote earlier. |
@martinetd but then if you implemented a zero-based timer, how would |
Err? Why would it not need a resume command? If you don't need a resume command, you don't need swayidle, just run the damn initial command. I'll repeat myself one last time: you need something to ask the compositor to tell you when there is activity. Basically what you need here is to add a new more/handle an event/whatever that would let you first execute a command and immediately enter idle state, to be able to wake up screens on first activity, then destroy that thing. a 0-timer would be just that: create timer, (run your thing now or run it on the immediate idle event), run resume command when it comes, kill timer. I do not care what kind of API you give to that, you can execute the same command for all resume events or you can do them individually (it'd make more sense to do them individually if you only want to shutdown a single screen one-shot e.g. for video playback on one screen with multiscreen, but that's not my problem), but this doesn't need anything new. It's a pure user/client program, and that doesn't need anything more from the compositor, just do it and send a PR. (TLDR: I'm sorry if you think that's rude, I'm just tired of repeating what I consider to be the same thing over and over; I won't reply to this issue anymore.) |
@martinetd you misinterpreted what I said, I meant that when screens are turned on, But whatever.
Now that I'm reading these two paragraphs, I'm completely confused. I just not sure how to interpret the I think, to lessen confusion it would help if you pulled up some example of how would your idea be used to implement a generic DPMS (which is "disable screens either on timer or explicitly, then enable them back on the first activity").
No, you're not being rude, it's a technical discussion.
You did not repeat that, you wrote it once, and then were referring back to your first comment. Which, as it seems now, somewhat unclear to me. |
I also think it's possible to implement this feature with a zero timer.
We don't care about it. Turning screens on when they are on is a no-op. Additionally, it's unrelated to this issue -- it also happens with the current implementation.
No. Set up a timer with a zero timeout on SIGUSR1. When it expires, turn off screens. |
Well, then the question is 'how often that "no-op" gonna happen"? You don't want, for example, spam it on every activity, right? This is not good from battery perspective. This is why I'm asking an overall example of how would that be used to implement DPMS: because an overall example would also answer this trivia questions. |
As you set the new timer. That can be as you send a signal to the running swayidle, start the
I'm not talking about generic DPMS, I'm talking about the idle protocol; it can do DPMS if you want it to. I've stayed abstract because I don't want to impose anything, talking about commands because that's the current swayidle "interface" e.g. run commands when an idle/resume event comes
resume event isn't sent if you're not idle, you can create and destroy timers anytime, timers are independant. |
You only set up the zero timer on SIGUSR1, so this isn't a concern. |
If you need pseudo code, here:
Or as oneshot:
|
Note that we can drop |
Per this comment, the preferred way of lighting up the screen from dpms is through swayidle. Unfortunately, for me the screen remains dark even with swayidle running in background.
Steps to reproduce
swayidle timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
sleep 1 && swaymsg "output * dpms off"
Expected
Screens light up back
Actual
Screens stay black, and I see no way to light them up.
Additional info
sway build from today, commit a4d6835.
The text was updated successfully, but these errors were encountered: