yubioath-flutter icon indicating copy to clipboard operation
yubioath-flutter copied to clipboard

QR code screen capture fails on Kde/Wayland (NixOS)

Open rajil opened this issue 9 months ago • 2 comments

Screen capture window appears momentarily and then disappears. The following log is produced,

09:07:34.726 [desktop.devices] INFO: USB state updated, unaccounted for: {}
09:07:52.564 [helper.helper] SEVERE: Unhandled exception
Traceback (most recent call last):
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/qr.py", line 32, in _capture_screen
    sct_img = sct.grab(monitor)  # mss format
              ^^^^^^^^^^^^^^^^^
  File "/nix/store/ig5183zxn8br33zwiz4sjwws5skanqn7-python3.12-mss-10.0.0/lib/python3.12/site-packages/mss/base.py", line 101, in grab
    screenshot = self._grab_impl(monitor)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/ig5183zxn8br33zwiz4sjwws5skanqn7-python3.12-mss-10.0.0/lib/python3.12/site-packages/mss/linux.py", line 428, in _grab_impl
    ximage = self.xlib.XGetImage(
             ^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/ig5183zxn8br33zwiz4sjwws5skanqn7-python3.12-mss-10.0.0/lib/python3.12/site-packages/mss/linux.py", line 230, in _validate
    raise ScreenShotError(msg, details=details)
mss.exception.ScreenShotError: XGetImage() failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/__init__.py", line 105, in process
    handler(
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/device.py", line 94, in __call__
    result = super().__call__(*args)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/base.py", line 130, in __call__
    response = self.get_action(action)(params, event, signal)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/device.py", line 128, in qr
    return dict(result=scan_qr(params.get("image")))
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/qr.py", line 85, in scan_qr
    img = _capture_screen()
          ^^^^^^^^^^^^^^^^^
  File "/nix/store/zs2xdxdvwyfkyvbqnd0jg5na6sfmrm3l-yubioath-flutter-helper-7.1.1/lib/python3.12/site-packages/helper/qr.py", line 52, in _capture_screen
    return Image.open(fname)
           ^^^^^^^^^^^^^^^^^
  File "/nix/store/c6rcv7761qj8rqizm71sj1ll04mv2xdx-python3.12-pillow-11.1.0/lib/python3.12/site-packages/PIL/Image.py", line 3532, in open
    raise UnidentifiedImageError(msg)
PIL.UnidentifiedImageError: cannot identify image file '/tmp/tmp91gqruza.png'
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RpcResponse.error(status: exception, message: UnidentifiedImageError("cannot identify image file '/tmp/tmp91gqruza.png'"), body: {})

The captured file is empty,

>ls -la /tmp/tmpsne98mk4.png
-rw------- 1 user users 0 Feb 24 09:06 /tmp/tmpsne98mk4.png

System information

Plasma - 6.3

>nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.12.14, NixOS, 25.05 (Warbler), 25.05.20250218.73cf49b`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.12`
 - nixpkgs: `/etc/channels/nixpkgs`

rajil avatar Feb 24 '25 03:02 rajil

It does not work at all (nothing appears) for me, running kde but the app as a flatpak, simply giving this error:

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: RpcResponse.error(status: invalid-command, message: Invalid parameters: Unable to capture screenshot, body: {})

But maybe that some missing permission that i should give the flatpak sandbox..

MrRinkana avatar Feb 26 '25 13:02 MrRinkana

Related / duplicate issue: #1010

trinitronx avatar Mar 24 '25 21:03 trinitronx