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

[Bug]: ubuntu 22.04 LTS powerMonitor.getSystemIdleTime() returns "0" #34826

Closed
3 tasks done
trae-op opened this issue Jul 5, 2022 · 4 comments
Closed
3 tasks done

[Bug]: ubuntu 22.04 LTS powerMonitor.getSystemIdleTime() returns "0" #34826

trae-op opened this issue Jul 5, 2022 · 4 comments
Labels

Comments

@trae-op
Copy link

trae-op commented Jul 5, 2022

Preflight Checklist

Electron Version

18.0.3

What operating system are you using?

Ubuntu

Operating System Version

ubuntu 22.04 LTS

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

I expect the getSystemIdleTime() function to work as before in the ubuntu 22.04 LTS

Actual Behavior

My app uses powerMonitor.getSystemIdleTime(). I recently upgraded ubuntu from 18.04.6 to 22.04 LTS and getSystemIdleTime() function stopped counting idle time.
I know works in 20.04.4 LTS too. Doesn't work on the v22.04 LTS

Testcase Gist URL

https://gist.github.com/trae-op/663bbb53cd75c6485ccd40d36d14a64f

Additional Information

No response

@trae-op trae-op changed the title ubuntu 22.04 LTS powerMonitor.getSystemIdleTime() returns "0" [Bug]: ubuntu 22.04 LTS powerMonitor.getSystemIdleTime() returns "0" Jul 5, 2022
@codebytere
Copy link
Member

This falls directly to this function in Chromium. You should open a https://crbug.com/ identifying this issue, and then we will recieve the fix when upstream addresses it.

@trae-op
Copy link
Author

trae-op commented Jul 22, 2022

This falls directly to this function in Chromium. You should open a https://crbug.com/ identifying this issue, and then we will recieve the fix when upstream addresses it.

I wrote to https://crbug.com/ and they gave me the answer https://bugs.chromium.org/p/chromium/issues/detail?id=1343535
Need to update latest chrome version #103.0.5060.114

@kramerc
Copy link
Contributor

kramerc commented Sep 8, 2022

This seems to be a Wayland issue. Chromium currently uses the X11 Ozone platform by default so it's using X11ScreenOzone's CalculateIdleTime which always returns zero on Wayland because of the lack of an X11 screen saver.

Adding the command flags --enable-features=UseOzonePlatform --ozone-platform=wayland will start the Electron app in Wayland and get powerMonitor.getSystemIdleTime() working, but on my system running Ubuntu 22.04.1 LTS and GNOME 42.4 I lose the window's title bar and frame.

There is this bug reported a year ago about it, and it's because GNOME's Mutter doesn't support server-side decorations with the xdg-decoration protocol. It is not planned as well. Chrome does have client-side decoration support under Wayland on GNOME, so it looks like Electron might be lacking client-side decoration support on Wayland when frame is set to true on BrowserWindow.

So there is a workaround, but depending on your Wayland display server, or rather your desktop environment, it probably won't be practical in terms of usability until client-side decorations are available.

@kramerc
Copy link
Contributor

kramerc commented Sep 11, 2022

I've been looking into this a bit more, and it seems since Electron 17 support for client-side decorations is available with the additional flag --enable-features=WaylandWindowDecorations

image

powerMonitor.getSystemIdleTime() also appears to work on Electron 17. Most of my initial findings were with trying to get Discord to work under Wayland, which seems to be stuck on Electron 13.

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

No branches or pull requests

3 participants