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

The idleness fullscreen option can totally disable idle watcher #255

Closed
tsujan opened this issue Apr 21, 2021 · 18 comments · Fixed by #256
Closed

The idleness fullscreen option can totally disable idle watcher #255

tsujan opened this issue Apr 21, 2021 · 18 comments · Fixed by #256
Assignees
Labels

Comments

@tsujan
Copy link
Member

tsujan commented Apr 21, 2021

I don't know if the following problem was there from start or happened after an upgrade because I only recently started to use the idle watcher.

Steps to Reproduce
  1. Set the idle time to one minute (to not waste your time) and set the action to "Turn off monitor(s)".
  2. Make a window fullscreen and leave the computer for one minute and a few seconds. The monitor will not be turned off, as it shouldn't.
  3. Exit the fullscreen state.

Then nothing will happen after one, two, three,.. minutes. The idle watcher will be magically disabled — or at least it is here (confirmation would be appreciated).

Solution

It seems that if KIdleTime::instance()->simulateUserActivity(); is called directly from inside the slot of KIdleTime::timeoutReached (as it is called in the code), no timeout will happen anymore.

This may be a bug in KIdleTime but the fix/workaround is easy: if KIdleTime::instance()->simulateUserActivity(); is called by QTimer::singleShot(), the problem will disappear.

System Information
  • Latest git LXQt
@tsujan tsujan added the bug label Apr 21, 2021
@tsujan tsujan self-assigned this Apr 21, 2021
@stefonarch
Copy link
Member

It says "minimum 1.30", so maybe one minute is too fast? Will test later.

@tsujan
Copy link
Member Author

tsujan commented Apr 21, 2021

so maybe one minute is too fast?

No, it isn't related to one minute. I suggested 1 minute only for a quick test. Please test and tell me the result!

Do you think we'll need a point release for this? If you confirm the issue and also its fix (I'll make a PR soon the PR has been made), making a point release will be easy.

tsujan added a commit that referenced this issue Apr 21, 2021
For whatever reason, if user activity is simulated inside the slot that is connected to `KIdleTime::timeoutReached`, `KIdleTime` won't time out anymore. The patch fixes the issue by using a singleshot timer.

Closes #255

NOTE: Simulating user activity is needed in this case because a window may lose its fullscreen state without the user's interaction (as when a video ends).
@stefonarch
Copy link
Member

Can confirm the issue by now.

@tsujan
Copy link
Member Author

tsujan commented Apr 21, 2021

Can confirm the issue by now.

Good.

And a point release?

@stefonarch
Copy link
Member

And a point release?

Sure, it's a bug. But we could ship also the idleness thing at this point.

tsujan added a commit that referenced this issue Apr 22, 2021
For whatever reason, if user activity is simulated inside the slot that is connected to `KIdleTime::timeoutReached`, `KIdleTime` won't time out anymore. The patch fixes the issue by using a singleshot timer.

Closes #255

NOTE: Simulating user activity is needed in this case because a window may lose its fullscreen state without the user's interaction (as when a video ends).
@stefonarch
Copy link
Member

It's some time I see our PC doesn't go in suspension always when idle.
I tracked down now the issue: idleness suspend works at session start, after one fullscreen of youtube and exit it doesn't work anymore.

@stefonarch stefonarch reopened this Jul 21, 2021
@tsujan
Copy link
Member Author

tsujan commented Jul 21, 2021

Only suspension?

@stefonarch
Copy link
Member

Only suspension?

Strange, looks like so, I switched to "lock screen" and it worked, switched back top suspend and it didn't.
Suspend itself works fine.

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

Strange, looks like so.

It's strange, indeed. It shows that the problem isn't in idle watcher. I'll test with my old laptop. If I encounter the problem, I'll open another report because this one was about idle watcher.

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

I tested and everything was OK. What I did:

  1. Chose suspension as the action, set the timeout to 1 min., and marked "Disable idleness checks when fullscreen".
  2. Played a Youtube video in fullscreen with Firefox and didn't touch keyboard or mouse.
  3. Let the video be played for a little more than one minute. Nothing happened, as expected.
  4. Exited the fullscreen mode, stopped the video, closed Firefox, didn't touch keyboard or mouse, and waited one minute.

The computer suspended after one minute, as expected.

I close this again because what you see is definitely not related to the idle watcher but please open another report if you're sure that you have the latest git on the computer, where you did the test. Please also include every step, even those that may seem unimportant.

@tsujan tsujan closed this as completed Jul 22, 2021
@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

In my 2nd test, I let the video be played for 5 minutes before stopping it and exiting Youtube's fullscreen mode but I didn't close Firefox afterward. Again, the laptop was suspended after one minute.

@stefonarch
Copy link
Member

In the meantime I tested on the laptop, both on AC and on battery, everything was fine.

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

Good.

So, your previous test happened on a desktop computer? Unfortunately, my desktop computer is too old and too slow; haven't turned it on for years and can't update anything on it.

@stefonarch
Copy link
Member

stefonarch commented Jul 22, 2021

Back on the Desktop PC; restarted session.
Unfortunately there are a lot of combinations now, with different AC and DC settings to test out.

Unfortunately, my desktop computer is too old and too slow; haven't turned it on for years and can't update anything on it.

You could try to remove the battery for testing?

What I found so far;

  • popup about no battery shows up and says it will disable, but the checkbox "Enable battery watcher" remains checked always (if you checked it), so at every login there wll be this message, this is a separate issue also confirmed in LUbuntu Vbox, will open it.
  • I can trigger the suspend on idle not working by selecting "nothing" for Battery and "suspend" for AC. after one video in fullscreen. EDIT: when same amount of time is set (1:01) suspend on idle works with "Do nothing" on battery.
  • Looks like lockscreen works always

As said there are many combinations, will repeat and do more later.

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

You could try to remove the battery for testing?

No, the battery is integrated into the case.

but the checkbox "Enable battery watcher" remains checked

OK, but will the message also appear with login if you uncheck it?

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

In the end, someone (perhaps I) should read the code line by line and see whether the absence of a battery is treated incorrectly.

@tsujan
Copy link
Member Author

tsujan commented Jul 22, 2021

BTW, #261 is about lack of battery. But it's a feature request, not a bug report. For the bug you've probably encountered, please open a separate issue.

@stefonarch
Copy link
Member

OK, but will the message also appear with login if you uncheck it?

No.

I tried to repeat the idleness suspend issue on the old laptop with the battery removed, no success. So giving up this atm, at least I think I know by now which config works always on my desktop PC.

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

Successfully merging a pull request may close this issue.

2 participants