obs-zoom-to-mouse icon indicating copy to clipboard operation
obs-zoom-to-mouse copied to clipboard

Add Linux Wayland support

Open calligraf0 opened this issue 1 year ago • 4 comments

Hi, great little script! :)

Opening an issue to suggest supporting Wayland too along X11.

While this script does not support wayland (yet? :nerd_face: ) as far as I can tell, I worked on a little workaround to use obs-zoom-to-mouse by "abusing" the obs-zoom-to-mouse-remote on KDE. I'm sure a similar solution is doable on other DE.

Hopefully this will help some people out :smile:!

For the workaround, the first script just prints the coordinates with a kwin script: mouse.coords.kwin:

print(workspace.cursorPos.x+" "+ workspace.cursorPos.y)

The second script is just a convenience script to run the above. mouse.coords.sh:

script=$1

while true; do
        now=$(date +%T)
        num=$(dbus-send --print-reply --dest=org.kde.KWin \
                /Scripting org.kde.kwin.Scripting.loadScript \
                string:"$script" | awk 'END {print $2}')

        dbus-send --print-reply --dest=org.kde.KWin /Scripting/Script$num \
                org.kde.kwin.Script.run >/dev/null

        dbus-send --print-reply --dest=org.kde.KWin /Scripting/Script$num \
                org.kde.kwin.Script.stop >/dev/null

        coords=$(journalctl _COMM=kwin_wayland -o cat --since "$now" | sed 's/^js: //' | tail -1)

        echo $coords | ncat -u 127.0.0.1 12345
        sleep 0.10 #optional
done

Launch via:

bash mouse.coords.sh mouse.coords.kwin

calligraf0 avatar Nov 17 '24 02:11 calligraf0

Big plus 1 on this. I'm on Gnome so I couldn't test with your workaround and lack the general knowledge of how to get something going.

tommerty avatar Nov 29 '24 22:11 tommerty

I am on Gnome too, and I tried to use the script for the "Screen Capture (Pipewire)" source with very little success.

When using a single monitor, it does not follow the mouse, and the zooming always happens in the same region. That region depends on the manual offsets, but it is static.

When using two monitors, only the one where OBS is displayed seems to have zoom in/out functionality, although not following the mouse like in the first case. There is no zoom in/out if the other monitor is selected for the source until you click somewhere on the monitor where OBS is displayed.

I could use this script on machines with no Pipewire and it worked like a charm, though.

javiercarrascocruz avatar Jan 22 '25 18:01 javiercarrascocruz

Still search for Wayland on GNOME Ubuntu, any solutions?

blackinitial avatar Jan 26 '25 04:01 blackinitial

Very much needed!

mmBesar avatar Mar 16 '25 15:03 mmBesar