summary refs log tree commit diff
path: root/.config/mpv/scripts/mouse_coords.lua
blob: 3bc59b9ca10edb6b306e23da05d232056fe02b92 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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()
    x, y = mp.get_mouse_pos()
    pos = "xy: " .. 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)