aboutsummaryrefslogtreecommitdiff
path: root/.config/mpv/scripts/copy-subs.lua
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-06-03 22:54:03 +0200
committerlonkaars <loek@pipeframe.xyz>2023-06-03 22:54:03 +0200
commita2d25cba38aee3c5023bcfedf3cc8cc4a1c008a9 (patch)
treed114168505f2415740efff75ad3945c96b82ddb0 /.config/mpv/scripts/copy-subs.lua
parent7eea5fbd3b0ace873715d67beee1dcbae46d64b3 (diff)
update mpv and jellyfin-mpv-shim config
Diffstat (limited to '.config/mpv/scripts/copy-subs.lua')
-rw-r--r--.config/mpv/scripts/copy-subs.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/.config/mpv/scripts/copy-subs.lua b/.config/mpv/scripts/copy-subs.lua
new file mode 100644
index 0000000..ae0aded
--- /dev/null
+++ b/.config/mpv/scripts/copy-subs.lua
@@ -0,0 +1,9 @@
+function copy_sub()
+ sub = mp.get_property("sub-text", "string")
+ if sub and sub ~= '' then
+ os.execute("echo '" .. sub:gsub('\'', '\'\\\'\'') .. "' | xclip -selection clipboard -i")
+ end
+end
+
+mp.add_key_binding(nil, "copy", copy_sub)
+