diff options
| author | Robert Günzler <r@gnzler.io> | 2026-04-08 13:26:13 +0900 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2026-04-08 13:26:13 +0900 |
| commit | 4e34cbf9673aeaba252e01df554a0d204e83c5e2 (patch) | |
| tree | f3eea07d0e2bf1628ce19987c5164577f63ac614 /.config/mpv/scripts/mouse_coords.lua | |
| parent | 28db7c76e26c312918959384e02e433f8858de49 (diff) | |
Automated-commit-by: dots Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to '')
| -rw-r--r-- | .config/mpv/scripts/mouse_coords.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/.config/mpv/scripts/mouse_coords.lua b/.config/mpv/scripts/mouse_coords.lua new file mode 100644 index 0000000..b2a2a65 --- /dev/null +++ b/.config/mpv/scripts/mouse_coords.lua @@ -0,0 +1,41 @@ +local msg = require("mp.msg") + +-- local x, y = 0, 0 + +-- function set_marker() +-- x, y = mp.get_mouse_pos() +-- end + +-- function measure() +-- x2, y2 = mp.get_mouse_pos() +-- w = x2-x +-- h = y2-y + +-- pos = "x: " .. x .. ", y:" .. y +-- dimensions = "w: " .. h .. ", h:" .. h +-- output = pos .. " | " .. dimensions + +-- mp.msg.warn(output) +-- mp.osd_message(output) +-- end + +function print_pos() + dw = mp.get_property_number("dwidth") + dh = mp.get_property_number("dheight") + ow, oh = mp.get_osd_size() + + wr = math.floor(ow / dw) + hr = math.floor(oh / dh) + + mx, my = mp.get_mouse_pos() + x = math.floor(mx / wr) + y = math.floor(my / hr) + + pos = dw .. "x" .. dh .. " " .. x .. "," .. y + mp.msg.warn(pos) + mp.osd_message(pos) +end + +mp.add_key_binding("0", mp.get_script_name(), print_pos) +-- mp.add_key_binding("8", mp.get_script_name().."/set", set_marker) +-- mp.add_key_binding("9", mp.get_script_name().."/measure", measure) |