normcap icon indicating copy to clipboard operation
normcap copied to clipboard

Missing the screen capture permission

Open M-Emran opened this issue 1 year ago • 5 comments
trafficstars

What happened?

First when we open the app, it takes a full screenshot. when I click select an area to grab then a dialog box appears NorCamp is missing the permission for a screen capture. Grant the permission by clicking ok but when I click ok, the app take a full screenshot and closes.

How did you install NormCap?

FlatPak (Linux)

Operating System + Version?

Zorin OS (ubuntu 23)

[Linux only] Display Server (DS) + Desktop environment (DE)?

No response

Debug log output?*

emran@emran:~$ flatpak run --command=normcap com.github.dynobo.normcap -v debug
07:44:33 - INFO    - normcap:49 - Start NormCap v0.5.4
07:44:33 - DEBUG   - normcap:95 - Set XCURSOR_SIZE=24
07:44:33 - DEBUG   - normcap:100 - Set QT_QPA_PLATFORM=wayland
07:44:33 - DEBUG   - normcap.gui.tray:77 - System info:
{'normcap_version': '0.5.4', 'python_version': '3.11.9', 'cli_args': '/app/bin/normcap -v debug', 'is_briefcase_package': False, 'is_flatpak_package': True, 'is_appimage_package': False, 'platform': 'linux', 'desktop_environment': <DesktopEnvironment.GNOME: 1>, 'display_manager_is_wayland': True, 'pyside6_version': '6.6.1', 'qt_version': '6.6.1', 'qt_library_path': '/usr/share/runtime/lib/plugins, /app/lib/python3.11/site-packages/PySide6/Qt/plugins, /usr/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/emran/.var/app/com.github.dynobo.normcap/config/normcap'), 'resources_path': PosixPath('/app/lib/python3.11/site-packages/normcap/resources'), 'tesseract_path': PosixPath('/app/bin/tesseract'), 'tessdata_path': PosixPath('/home/emran/.var/app/com.github.dynobo.normcap/config/normcap/tessdata'), 'envs': {'TESSDATA_PREFIX': '/app/share', 'LD_LIBRARY_PATH': ''}, 'screens': [Screen(left=0, top=0, right=1365, bottom=767, device_pixel_ratio=1.0, index=0, screenshot=None)]}
07:44:33 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (show_introduction: None)
07:44:33 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (cli_mode: False)
07:44:33 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (background_mode: False)
07:44:33 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (clipboard_handler: None)
07:44:33 - DEBUG   - normcap.gui.tray:394 - Another instance is already running. Sending capture signal.
07:44:33 - INFO    - normcap.gui.tray:610 - Exit normcap
07:44:33 - DEBUG   - normcap.gui.tray:611 - Debug images saved in /tmp/normcap
emran@emran:~$ ^C

M-Emran avatar Apr 25 '24 02:04 M-Emran

I confirm, that permission handling for Flatpak seems quite broken. Theoretically, when NormCap tries to access org.freedesktop.portal.Screenshot the first time, a system permission dialog should pop-up, but somehow it doesn't...

Probably needs some more investigation, into why this is the case and what could be done about it. Any help would be appreciated!

dynobo avatar May 18 '24 19:05 dynobo

I have the same problem and I've accidentally found a workaround: Open the file manager, navigate to /usr/share/applications, and open normcap (normcap.desktop) from there. In my case, it kinda ties the permission request to the Nemo file manager, as it says that Nemo wants to request a screenshot, and not the normcap app. But it works afterwards.

Note: I use GNOME, but I suppose the .desktop files location isn't tied to any specific DE?

Edit: sorry. I didn't fully read your issue. I think it's not related, but I will leave it anyway

creeper82 avatar Jun 03 '24 07:06 creeper82

Hi @M-Emran, I am also running Zorin OS 17. I tried installing it by pip, flatpak, and AppImage and all of them gave me the same kind of error when I try to select the 'Share Area to Grab" option. It worked fine when I share the screenshot that is taken just after the app launches, i.e, the full screen screenshot, but didn't with the other options.

Error Received :

TimeoutError: Timeout when taking screenshot!
01:04:09 - ERROR   - normcap.screengrab.handlers.dbus_shell:48 - Failed move Window!
01:04:09 - ERROR   - normcap.screengrab.handlers.dbus_shell:49 - Screenshot is not allowed
01:04:09 - CRITICAL - normcap:148 - Uncaught exception!
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/a/.local/lib/python3.10/site-packages/normcap/__main__.py", line 6, in <module>
    run()
  File "/home/a/.local/lib/python3.10/site-packages/normcap/app.py", line 102, in run
    app, tray = _prepare()
  File "/home/a/.local/lib/python3.10/site-packages/normcap/app.py", line 95, in _prepare
    tray = SystemTray(app, vars(args))
  File "/home/a/.local/lib/python3.10/site-packages/normcap/gui/tray.py", line 139, in __init__
    self._show_windows(delay_screenshot=delay_screenshot)
  File "/home/a/.local/lib/python3.10/site-packages/normcap/gui/tray.py", line 204, in _show_windows
    self._create_window(index)
  File "/home/a/.local/lib/python3.10/site-packages/normcap/gui/tray.py", line 543, in _create_window
    new_window.set_fullscreen()
  File "/home/a/.local/lib/python3.10/site-packages/normcap/gui/window.py", line 144, in set_fullscreen
    raise ValueError("Screenshot is missing on screen %s", self.screen_)

ValueError: ('Screenshot is missing on screen %s', Screen(left=0, top=0, right=2559, bottom=1439, device_pixel_ratio=1.0, index=0, screenshot=<PySide6.QtGui.QImage(null) at 0x7300ce078840>))

But right now it works on ''Share Area to Grab" about which even I do not know it got fixed :/ ( I remember it breaking earlier). Probably it didn't capture the initial screenshot for the application to work with.

I also wanted to ask how to pass the dialog box which shows : image

It would help remove the manual step of clicking on share :/

abrahamvg avatar Sep 03 '24 20:09 abrahamvg

Workaround on GNOME wayland:

flatpak permission-set screenshot screenshot normcap yes

discovered in https://github.com/NixOS/nixpkgs/issues/351680

pbsds avatar Oct 27 '24 17:10 pbsds