summary refs log tree commit diff
path: root/.config/mpv/scripts
diff options
context:
space:
mode:
Diffstat (limited to '.config/mpv/scripts')
-rw-r--r--.config/mpv/scripts/hooks.lua27
-rw-r--r--.config/mpv/scripts/mouse_coords.lua41
-rw-r--r--.config/mpv/scripts/openuri.lua42
-rw-r--r--.config/mpv/scripts/yanky.lua37
4 files changed, 0 insertions, 147 deletions
diff --git a/.config/mpv/scripts/hooks.lua b/.config/mpv/scripts/hooks.lua
deleted file mode 100644
index 4f350ec..0000000
--- a/.config/mpv/scripts/hooks.lua
+++ /dev/null
@@ -1,27 +0,0 @@
-local mp = require("mp")
-local utils = require("mp.utils")
-
-local function run(...)
-	utils.subprocess_detached({
-		args = { "sh", "-c", table.concat({ ... }, " ") .. " >/dev/null 2>&1" },
-		max_size = 0,
-		cancellable = false,
-	})
-end
-
-mp.register_event("file-loaded", function()
-	local function cb(n, vo)
-		-- mp.msg.warn(n, vo)
-		if vo == true then
-			run("makoctl", "mode", "-a", "off")
-			run("svdn", "wlsunset")
-			mp.unobserve_property(cb)
-		end
-	end
-	mp.observe_property("vo-configured", "bool", cb)
-end)
-
-mp.register_event("shutdown", function()
-	run("makoctl", "mode", "-r", "off")
-	run("svup", "wlsunset")
-end)
diff --git a/.config/mpv/scripts/mouse_coords.lua b/.config/mpv/scripts/mouse_coords.lua
deleted file mode 100644
index b2a2a65..0000000
--- a/.config/mpv/scripts/mouse_coords.lua
+++ /dev/null
@@ -1,41 +0,0 @@
-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)
diff --git a/.config/mpv/scripts/openuri.lua b/.config/mpv/scripts/openuri.lua
deleted file mode 100644
index 61b20e5..0000000
--- a/.config/mpv/scripts/openuri.lua
+++ /dev/null
@@ -1,42 +0,0 @@
-mp = require("mp")
-format_json = require("mp.utils").format_json
-
-function open_uri()
-    local json = format_json({
-        type = "open-uri",
-        title = "https://mpv.io",
-        items = {
-            {
-                title = "Enter a network url",
-                align = "left",
-                value = "ignore",
-                muted = true,
-                selectable = false
-            }
-        },
-        on_search = { "script-message-to", mp.get_script_name(), "openuri-cb" },
-        palette = true,
-        search_style = "palette",
-        search_debounce = "submit"
-    }) or "{}"
-    mp.commandv("script-message-to", "uosc", "open-menu", json)
-end
-
-mp.register_script_message("openuri-cb", function(path)
-    mp.commandv("script-message-to", "uosc", "close-menu", "openuri")
-    mp.commandv("loadfile", path, "append-play")
-end)
-
-mp.add_key_binding("ctrl+o", "openuri", open_uri)
-
-mp.add_key_binding("ctrl+shift+o", "pasteuri", function()
-    local r = mp.command_native({
-        name = "subprocess",
-        playback_only = false,
-        capture_stdout = true,
-        args = { "wl-paste" },
-    })
-    if r.status == 0 then
-        mp.commandv("script-message-to", mp.get_script_name(), "openuri-cb", r.stdout)
-    end
-end)
diff --git a/.config/mpv/scripts/yanky.lua b/.config/mpv/scripts/yanky.lua
deleted file mode 100644
index be9d308..0000000
--- a/.config/mpv/scripts/yanky.lua
+++ /dev/null
@@ -1,37 +0,0 @@
-local mp = require("mp")
-
-function yank(payload)
-	mp.commandv("run", "wl-copy", payload)
-	mp.msg.info("yanked: " .. payload)
-	mp.osd_message("yanked: " .. payload)
-end
-
-function yankproperty(prop)
-	yank(mp.get_property_native(prop))
-end
-
-function yankpath()
-	local path = mp.get_property_native("path")
-	if path ~= "^http" then
-		yank(path)
-		return
-	end
-	local cwd = mp.get_property_native("working-directory")
-	yank(require("mp.utils").join_path(cwd, path))
-end
-
-function yanktime()
-	local s = mp.get_property_native("playback-time")
-	local ts = string.format("%.2d:%.2d:%.2d.%.3d", s / (60 * 60), s / 60 % 60, s % 60, (s % 1) * 1000)
-	yank(ts)
-end
-
-function yanksubs()
-	local subText = mp.get_property("sub-text")
-	-- local secondarySubText = mp.get_property("secondary-sub-text")
-	yank(subText)
-end
-
-mp.add_key_binding("y-t", "yanktime", yanktime)
-mp.add_key_binding("y-p", "yankpath", yankpath)
-mp.add_key_binding("y-s", "yanksubs", yanksubs)