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

Add Linux Wayland support #50

Open
calligraf0 opened this issue Nov 17, 2024 · 1 comment
Open

Add Linux Wayland support #50

calligraf0 opened this issue Nov 17, 2024 · 1 comment

Comments

@calligraf0
Copy link

Hi, great little script! :)

Opening an issue to suggest supporting Wayland too along X11.

While this script does not support wayland (yet? 🤓 ) 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 😄!

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
@tommerty
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants