diff options
Diffstat (limited to '.config/mpv/scripts/copy-subs.lua')
-rw-r--r-- | .config/mpv/scripts/copy-subs.lua | 9 |
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) + |