-
Notifications
You must be signed in to change notification settings - Fork 89
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
[Linux, hyperland] normcap.screengrab.ScreenshotRequestError: No object path received from xdg-portal! #375
Comments
Thanks for reporting this issue, @FieldofClay . I looked into the implementation of If someone has an example of another program retrieving a screenshot through DBUS in hyperland, that might help. (Does e.g. flameshot work for you?) Anyway, I also would be super happy about a PR here! |
Flameshot doesn't work for me, initially it complains that it can't detect the desktop environment (looks like it is looking at XDG_CURRENT_DESKTOP and doesn't recognise Hyprland - changing to Sway fixes this), however once it finally loads it prints out a very uninformative "unable to capture screen". For screenshots most people with Hyprland use grim to take it, and optionally use slurp for selecting a portion of the screen. |
Facing the same issue System:
Variables:
Exception:
Traceback:
14:49:33 - CRITICAL - normcap:192 - Please open an issue with the output above on https://github.com/dynobo/normcap/issues` |
Same for me. How can I help to resolve this issue? |
hi, hyprland dev xdph's 1.0 rewrite doesn't support the screenshot portal yet, that's probably the issue here. Most people use stuff like |
Thanks for those insights, @vaxerski! I'll see if I can implement support for using |
I fucked around a lot and got it to work on Hyprland. There's some files with the available capabilities/interfaces of each xdg-portal in The code needed some small additions to detect Hyprland (just like sway). I'd like to contribute this, should I open a PR with some additions to the readme to get this to work in Hyprland? Currently it requires manually editing the hyprland.portal file, as mentioned. So ideally I'd also try and make the hyprland portal work, either by removing the screenshot interface or making the interface work properly (probably the same as the wlr portal). Do you want to wait on this first? |
Yes I'd appreciate such a PR, and yes, I'd also prefer to wait until hyperland's portal supports the screenshot interface, because I wouldn't feel comfortable proposing NormCap users to change system files. |
I’ll look into it tomorrow. I don’t have much C++ experience, but since there’s already a working implementation in the wlr portal I’ll try to make it work. The wlr portal also just uses grim under the hood, IIRC. |
I was able to add Would be great if you could try it, and report back if it works! I wasn't able to get Hyprland running in a VM, so I could not test it at all 🙈 BTW: Do you know, if there is a distro which offers hyprland out of the box? (I tried installing it in a Arch-VM, but no success, due to problems with getting 3D acceleration running...) (Still it would be great to have a working screenshot portal on hyprland, though 😉 ) |
Ah, you can't get Hyprland working properly in a VM without a lot of effort due to the acceleration (I think you'd need to pass through a GPU IIRC). Not sure if there's a distro that offers Hyprland OOTB, maybe something like Endeavour does. The arch-install script had an option added as well. Generally normal arch isn't that hard to set up either, if you follow the guide. I'll try NixOS in the future, seems to be quite nice (but also might cause headaches in some situations). I tried the new release and got this (on my desktop without the patches): ❯ ./NormCap-0.5.0-beta1-x86_64.AppImage
23:43:24 - ERROR - normcap.screengrab.dbus_portal:104 - No object path received from xdg-portal!
23:43:24 - CRITICAL - normcap:138 - Uncaught exception!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/.mount_NormCaDhAu1v/usr/python/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/tmp/.mount_NormCaDhAu1v/usr/python/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/tmp/.mount_NormCaDhAu1v/usr/python/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/__main__.py", line 6, in <module>
run()
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/app.py", line 99, in run
app, tray = _prepare()
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/app.py", line 92, in _prepare
tray = SystemTray(app, vars(args))
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/gui/tray.py", line 118, in __init__
if not self._ensure_screenshot_permission():
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/gui/tray.py", line 402, in _ensure_screenshot_permission
if screengrab.has_screenshot_permission():
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/screengrab/permissions.py", line 231, in has_screenshot_permission
return _dbus_portal_has_screenshot_permission()
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/screengrab/permissions.py", line 200, in _dbus_portal_has_screenshot_permission
result = dbus_portal.capture()
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/screengrab/dbus_portal.py", line 223, in capture
result = _synchronized_capture(interactive=False)
File "/tmp/.mount_NormCaDhAu1v/usr/app/normcap/screengrab/dbus_portal.py", line 200, in _synchronized_capture
raise error
normcap.screengrab.exceptions.ScreenshotRequestError: No object path received from xdg-portal!
23:43:24 - CRITICAL - normcap:141 - System info: {'normcap_version': '0.5.0-beta1', 'python_version': '3.10.13', 'cli_args': '-c', 'is_briefcase_package': True, 'is_flatpak_package': False, 'platform': 'linux', 'desktop_environment': <DesktopEnvironment.HYPRLAND: 5>, 'display_manager_is_wayland': True, 'pyside6_version': '6.5.3', 'qt_version': '6.5.3', 'qt_library_path': '/tmp/.mount_NormCaDhAu1v/usr/app_packages/PySide6/Qt/plugins, /tmp/.mount_NormCaDhAu1v/usr/python/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/captain/.config/normcap'), 'resources_path': PosixPath('/tmp/.mount_NormCaDhAu1v/usr/app/normcap/resources'), 'tesseract_path': PosixPath('/tmp/.mount_NormCaDhAu1v/usr/bin/tesseract'), 'tessdata_path': PosixPath('/home/captain/.config/normcap/tessdata'), 'envs': {'TESSDATA_PREFIX': None, 'LD_LIBRARY_PATH': None}, 'screens': [Screen(left=0, top=0, right=3198, bottom=1798, device_pixel_ratio=2.0, index=0, screenshot=None)]}
23:43:24 - CRITICAL - normcap:142 - 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! I had to deal with a few other stupid issues in the meantime (audio crackling thanks to my new CPU etc.), so I didn't get that far with the desktop portals. |
@CaptaiNiveau , thanks for trying. Do you have From the current output, it seems like it tried DBus-Portal again, which it should only do, if it can't find a working Could you please provide the debug output generated by the following command?: ./NormCap-0.5.0-beta1-x86_64.AppImage -v debug |
[phoenix@ArchLinux Downloads]$ ./NormCap-0.5.2-x86_64.AppImage -v debug
15:14:59 - INFO - normcap:49 - Start NormCap v0.5.2
15:14:59 - DEBUG - normcap:100 - Append /tmp/.mount_NormCaF5EpIU/usr/bin to AppImage internal PATH
15:14:59 - DEBUG - normcap.gui.tray:79 - System info:
{'normcap_version': '0.5.2', 'python_version': '3.10.13', 'cli_args': '/tmp/.mount_NormCaF5EpIU/usr/app/normcap/__main__.py -v debug', 'is_briefcase_package': True, 'is_flatpak_package': False, 'is_appimage_package': True, 'platform': 'linux', 'desktop_environment': <DesktopEnvironment.HYPRLAND: 5>, 'display_manager_is_wayland': True, 'pyside6_version': '6.6.1', 'qt_version': '6.6.1', 'qt_library_path': '/tmp/.mount_NormCaF5EpIU/usr/app_packages/PySide6/Qt/plugins, /tmp/.mount_NormCaF5EpIU/usr/python/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/phoenix/.config/normcap'), 'resources_path': PosixPath('/tmp/.mount_NormCaF5EpIU/usr/app/normcap/resources'), 'tesseract_path': PosixPath('/tmp/.mount_NormCaF5EpIU/usr/bin/tesseract'), 'tessdata_path': PosixPath('/home/phoenix/.config/normcap/tessdata'), 'envs': {'TESSDATA_PREFIX': None, 'LD_LIBRARY_PATH': None}, 'screens': [Screen(left=1920, top=1080, right=3455, bottom=1943, device_pixel_ratio=2.0, index=0, screenshot=None)]}
15:14:59 - DEBUG - normcap.gui.settings:162 - Skip update of non existing setting (show_introduction: None)
15:14:59 - DEBUG - normcap.gui.settings:162 - Skip update of non existing setting (cli_mode: False)
15:14:59 - DEBUG - normcap.gui.settings:162 - Skip update of non existing setting (background_mode: False)
15:14:59 - DEBUG - normcap.gui.tray:389 - Listen on local socket v0.5.2-normcap.
15:14:59 - DEBUG - normcap.screengrab.utils:111 - grim output: stdout=, stderr=supplied geometry did not intersect with any outputs
15:14:59 - DEBUG - normcap.screengrab.utils:120 - Support for grim is not available.
15:14:59 - DEBUG - normcap.screengrab.main:30 - Select capture method DBUS portal
15:14:59 - DEBUG - normcap.screengrab.dbus_portal:94 - DBus request message: <PySide6.QtDBus.QDBusMessage(type=MethodReturn, service=":1.51", signature="o", contents=([ObjectPath: /org/freedesktop/portal/desktop/request/1_306/normcap_cbbhihie]) ) at 0x7fa342b59c00>
15:14:59 - DEBUG - normcap.screengrab.dbus_portal:101 - Request accepted
15:14:59 - DEBUG - normcap.ocr.tesseract:24 - Executing '/tmp/.mount_NormCaF5EpIU/usr/bin/tesseract --list-langs --tessdata-dir /home/phoenix/.config/normcap/tessdata'
15:14:59 - DEBUG - normcap.ocr.tesseract:37 - Tesseract command output: List of available languages in "/home/phoenix/.config/normcap/tessdata/" (1): ¬ eng ¬
15:15:00 - DEBUG - normcap.screengrab.dbus_portal:121 - DBus signal message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.51", path="/org/freedesktop/portal/desktop/request/1_306/normcap_cbbhihie", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(0, [Argument: a{sv} {"uri" = [Variant(QString): "file:https:///tmp/hypr/xdph_screenshot.png"]}]) ) at 0x7fa343344f80>
15:15:00 - DEBUG - normcap.screengrab.dbus_portal:139 - Parse response
15:15:00 - DEBUG - normcap.screengrab.utils:25 - Virtual geometry width: 1536
15:15:00 - DEBUG - normcap.screengrab.utils:26 - Image width: 1920
15:15:00 - DEBUG - normcap.screengrab.utils:27 - Resize ratio: 1.25
15:15:00 - DEBUG - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2023-12-14_09-45-00_raw_screen0.png
15:15:00 - DEBUG - normcap.gui.window:148 - Create window for screen 0
15:15:00 - DEBUG - normcap.gui.window:216 - Set window of screen 0 to fullscreen
15:15:00 - DEBUG - normcap.gui.window:207 - Move window 0 to (left=1920, top=1080, right=3455, bottom=1943)
15:15:02 - DEBUG - normcap.gui.tray:355 - Hide 1 window
15:15:02 - INFO - normcap.gui.tray:254 - Crop image to region (567, 327, 1540, 828)
15:15:02 - DEBUG - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2023-12-14_09-45-02_cropped.png
15:15:02 - DEBUG - normcap.gui.tray:279 - Start OCR
15:15:02 - DEBUG - normcap.ocr.enhance:84 - Scale image x2
15:15:02 - DEBUG - normcap.ocr.enhance:57 - Pad image by 80px
15:15:02 - DEBUG - normcap.ocr.recognize:35 - Run Tesseract on image of size (2108, 1164) with args:
TessArgs(tessdata_path=PosixPath('/home/phoenix/.config/normcap/tessdata'), lang='eng', oem=<OEM.DEFAULT: 3>, psm=<PSM.AUTO: 3>)
15:15:02 - DEBUG - normcap.ocr.tesseract:24 - Executing '/tmp/.mount_NormCaF5EpIU/usr/bin/tesseract /tmp/tmpgdhubknj/normcap_tesseract_input.png /tmp/tmpgdhubknj/normcap_tesseract_input.png -c tessedit_create_tsv=1 -l eng --oem 3 --psm 3 --tessdata-dir /home/phoenix/.config/normcap/tessdata -c tessedit_write_images=1 -c tessedit_dump_pageseg_images=1'
15:15:02 - DEBUG - normcap.ocr.tesseract:37 - Tesseract command output:
15:15:02 - DEBUG - normcap.ocr.tesseract:67 - Skip moving file to temp dir, it does not exist: /tmp/tmpgdhubknj/normcap_tesseract_input.png.png_debug.pdf
15:15:02 - DEBUG - normcap.ocr.recognize:44 - OCR result:
OcrResult(tess_args=TessArgs(tessdata_path=PosixPath('/home/phoenix/.config/normcap/tessdata'), lang='eng', oem=<OEM.DEFAULT: 3>, psm=<PSM.AUTO: 3>), words=[], image=<PySide6.QtGui.QImage(QSize(2108, 1164),format=QImage::Format_RGB32,depth=32,devicePixelRatio=1,bytesPerLine=8432,sizeInBytes=9814848) at 0x7fa342b39180>, magic_scores={}, parsed='')
15:15:02 - INFO - normcap.ocr.magics.email_magic:60 - 0 emails found
15:15:02 - DEBUG - normcap.ocr.magics.email_magic:71 - 0/0 (0) chars in emails
15:15:02 - INFO - normcap.ocr.magics.url_magic:57 - 0 URLs found
15:15:02 - DEBUG - normcap.ocr.magics.url_magic:65 - 0/1 (0.0) chars in urls
15:15:02 - DEBUG - normcap.ocr.magic:82 - Magic scores:
{'SingleLineMagic': 1, 'MultiLineMagic': 0, 'ParagraphMagic': 200.0, 'EmailMagic': 0, 'UrlMagic': 0.0}
15:15:02 - DEBUG - normcap.ocr.recognize:48 - Parsed text:
15:15:02 - DEBUG - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2023-12-14_09-45-02_enhanced.png
15:15:02 - INFO - normcap.gui.tray:297 - Text from OCR:
15:15:02 - DEBUG - normcap.gui.tray:331 - Nothing there to be copied to clipboard!
15:15:02 - DEBUG - normcap.gui.notification:132 - Send notification via notify-send
15:15:02 - DEBUG - normcap:176 - [QT] qtwarningmsg - the cached device pixel ratio value was stale on window expose. please file a qtbug which explains how to reproduce.
15:15:07 - INFO - normcap.gui.tray:618 - Exit normcap
15:15:07 - DEBUG - normcap.gui.tray:619 - Debug images saved in /tmp/normcap Screen Capture for context -> Kooha-2023-12-14-15-14-56.webm |
Thanks, @KAGEYAM4 ! Seems like NormCap is calling |
@KAGEYAM4, could you please run this test build, again with the Download: https://file.io/yI5y5IM3g7d0 |
this output is from my hyprland with the config i am using, also the same video can be used for context which i posted above.
|
i tried this in my 2nd user account which has default config and there the visual are different, i will post it in a second. |
ok, so here is the thing, if my scaling is 1.25, normcap window opens in fullscreen with black inside. Here's the complete log along with video for context -> https://file.io/76JG3XerQwVa (the video might be corrupted because i had to kill the program, for me mpv plays it perfectly)
|
Hi @KAGEYAM4 , again, thanks for your testings. I finally was able to install Manjaro + Hyprland on an USB drive I can boot to and test myself. However, I identified two other issues: 1.) DBus 2.) Copying to clipboard does not work. On Wayland, NormCap relies on |
@dynobo i was wrong again, after seeing your video i tried to cross check, and the cause was Here's the log ->
Here's a video - https://send.vis.ee/download/e7d53fed31a5a7fd/#_31wl0k4Wo0NVfh1I0UllQ
About this i an not sure exactly what this error relates to but i don't think it shows up on mine maybe this is because for notifications on Hypland we have to use
Same here, i didn't need to install |
AUR version of nromcap running under wayland with Hyprland WM. xdg-desktop-portal is installed, however it using the hyprland version (xdg-desktop-portal-hyprland-git), I'm not sure if that is part of the problem here.
System:
Variables:
Exception:
Traceback:
The text was updated successfully, but these errors were encountered: