tryptech / obs-zoom-and-follow

Dynamic zoom and mouse tracking script for OBS Studio
Apache License 2.0
371 stars 62 forks source link

Source list is empty [Linux] #74

Open Vashinator opened 2 years ago

Vashinator commented 2 years ago

I am not seeing any source in Linux.

I am using OBS 28. Python version 3.10.7

image

I am almost wondering if this is an issue with the OBS api itself.

Script log is below. I know a bit of Python so glad to try to update the script if needed. I'm really interested in actually getting this working for content creation.

[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 18, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Key 'source' does not exist | {}
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 105, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 191, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] System: Linux
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 277, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] System: Linux
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 355, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Zoom: True
[zoom_and_follow_mouse.py] Mouse position: [1151, 622]
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 435, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Zoom: True
[zoom_and_follow_mouse.py] Mouse position: [952, 1026]
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 515, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Zoom: True
[zoom_and_follow_mouse.py] Mouse position: [1476, 1023]
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 595, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Zoom: True
[zoom_and_follow_mouse.py] Mouse position: [1961, 1048]
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1103, in getAllScreens
[zoom_and_follow_mouse.py]     crtc = DISP.xrandr_get_crtc_info(params.crtc, res.config_timestamp)
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/ext/randr.py", line 739, in get_crtc_info
[zoom_and_follow_mouse.py]     return GetCrtcInfo (
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1369, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/vash/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1389, in reply
[zoom_and_follow_mouse.py]     raise self._error
[zoom_and_follow_mouse.py] Xlib.error.XError: <class 'Xlib.error.XError'>: code = 148, resource_id = 0, sequence_number = 675, major_opcode = 140, minor_opcode = 20
[zoom_and_follow_mouse.py] 
[zoom_and_follow_mouse.py] Zoom: True
[zoom_and_follow_mouse.py] Mouse position: [1979, 1064]
tryptech commented 2 years ago

Going off the error, this seems like it's an error in PyWinCtl, their getAllScreens function, and whatever desktop environment/window manager you're using. It would be more appropriate to ask there

Vashinator commented 2 years ago

Going off the error, this seems like it's an error in PyWinCtl, their getAllScreens function, and whatever desktop environment/window manager you're using. It would be more appropriate to ask there

Thanks, I'll open an issue with them.

tryptech commented 1 year ago

Similar to the issue in #76, I'm hoping this is addressed in https://github.com/tryptech/obs-zoom-and-follow/commit/388328fb15cd25c01cb5ffcc79d18ff28808aa74

Let me know if the issue persists.

Desaydrone commented 1 year ago

Hello,

I got same problem here no source in list,

I use OBS 28.1.2 Python 3.11.1 Fedora 37 Gnome 43.2

I try this little script

import pywinctl
print(pywinctl.getAllScreens())
print (" ")
print(pywinctl.getAllWindows())

and i got this in return

{'HDMI-0': {'id': 19, 'is_primary': False, 'pos': Point(x=3840, y=0), 'size': Size(width=2160, height=3840), 'workarea': Rect(left=3840, top=1711, right=6000, bottom=3840), 'scale': (96, 303), 'dpi': (92, 291), 'orientation': 3, 'frequency': 59.996624662466246, 'colordepth': 24}, 'DP-0': {'id': 21, 'is_primary': False, 'pos': Point(x=0, y=1680), 'size': Size(width=3840, height=2160), 'workarea': Rect(left=0, top=3391, right=3840, bottom=3840), 'scale': (146, 146), 'dpi': (140, 140), 'orientation': 0, 'frequency': 59.996624662466246, 'colordepth': 24}}

[LinuxWindow(hWnd=<class 'Xlib.display.Window'>(0x03a00004)), LinuxWindow(hWnd=<class 'Xlib.display.Window'>(0x02e00007)), LinuxWindow(hWnd=<class 'Xlib.display.Window'>(0x02c0003e)), LinuxWindow(hWnd=<class 'Xlib.display.Window'>(0x00600007))]

In the zoom_and_follow_mouse log i got this:

[zoom_and_follow_mouse.py] Key 'source' does not exist | {'Manual Monitor Dim': True, 'Manual Offset': True, 'follow.toggle': [{'control': True, 'key': 'OBS_KEY_Z', 'shift': True}], 'zoom.toggle': [{'control': True, 'key': 'OBS_KEY_A', 'shift': True}]}
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] System: Linux
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] System: Linux
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
gitacrobat commented 1 year ago

Same problem here

OBS 29.0.0-1 Python 3.10.9 Arch Linux Xmonad Window Manager

This script

import pywinctl
print(pywinctl.getAllScreens())
print (" ")
print(pywinctl.getAllWindows())

returns

{'DisplayPort-1': {'id': 24, 'is_primary': True, 'pos': Point(x=0, y=0), 'size': Size(width=2560, height=1440), 'workarea': Rect(left=0, top=0, right=-1200, bottom=-480), 'scale': (114, 114), 'dpi': (109, 109), 'orientation': 0, 'frequency': 59.9505501052548, 'colordepth': 24}, 'DisplayPort-2': {'id': 26, 'is_primary': False, 'pos': Point(x=2560, y=0), 'size': Size(width=1200, height=1920), 'workarea': Rect(left=2560, top=0, right=0, bottom=0), 'scale': (61, 157), 'dpi': (59, 151), 'orientation': 3, 'frequency': 59.95017128620368, 'colordepth': 24}}

[LinuxWindow(hWnd=<Window 0x03e00008>), LinuxWindow(hWnd=<Window 0x02200002>), LinuxWindow(hWnd=<Window 0x02c0008b>), LinuxWindow(hWnd=<Window 0x02c0000e>), LinuxWindow(hWnd=<Window 0x0260007e>), LinuxWindow(hWnd=<Window 0x02600025>), LinuxWindow(hWnd=<Window 0x0260006c>), LinuxWindow(hWnd=<Window 0x02600046>), LinuxWindow(hWnd=<Window 0x03200002>)]

zoom_and_follow_mouse log:

[zoom_and_follow_mouse.py] Key 'source' does not exist | {'follow.toggle': [], 'zoom.toggle': []}
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] System: Linux
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
Conner-PYS commented 1 year ago

I was having the same issue, running Fedora 37 with Sway. I've made an update to the script to now accept Pipewire sources, which can be found at this PR: https://github.com/tryptech/obs-zoom-and-follow/pull/93.

I'm still in the process of testing it on my system, but feel free to give it a shot as well.

Edit: Direct link to the script if unfamiliar with git or github PRs: https://raw.githubusercontent.com/Conner-PYS/obs-zoom-and-follow/master/zoom_and_follow_mouse.py

gitacrobat commented 1 year ago

I was having the same issue, running Fedora 37 with Sway. I've made an update to the script to now accept Pipewire sources, which can be found at this PR: #93.

I'm still in the process of testing it on my system, but feel free to give it a shot as well.

Edit: Direct link to the script if unfamiliar with git or github PRs: https://raw.githubusercontent.com/Conner-PYS/obs-zoom-and-follow/master/zoom_and_follow_mouse.py

Many thanks! At first glance sources are showing up. I'll have to test more thoroughly.

LeoFuso commented 1 year ago

I was having the same issue, running Fedora 37 with Sway. I've made an update to the script to now accept Pipewire sources, which can be found at this PR: #93.

I'm still in the process of testing it on my system, but feel free to give it a shot as well.

Edit: Direct link to the script if unfamiliar with git or github PRs: https://raw.githubusercontent.com/Conner-PYS/obs-zoom-and-follow/master/zoom_and_follow_mouse.py

It worked, but now when I press the zoom hot-key I get this error:

[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "/usr/share/obs/obs-plugins/frontend-tools/scripts/zoom_and_follow_mouse.py", line 873, in toggle_zoom
[zoom_and_follow_mouse.py]     zoom.update_sources()
[zoom_and_follow_mouse.py]   File "/usr/share/obs/obs-plugins/frontend-tools/scripts/zoom_and_follow_mouse.py", line 103, in update_sources
[zoom_and_follow_mouse.py]     self.monitors = pwc.getAllScreens()
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/pywinctl/_pywinctl_linux.py", line 1181, in getAllScreens
[zoom_and_follow_mouse.py]     wa = EWMH.getWorkArea() or [0, 0, 0, 0]
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/ewmh/ewmh.py", line 311, in getWorkArea
[zoom_and_follow_mouse.py]     return self._getProperty('_NET_WORKAREA')
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/ewmh/ewmh.py", line 405, in _getProperty
[zoom_and_follow_mouse.py]     atom = win.get_full_property(self.display.get_atom(_type),
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/xobject/drawable.py", line 476, in get_full_property
[zoom_and_follow_mouse.py]     prop = self.get_property(property, property_type, sizehint,
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/xobject/drawable.py", line 455, in get_property
[zoom_and_follow_mouse.py]     r = request.GetProperty(display = self.display,
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1368, in __init__
[zoom_and_follow_mouse.py]     self.reply()
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1380, in reply
[zoom_and_follow_mouse.py]     self._display.send_and_recv(request = self._serial)
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/display.py", line 612, in send_and_recv
[zoom_and_follow_mouse.py]     gotreq = self.parse_response(request)
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/display.py", line 704, in parse_response
[zoom_and_follow_mouse.py]     gotreq = self.parse_request_response(request) or gotreq
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/display.py", line 792, in parse_request_response
[zoom_and_follow_mouse.py]     req._parse_response(self.data_recv[:self.recv_packet_len])
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1392, in _parse_response
[zoom_and_follow_mouse.py]     self._data, d = self._reply.parse_binary(data, self._display, rawdict = True)
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 1202, in parse_binary
[zoom_and_follow_mouse.py]     ret[f.name], data = f.parse_binary_value(data, display,
[zoom_and_follow_mouse.py]   File "/home/leonardo/.local/lib/python3.10/site-packages/Xlib/protocol/rq.py", line 671, in parse_binary_value
[zoom_and_follow_mouse.py]     return ret, data
[zoom_and_follow_mouse.py] UnboundLocalError: local variable 'ret' referenced before assignment