summary refs log tree commit diff
path: root/.config/mpv/scripts/mouse_coords.lua
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2020-01-26 17:16:07 +0100
committerRobert Günzler <r@gnzler.io>2020-01-26 18:00:59 +0100
commitf5d56602df70950de6b7d40966b00c9939c81763 (patch)
treeb50ffeb5496fe3525cc1bab2629389ced95435b7 /.config/mpv/scripts/mouse_coords.lua
Intial commit of v2
See https://drewdevault.com/2019/12/30/dotfiles.html
Diffstat (limited to '.config/mpv/scripts/mouse_coords.lua')
-rw-r--r--.config/mpv/scripts/mouse_coords.lua31
1 files changed, 31 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..dae6239
--- /dev/null
+++ b/.config/mpv/scripts/mouse_coords.lua
@@ -0,0 +1,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 = "x: " .. x .. ", y: " .. 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)