hs.canvas and mutliple screens?

74 views
Skip to first unread message

Von Welch

unread,
Oct 26, 2022, 10:17:03 AM10/26/22
to Hammerspoon
Hello everyone,

 Anyone know how to place a hs.canvas object on a specific screen when you have multiple displays connected? I'm not seeing anything obvious in the documentation or the examples.

Thanks in advance,

Von

Chris Jones

unread,
Oct 26, 2022, 5:15:33 PM10/26/22
to Von Welch, Hammerspoon
The coordinate rect you pass to hs.canvas.new() should be in the 'absolute' coordinate space, which includes all monitors.

If you get a reference to the monitor you want to use, from hs.screen, then fetch its :fullFrame() method, you'll get the absolute coordinates for the monitor's origin, and you can then offset your canvas rect from that.

Cheers,
Chris

--
You received this message because you are subscribed to the Google Groups "Hammerspoon" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hammerspoon...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/hammerspoon/730ece71-6fe2-4925-b967-1db6ad56759fn%40googlegroups.com.


--
Cheers,

Chris
Reply all
Reply to author
Forward
0 new messages