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

Workrave fails to track keyboard and mouse activity in Gnome Shell on Wayland #212

Closed
brianfcoleman opened this issue Jul 27, 2020 · 12 comments
Labels

Comments

@brianfcoleman
Copy link

brianfcoleman commented Jul 27, 2020

Describe the bug
Workrave fails to track keyboard and mouse activity in Gnome Shell on Wayland on Fedora 32.

To Reproduce
Steps to reproduce the behavior:

  1. Install Fedora 32
  2. Install Workrave
  3. Login to Gnome Shell on Wayland
  4. Launch Workrave
  5. Perform some keyboard and mouse activity
  6. Workrave fails to track the keyboard and mouse activity

Expected behavior
Workrave should track the keyboard and mouse activity

Screenshots
Not applicable

Linux:

  • Distribution: Fedora
  • Distribution Version: 32
  • Desktop Environment: Gnome Shell 3.36.4
  • Workrave Version: 1.10.2

Additional context
I have also tried building and running the branch_v1_10 branch (sha 247fdad). This build also exhibits the same issue.

@auscompgeek
Copy link

@brianfcoleman did you enable the GNOME extension?

@brianfcoleman
Copy link
Author

The Workrave extension is failing to load for the following reason

ep 03 08:18:27 thinkbrick gnome-shell[2401]: JS ERROR: Extension workrave@workrave.org: TypeError: GObject_Object.prototype._>
                                              _init@resource:///org/gnome/shell/ui/panelMenu.js:19:15
                                              _init@resource:///org/gnome/shell/ui/panelMenu.js:99:15
                                              _init@/usr/share/gnome-shell/extensions/workrave@workrave.org/extension.js:63:42
                                              _workraveButton@/usr/share/gnome-shell/extensions/workrave@workrave.org/extensio>
                                              enable@/usr/share/gnome-shell/extensions/workrave@workrave.org/extension.js:359:>
                                              _callExtensionEnable@resource:///org/gnome/shell/ui/extensionSystem.js:166:32
                                              loadExtension@resource:///org/gnome/shell/ui/extensionSystem.js:348:26
                                              _loadExtensions/<@resource:///org/gnome/shell/ui/extensionSystem.js:590:18
                                              collectFromDatadirs@resource:///org/gnome/shell/misc/fileUtils.js:27:17
                                              _loadExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:569:19
                                              _enableAllExtensions@resource:///org/gnome/shell/ui/extensionSystem.js:599:18
                                              _sessionUpdated@resource:///org/gnome/shell/ui/extensionSystem.js:630:18
                                              init@resource:///org/gnome/shell/ui/extensionSystem.js:55:14
                                              _initializeUI@resource:///org/gnome/shell/ui/main.js:254:22
                                              start@resource:///org/gnome/shell/ui/main.js:143:5
                                              @<main>:1:47

@rcaelers
Copy link
Owner

Workrave should support activity monitoring in Gnome Shell on Wayland. Do you still have this problem with a more recent Gnome Shell / Worrkrave?

If you still encounter this issue in Workrave 1.10.45 please try the following:
When you encounter the problem, open the preferences, and go to the 'Monitoring' tab in the Timers section. Press the 'Debug monitoring' button. A new window should appear that shows some internal state and state changes. Wait a minute or so and copy/paste the content of the debug window and add it to this bug report or mail it to me (there should not be any personal data in the logs)

@rcaelers rcaelers added info-needed bug Something isn't working labels May 12, 2021
@matthew-cline
Copy link

I'm encountering the same problem under Plasma (KDE) Wayland, Workrave version 1.10.44, on Fedora 34. I did have to set the env var GDK_BACKEND="x11" to prevent Workrave from crashing on startup, if that makes a difference.

@yennor
Copy link

yennor commented Dec 28, 2021

there is still the same problem with kde plasma under wayland.
for starting it up the only way which seems to work is:
GDK_BACKEND="x11" workrave --display="$DISPLAY"
The time gets properly tracked as long as the work rave applets (the one showing the timers) is open and has focus, then it notices keyboard and mouse inputs. Also if I open an application which is opened over xwayland (in x-server mode) the timer continues counting, if I do some activiy in that application. But if you change to a wayland application, the timer doesn't count anymore. It doesn't get the keyboard and mouse inputs from the other wayland applications. That's a security feature (I've just installed wayland yesterday, so I'm far away from beeing an expert, just writing down what I've found out). No application is able to get mouse or keyboard inputs from other applications. So far I'm pretty sure that I'm right, I'm not completely sure about what follows now ;-).

As it seems wayland got some way to allow keyboard grabbing from other programs, but it needs to be implemented by the compositor. Mutter from Gnome seems to implement it, over the option org.gnome.mutter.wayland xwayland-allow-grabs true and by having a whitelist of applications allowed to do so. I couldn't find anything for kwin (compositor of plasma) documenting any of that, what doesn't mean that it is not possible.
I've also found that, but no idea if it is usable:
https://wayland.app/protocols/xwayland-keyboard-grab-unstable-v1

Anyway, I guess there are some channels for wayland and/or kwin where @rcaelers could ask how it would need to be implemented to work in wayland and/or kwin?

@yennor
Copy link

yennor commented Dec 28, 2021

otherwise, that seems to be more what you'd need:
https://wayland.app/protocols/kde-idle
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/29

Maybe workrave does that already? to be honest, i didn't check...

@brianfcoleman
Copy link
Author

I am no longer experiencing this issue after doing a clean reinstall of Fedora using Gnome and Workrave on Wayland.
On my previous installation of Fedora (which was upgraded from release to release starting with Fedora 25) I was using a custom Gnome theme at some point. It may be that the custom theme was subsequently broken in a way that caused the extension to fail to load.

@dpriskorn
Copy link

I suggest we close this

@yennor
Copy link

yennor commented Aug 17, 2023

Meanwhile it also works under current kde plasma and wayland.
Just the user interface option "Force the use of X11 on Wayland" needs to be deactivated and it needs to be started up without GDK_BACKEND="x11" or any other parameters . then it works properly (with some minor glitches, but it does what it is supposed to do).

@ValdikSS
Copy link
Contributor

Unfortunately does not work for me with "Force the use of X11 on Wayland" unchecked and without GDK_BACKEND="x11" on KDE Plasma, crashes as without the checkbox.

@rcaelers
Copy link
Owner

Workrave 1.11 beta 10 has improved Wayland support. Keyboard/mouse monitoring should work without "Force the use of X11 on Wayland" on GNOME and KDE (via Wayland idle-notify protocol)

@ValdikSS
Copy link
Contributor

@rcaelers, unfortunately current implementation sometime loses ability to track the activity, it just doesn't countdown. I'm not really sure what is the reason, but this happens probably after suspend/resume cycle. I don't have reliable reproducer yet.

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

7 participants