normcap
normcap copied to clipboard
Permission denied for Screenshot via xdg-portal!
Hi, I have normcap installed via AUR. It is working fine if I start via the cli. Unfortunately it is not working if I use the Desktop symbol . I get no response. I tried providing the full path to the .desktop file but that doesn't seem to be the problem according to journalctl:
Jan 08 22:17:57 myMachine xdg-desktop-por[2301]: Failed to show access dialog: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is allowed to show a system access dialog
Jan 08 22:17:57 myMachine normcap.desktop[7444]: 22:17:57 - ERROR - normcap.screengrab.dbus_portal:129 - Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.51", path="/org/freedesktop/portal/desktop/request/1_137/normcap_egaicacf", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x7fa10c7bd540>
Jan 08 22:17:57 myMachine normcap.desktop[7444]: 22:17:57 - CRITICAL - normcap:148 - Uncaught exception!
Jan 08 22:17:57 myMachine normcap.desktop[7444]: Traceback (most recent call last):
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/bin/normcap", line 8, in <module>
Jan 08 22:17:57 myMachine normcap.desktop[7444]: sys.exit(run())
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/app.py", line 101, in run
Jan 08 22:17:57 myMachine normcap.desktop[7444]: app, tray = _prepare()
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/app.py", line 94, in _prepare
Jan 08 22:17:57 myMachine normcap.desktop[7444]: tray = SystemTray(app, vars(args))
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/gui/tray.py", line 147, in __init__
Jan 08 22:17:57 myMachine normcap.desktop[7444]: self._show_windows(delay_screenshot=delay_screenshot)
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/gui/tray.py", line 199, in _show_windows
Jan 08 22:17:57 myMachine normcap.desktop[7444]: screenshots = self._take_screenshots(delay=delay_screenshot)
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/gui/tray.py", line 509, in _take_screenshots
Jan 08 22:17:57 myMachine normcap.desktop[7444]: screens = screengrab.capture()
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/screengrab/main.py", line 43, in capture
Jan 08 22:17:57 myMachine normcap.desktop[7444]: return capture_func()
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/screengrab/dbus_portal.py", line 223, in capture
Jan 08 22:17:57 myMachine normcap.desktop[7444]: result = _synchronized_capture(interactive=False)
Jan 08 22:17:57 myMachine normcap.desktop[7444]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Jan 08 22:17:57 myMachine normcap.desktop[7444]: File "/usr/lib/python3.11/site-packages/normcap/screengrab/dbus_portal.py", line 200, in _synchronized_capture
Jan 08 22:17:57 myMachine normcap.desktop[7444]: raise error
Jan 08 22:17:57 myMachine normcap.desktop[7444]: normcap.screengrab.exceptions.ScreenshotPermissionError: Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.51", path="/org/freedesktop/portal/desktop/request/1_137/normcap_egaicacf", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x7fa10c7bd540>
Jan 08 22:17:57 myMachine normcap.desktop[7444]: 22:17:57 - CRITICAL - normcap:151 - System info: {'normcap_version': '0.5.3', 'python_version': '3.11.6', 'cli_args': '/usr/bin/normcap', 'is_briefcase_package': False, 'is_flatpak_package': False, '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/lib/qt6/plugins, /usr/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/karim/.config/normcap'), 'resources_path': PosixPath('/usr/lib/python3.11/site-packages/normcap/resources'), 'tesseract_path': PosixPath('/usr/bin/tesseract'), 'tessdata_path': None, 'envs': {'TESSDATA_PREFIX': None, 'LD_LIBRARY_PATH': None}, 'screens': [Screen(left=0, top=0, right=1919, bottom=1199, device_pixel_ratio=1.0, index=0, screenshot=None)]}
Jan 08 22:17:57 myMachine normcap.desktop[7444]: 22:17:57 - CRITICAL - normcap:152 - Unfortunately, NormCap has to be terminated due to an unknown problem.
Jan 08 22:17:57 myMachine normcap.desktop[7444]: Please help improve NormCap by reporting this error, including the output above, on
Jan 08 22:17:57 myMachine normcap.desktop[7444]: https://github.com/dynobo/normcap/issues/new
Jan 08 22:17:57 myMachine normcap.desktop[7444]: Thanks!
Any further Information needed?
Thanks, Hellmann
@HellmannK , thanks for reporting.
I think on Wayland permissions are somehow tied to the exact filename of the .desktop
-file: it has to match a specific format. Can't remember the details though...
I'll try to look into it in the next days.
He @HellmannK ,
could you please try renaming normcap.desktop
to com.github.dynobo.normcap.desktop
?
E.g. via:
sudo mv /usr/share/applications/normcap.desktop /usr/share/applications/com.github.dynobo.normcap.desktop
Does this fix the permission problem?
He @HellmannK ,
could you please try renaming
normcap.desktop
tocom.github.dynobo.normcap.desktop
?E.g. via:
sudo mv /usr/share/applications/normcap.desktop /usr/share/applications/com.github.dynobo.normcap.desktop
Does this fix the permission problem?
No, it does not help. I tried to get the StartupWMClass with xprop | grep WM_CLASS
but it had no output. Is there any? Maybe it would help to add? I also ran desktop-file-validate but there was no error or warning shown.
Out of curiosity I tried to start the .desktop file from cli with gtk-launch com.github.dynobo.normcap.desktop
- that works as well...
I was able to reproduce this issue in a fresh Arch VM. It seems like this is somewhat related to this issue flatpak/xdg-desktop-portal#1070
The issue is about keyboard shortcuts, but the workaround mentioned there worked for me also for the desktop shortcuts:
- Create a helper script
/some/path/start_normcap.sh
with the following content:
#!/bin/bash
/usr/bin/normcap
- Copy the desktop file to be able to modify it:
cp /usr/share/applications/normcap.desktop ~/.local/share/applications/normcap.desktop
- Edit the new file to point to the helper script (instead to
normcap
):
exec=/path/to/start_normcap.sh
- Launch "NormCap" through the application menu
Does it work for you, too?
Oh yes, thanks! That works. Thank you for your investigation! That really deserves the term workaround.. haha.
Arch, Gnome 45, Wayland:
$ normcap
12:33:52 - ERROR - normcap.screengrab.dbus_portal:129 - Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.48", path="/org/freedesktop/portal/desktop/request/1_106/normcap_giggdebe", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x55b54d804f00>
12:33:52 - WARNING - normcap.screengrab.permissions:205 - Screenshot permissions on Wayland seem missing.
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/normcap/screengrab/permissions.py", line 200, in _dbus_portal_has_screenshot_permission
result = dbus_portal.capture()
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/normcap/screengrab/dbus_portal.py", line 223, in capture
result = _synchronized_capture(interactive=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/normcap/screengrab/dbus_portal.py", line 200, in _synchronized_capture
raise error
normcap.screengrab.exceptions.ScreenshotPermissionError: Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.48", path="/org/freedesktop/portal/desktop/request/1_106/normcap_giggdebe", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x55b54d804f
00>
12:33:55 - ERROR - normcap.screengrab.dbus_portal:129 - Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.48", path="/org/freedesktop/portal/desktop/request/1_106/normcap_efififgd", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x55b54d81b940>
12:33:55 - CRITICAL - normcap:148 - Uncaught exception!
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/normcap/screengrab/permissions.py", line 181, in accept_button_pressed
self.capture = dbus_portal._synchronized_capture(interactive=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/normcap/screengrab/dbus_portal.py", line 200, in _synchronized_capture
raise error
normcap.screengrab.exceptions.ScreenshotPermissionError: Permission denied for Screenshot via xdg-portal! Message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.48", path="/org/freedesktop/portal/desktop/request/1_106/normcap_efififgd", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(2, [Argument: a{sv} {}]) ) at 0x55b54d81b940>
12:33:55 - CRITICAL - normcap:151 - System info: {'normcap_version': '0.5.4', 'python_version': '3.11.6', 'cli_args': '/usr/bin/normcap', 'is_briefcase_package': False, 'is_flatpak_package': False, '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/lib/qt6/plugins, /usr/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/olk/.config/normcap'), 'resources_path': PosixPath('/usr/lib/python3.11/site-packages/normcap/resources'), 'tesseract_path': PosixPath('/usr/bin/tesseract'), 'tessdata_path': None, 'envs': {'TESSDATA_PREFIX': None, 'LD_LIBRARY_PATH': None}, 'screens': [Screen(left=0, top=0, right=1919, bottom=1079, device_pixel_ratio=1.0, index=0, screenshot=None)]}
12:33:55 - CRITICAL - normcap:152 - Unfortunately, NormCap has to be terminated due to an unknown problem.
Please help improve NormCap by reporting this error, including the output above, on
https://github.com/dynobo/normcap/issues/new
Thanks!
after modifying the .desktop, it doesn't appear in the Gnome overview
after modifying the .desktop, it doesn't appear in the Gnome overview
@k1gen , can you please share the content of your .desktop
? If it doesn't show up at all in the overview, it very likely contains a syntax error or points to an unexisting executable (incorrect path).