workrave icon indicating copy to clipboard operation
workrave copied to clipboard

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

Open brianfcoleman opened this issue 5 years ago • 7 comments

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 247fdad3d863b86e939ee93906a1418e30ea7cca). This build also exhibits the same issue.

brianfcoleman avatar Jul 27 '20 08:07 brianfcoleman

@brianfcoleman did you enable the GNOME extension?

auscompgeek avatar Sep 02 '20 04:09 auscompgeek

The Workrave extension is failing to load for the following reason

ep 03 08:18:27 thinkbrick gnome-shell[2401]: JS ERROR: Extension [email protected]: 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/[email protected]/extension.js:63:42
                                              _workraveButton@/usr/share/gnome-shell/extensions/[email protected]/extensio>
                                              enable@/usr/share/gnome-shell/extensions/[email protected]/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

brianfcoleman avatar Sep 03 '20 07:09 brianfcoleman

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 avatar May 12 '21 19:05 rcaelers

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.

matthew-cline avatar May 15 '21 23:05 matthew-cline

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 avatar Dec 28 '21 02:12 yennor

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...

yennor avatar Dec 28 '21 02:12 yennor

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.

brianfcoleman avatar Dec 30 '21 18:12 brianfcoleman

I suggest we close this

dpriskorn avatar Feb 05 '23 06:02 dpriskorn

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).

yennor avatar Aug 17 '23 21:08 yennor

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.

ValdikSS avatar Jan 13 '24 22:01 ValdikSS

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)

rcaelers avatar Feb 11 '24 19:02 rcaelers

@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.

ValdikSS avatar May 30 '24 23:05 ValdikSS