Bug 410849 - Unity games are prevent screen saver/locker from kicking in
Summary: Unity games are prevent screen saver/locker from kicking in
Status: RESOLVED NOT A BUG
Alias: None
Product: Powerdevil
Classification: Plasma
Component: general (show other bugs)
Version: 5.10.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-12 12:39 UTC by Qu Wenruo
Modified: 2021-06-21 22:59 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Qu Wenruo 2019-08-12 12:39:28 UTC
SUMMARY

Recently I'm play StoneStory RPG, an ascii art gaming developer using Unity.
The game itself involves a lot of automatic farming (archievement: AFK Farmer).

However even when the game window is minimized, the game is still prevent screen saver/locker from kicking in.

Even manually locked the screen, the screen never get dimmed/blanked/turned of at all.

Is there any way to skip such session and force locking the screen? Just like KWin rules.

STEPS TO REPRODUCE
1. Download and play StoneStoryRPG (or any other Unity based game)
2. Use windowed mode for the game
3. Minimize the game, wait for the screen locker to kick in

OBSERVED RESULT
Screen saver never kick in

EXPECTED RESULT
Screen saver kicks in as expected

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Archlinux
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2019-08-13 16:06:22 UTC
If you click on the Battery and Brightness system tray applet, does it say that the game is "currently supressing power management?"
Comment 2 Qu Wenruo 2019-08-13 23:28:18 UTC
(In reply to Nate Graham from comment #1)
> If you click on the Battery and Brightness system tray applet, does it say
> that the game is "currently supressing power management?"

I'm using a desktop, thus no battery and I see no such prompt.
Comment 3 Nate Graham 2019-08-14 02:46:32 UTC
It also controls the brightness, so you should still see it on the desktop. It might be in the system tray's list of extras, accessed by clicking on the little arrow.
Comment 4 Qu Wenruo 2019-08-14 05:47:08 UTC
(In reply to Nate Graham from comment #3)
> It also controls the brightness, so you should still see it on the desktop.
> It might be in the system tray's list of extras, accessed by clicking on the
> little arrow.

Yes, I have double checked the system tray, nothing at all.
Comment 5 Nate Graham 2019-08-14 13:21:27 UTC
Okay, so you'll need to make it appear, at least temporarily.

1. Right-click on system tray arrow > Configure System Tray
2. On the General page, make sure "Battery and Brightness" is checked in the list 
3. Go do Entries page and change the visibility of "Battery and Brightness" to "Shown"

If it's not even visible on the "General page" that suggests that your system is missing packages.
Comment 6 Qu Wenruo 2019-08-14 13:50:00 UTC
(In reply to Nate Graham from comment #5)
> Okay, so you'll need to make it appear, at least temporarily.
> 
> 1. Right-click on system tray arrow > Configure System Tray
> 2. On the General page, make sure "Battery and Brightness" is checked in the
> list 
> 3. Go do Entries page and change the visibility of "Battery and Brightness"
> to "Shown"
> 
> If it's not even visible on the "General page" that suggests that your
> system is missing packages.

I think you didn't get the point.

I know regular programs like firefox video playback will show up in that tab.
And I can confirm that battery indicator gadget is working.

But still, for that stream game, it doesn't show up in that indicator, and I have no way to force screensaver to kick in.
Comment 7 Nate Graham 2019-08-14 13:59:48 UTC
Sorry about that. Might be an issue with the games themselves (or it might be intentional).
Comment 8 Qu Wenruo 2019-08-14 14:09:05 UTC
(In reply to Nate Graham from comment #7)
> Sorry about that. Might be an issue with the games themselves (or it might
> be intentional).

Then the problem is, is there anyway to force screensaver to kick in or add some window rule to force it?
Comment 9 Kai Uwe Broulik 2019-08-14 14:14:12 UTC
Press Meta+L or Ctrl+Alt+L.
Comment 10 Qu Wenruo 2019-08-14 14:27:12 UTC
(In reply to Kai Uwe Broulik from comment #9)
> Press Meta+L or Ctrl+Alt+L.

Not enough.
The screen will keep on, never go blank, and that's the problem.
Comment 11 Kai Uwe Broulik 2019-08-14 14:46:04 UTC
What Plasma version is this?
When the screen is locked, PowerDevil should disregard any inhibitions for screensaving: https://cgit.kde.org/powerdevil.git/tree/daemon/powerdevilpolicyagent.cpp#n401

Maybe the game is simulating user activity continuously instead of posting an inhibition, which might explain why it doesn't show up, and there's not really anything we can do about this.
Comment 12 Qu Wenruo 2019-08-14 14:51:09 UTC
(In reply to Kai Uwe Broulik from comment #11)
> What Plasma version is this?
> When the screen is locked, PowerDevil should disregard any inhibitions for
> screensaving:
> https://cgit.kde.org/powerdevil.git/tree/daemon/powerdevilpolicyagent.
> cpp#n401
> 
> Maybe the game is simulating user activity continuously instead of posting
> an inhibition, which might explain why it doesn't show up, and there's not
> really anything we can do about this.

5.16.4 for powerdevil

Is it possible to handle it like Kwin to add some window rule to override that?
Comment 13 David Edmundson 2021-06-21 22:59:50 UTC
If the game is calling simulateUserActivity on the screensaver iface or generating fake events then there is nothing we can do in KDE.

All signs above point to that happening.