Skip to content
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, Wayland] Multi monitor issues - Help needed! #582

Open
dynobo opened this issue Jan 5, 2024 · 2 comments
Open

[Linux, Wayland] Multi monitor issues - Help needed! #582

dynobo opened this issue Jan 5, 2024 · 2 comments
Labels
bug Something isn't working help wanted Looking for contributors to work on this issue

Comments

@dynobo
Copy link
Owner

dynobo commented Jan 5, 2024

What happened?

Multi monitor support seems broken, at least under Gnome: The multiple windows, which NormCap creates in multi display setups, are not positioned correctly on their corresponding screens.

Symptoms:

  • All NormCap windows remain on the same monitor, only this monitor shows a pink border.
  • The monitor with the pink screen might show an image of a different monitor. This depends on which NormCap window is on top, which depends on the individual setup.

Call for ideas!

To be honest, I'm kinda out of ideas on how to proceed, that's why I need your help!

  • Do you know other options/workarounds to display overlays on all screens in Wayland?
  • Thinking out-of-the-box, do you have ideas for a different user workflow? One that could avoid the need for positioning of any Window at all?
  • Do you know any other software with similar needs (selecting a region of the screen) which solve this workflow successfully on Wayland?

Underlying reason

Applications on Wayland are not supposed to configure their position and size, in Wayland philosophy, this is the responsibility of the window manager alone.

Over the years, NormCap used different workarounds to still position it's window in multi monitor setups. The workaround that is currently implement, is to use dbus org.gnome.Shell.Eval to run some javascript to move the windows on the corresponding screen.

Today I noticed, that org.gnome.Shell.Eval is not working anymore: Due to it's powerful interface, it has been deemed unsafe and with one of the last system updates, it got disabled by default (except for some Gnome debugging tools).

KDE offers a different dbus interface org.kde.kwin.Scripting, and therefore NormCap's positioning logic should still work on KDE. Please let me know, if it doesn't!

How did you install NormCap?

Affects all installation methods

Operating System + Version?

Linux

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

Wayland, Gnome

Debug log output?*

Nothing visible in the logs.

@dynobo dynobo added bug Something isn't working help wanted Looking for contributors to work on this issue labels Jan 5, 2024
@dynobo dynobo pinned this issue Jan 5, 2024
@mercifulboss
Copy link

mercifulboss commented Mar 20, 2024

Do you know any other software with similar needs (selecting a region of the screen) which solve this workflow successfully on Wayland?

Yes. Check Spectacle on KDE. It allows recording a portion of the screen (only on wayland) and its an official kde app.

https://apps.kde.org/spectacle/

Here is the github:
https://github.com/KDE/spectacle

Here's me using it to record a portion of my screen on wayland:
Screencast_20240320_142442.webm

I do not have technical knowledge to help you more but i can test stuff if you want

@zany130
Copy link

zany130 commented May 31, 2024

I think I am having this same issue on KDE . Recently it only wants to copy from my second monitor. No matter what I try I can't copy text from my primary monitor.

the normcap pink boarder will always open on my second monitor and I cant select anything from a different monitor

EDIT: IT seems it's capturing the screen that Doesn't have a Wayland app open .

So, If I have my Wayland window on my primary, it captures the secondary.

If I have my Wayland window on the secondary, it captures the primary.

Super weird

and If I have a Wayland window on both monitors, it captures nothing

normcap -v debug
15:28:20 - INFO    - normcap:50 - Start NormCap v0.5.8
15:28:20 - DEBUG   - normcap:95 - Set XCURSOR_SIZE=24
15:28:20 - DEBUG   - normcap:100 - Set QT_QPA_PLATFORM=wayland
15:28:21 - DEBUG   - normcap.gui.tray:70 - System info:
{'normcap_version': '0.5.8', 'python_version': '3.12.3', 'cli_args': '/usr/bin/normcap -v debug', 'is_briefcase_package': False, 'is_flatpak_package': False, 'is_appimage_package': False, 'platform': 'linux', 'desktop_environment': <DesktopEnvironment.KDE: 3>, 'display_manager_is_wayland': True, 'pyside6_version': '6.7.1', 'qt_version': '6.7.1', 'qt_library_path': '/usr/lib/qt6/plugins, /usr/bin', 'locale': 'DEFAULT', 'config_directory': PosixPath('/home/zany130/.config/normcap'), 'resources_path': PosixPath('/usr/lib/python3.12/site-packages/normcap/resources'), 'tesseract_path': PosixPath('/usr/bin/tesseract'), 'tessdata_path': None, 'envs': {'TESSDATA_PREFIX': None, 'LD_LIBRARY_PATH': None}, 'screens': [Screen(left=1536, top=337, right=3583, bottom=1200, device_pixel_ratio=2.0, index=0, screenshot=None), Screen(left=0, top=0, right=1535, bottom=863, device_pixel_ratio=2.0, index=1, screenshot=None)]}
15:28:21 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (show_introduction: None)
15:28:21 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (cli_mode: False)
15:28:21 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (background_mode: False)
15:28:21 - DEBUG   - normcap.gui.settings:162 - Skip update of non existing setting (clipboard_handler: None)
15:28:21 - DEBUG   - normcap.gui.tray:384 - Listen on local socket v0.5.8-normcap.
15:28:21 - DEBUG   - normcap.screengrab.main:21 - Compatible capture handlers: ['DBUS_PORTAL', 'DBUS_SHELL']
15:28:21 - DEBUG   - normcap.screengrab.main:28 - Available capture handlers: ['DBUS_PORTAL', 'DBUS_SHELL']
15:28:21 - DEBUG   - normcap.screengrab.handlers.dbus_portal:92 - DBus request message: <PySide6.QtDBus.QDBusMessage(type=MethodReturn, service="", signature="o", contents=([ObjectPath: /org/freedesktop/portal/desktop/request/1_8882/normcap_fdbigdda]) ) at 0x729a230c34c0>
15:28:21 - DEBUG   - normcap.screengrab.handlers.dbus_portal:99 - Request accepted
15:28:21 - DEBUG   - normcap.ocr.tesseract:24 - Executing '/usr/bin/tesseract --list-langs'
15:28:21 - DEBUG   - normcap.ocr.tesseract:37 - Tesseract command output: List of available languages in "/usr/share/tessdata/" (2): ¬ eng ¬ osd ¬
15:28:21 - DEBUG   - normcap.screengrab.handlers.dbus_portal:119 - DBus signal message: <PySide6.QtDBus.QDBusMessage(type=Signal, service=":1.20", path="/org/freedesktop/portal/desktop/request/1_8882/normcap_fdbigdda", interface="org.freedesktop.portal.Request", member="Response", signature="ua{sv}", contents=(0, [Argument: a{sv} {"uri" = [Variant(QString): "file:///home/zany130/Pictures/Screenshot_20240531_152821.png"]}]) ) at 0x729a230c34c0>
15:28:21 - DEBUG   - normcap.screengrab.handlers.dbus_portal:137 - Parse response
15:28:22 - DEBUG   - normcap.screengrab.post_processing:17 - Virtual geometry width: 3584
15:28:22 - DEBUG   - normcap.screengrab.post_processing:18 - Image width: 4480
15:28:22 - DEBUG   - normcap.screengrab.post_processing:19 - Resize ratio: 1.25
15:28:22 - INFO    - normcap.screengrab.main:67 - Screen captured using DBUS_PORTAL
15:28:22 - DEBUG   - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2024-05-31_19-28-22_raw_screen0.png
15:28:22 - DEBUG   - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2024-05-31_19-28-22_raw_screen1.png
15:28:22 - DEBUG   - normcap.gui.window:51 - Create window for screen 0
15:28:22 - DEBUG   - normcap.gui.window:141 - Set window of screen 0 to fullscreen
15:28:23 - DEBUG   - normcap.gui.window:51 - Create window for screen 1
15:28:23 - DEBUG   - normcap.gui.window:141 - Set window of screen 1 to fullscreen
15:28:23 - DEBUG   - normcap.gui.dbus:126 - Moving window 'NormCap [0]' to (left=1536, top=337, right=3583, bottom=1200) via org.kde.kwin.Scripting
15:28:23 - WARNING - normcap.gui.dbus:156 - Failed to move window via org.kde.kwin.Scripting!
15:28:23 - DEBUG   - normcap.gui.dbus:157 - Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/normcap/gui/dbus.py", line 150, in move_window_via_kde_kwin_scripting
    raise RuntimeError(  # noqa: TRY301
RuntimeError: ('org.kde.kwin.Scripting.loadScript response: %s', (17,))
15:28:23 - DEBUG   - normcap.gui.dbus:126 - Moving window 'NormCap [1]' to (left=0, top=0, right=1535, bottom=863) via org.kde.kwin.Scripting
15:28:23 - WARNING - normcap.gui.dbus:156 - Failed to move window via org.kde.kwin.Scripting!
15:28:23 - DEBUG   - normcap.gui.dbus:157 - Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/normcap/gui/dbus.py", line 150, in move_window_via_kde_kwin_scripting
    raise RuntimeError(  # noqa: TRY301
RuntimeError: ('org.kde.kwin.Scripting.loadScript response: %s', (18,))
15:28:24 - DEBUG   - normcap.gui.tray:350 - Hide 2 windows
15:28:24 - INFO    - normcap.gui.tray:242 - Crop image to region (1353, 523, 1608, 553)
15:28:24 - DEBUG   - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2024-05-31_19-28-24_cropped.png
15:28:24 - DEBUG   - normcap.gui.tray:267 - Start OCR
15:28:24 - DEBUG   - normcap.ocr.enhance:84 - Scale image x2
15:28:24 - DEBUG   - normcap.ocr.enhance:57 - Pad image by 80px
15:28:24 - DEBUG   - normcap.ocr.recognize:34 - Run Tesseract on image of size (672, 222) with args:
TessArgs(tessdata_path=None, lang='eng', oem=<OEM.DEFAULT: 3>, psm=<PSM.AUTO: 3>)
15:28:24 - DEBUG   - normcap.ocr.tesseract:24 - Executing '/usr/bin/tesseract /tmp/tmp_yfjvb9h/normcap_tesseract_input.png /tmp/tmp_yfjvb9h/normcap_tesseract_input.png -c tessedit_create_tsv=1 -l eng --oem 3 --psm 3 -c tessedit_write_images=1 -c tessedit_dump_pageseg_images=1'
15:28:24 - DEBUG   - normcap.ocr.tesseract:37 - Tesseract command output:
15:28:24 - DEBUG   - normcap.ocr.tesseract:67 - Skip moving file to temp dir, it does not exist: /tmp/tmp_yfjvb9h/normcap_tesseract_input.png.png_debug.pdf
15:28:24 - DEBUG   - normcap.ocr.recognize:43 - OCR result:
OcrResult(tess_args=TessArgs(tessdata_path=None, lang='eng', oem=<OEM.DEFAULT: 3>, psm=<PSM.AUTO: 3>), words=[], image=<PySide6.QtGui.QImage(QSize(672, 222),format=QImage::Format_RGB32,depth=32,devicePixelRatio=1,bytesPerLine=2688,sizeInBytes=596736) at 0x729a230b6000>, transformer_scores={}, parsed='')
15:28:24 - INFO    - normcap.ocr.transformers.email:56 - 0 emails found
15:28:24 - DEBUG   - normcap.ocr.transformers.email:65 - 0/0 (0) chars in emails
15:28:24 - INFO    - normcap.ocr.transformers.url:60 - 0 URLs found
15:28:24 - DEBUG   - normcap.ocr.transformers.url:66 - 0/1 (0.0) chars in urls
15:28:24 - DEBUG   - normcap.ocr.transformer:74 - Transformer scores:
{<Transformer.SINGLE_LINE: 1>: 1, <Transformer.MULTI_LINE: 2>: 0, <Transformer.PARAGRAPH: 3>: 200.0, <Transformer.MAIL: 4>: 0, <Transformer.URL: 5>: 0.0}
15:28:24 - DEBUG   - normcap.ocr.recognize:47 - Parsed text:

15:28:24 - DEBUG   - normcap.gui.utils:22 - Save debug image as /tmp/normcap/2024-05-31_19-28-24_enhanced.png
15:28:24 - INFO    - normcap.gui.tray:285 - Text from OCR:

15:28:24 - DEBUG   - normcap.gui.tray:319 - Nothing there to be copied to clipboard!
15:28:24 - DEBUG   - normcap.gui.notification:135 - Send notification via notify-send
^C⏎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Looking for contributors to work on this issue
Projects
None yet
Development

No branches or pull requests

3 participants