aboutsummaryrefslogtreecommitdiff
path: root/.config/mpv/scripts
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
commite43eb1177872f52e949fb5f0f93396ed94b0d093 (patch)
tree78b73af6a989fa2996d71b112e161b70d35081ef /.config/mpv/scripts
parent2f14a896e4b897bd747c24d7ad8e9e7bb3237d03 (diff)
move to chezmoi
Diffstat (limited to '.config/mpv/scripts')
-rw-r--r--.config/mpv/scripts/copy-subs.lua32
1 files changed, 0 insertions, 32 deletions
diff --git a/.config/mpv/scripts/copy-subs.lua b/.config/mpv/scripts/copy-subs.lua
deleted file mode 100644
index 973e1f2..0000000
--- a/.config/mpv/scripts/copy-subs.lua
+++ /dev/null
@@ -1,32 +0,0 @@
-_G.auto = false
-
-function copy()
- local sub = mp.get_property("sub-text")
- if sub then
- -- remove some specific unicode characters
- sub = sub:gsub('\u{27a1}', '')
- sub = sub:gsub('\u{fffd}', '')
- sub = sub:gsub('\u{3013}', '')
- sub = sub:gsub('\u{2015}', '')
-
- sub = sub:gsub('\n', ' ') -- replace newlines with space
- sub = sub:gsub('\'', '\'\\\'\'') -- escape single quotes
- os.execute("echo '" .. sub .. "' | xclip -selection clipboard -i")
- end
-end
-
-function autocopy()
- if _G.auto == false then return end
- copy()
-end
-
-function toggle_autocopy()
- _G.auto = not _G.auto
- mp.osd_message("autocopy " .. (_G.auto and "on" or "off"))
-end
-
-mp.add_key_binding(nil, "copy", copy)
-
-mp.observe_property("sub-text", "string", autocopy)
-mp.add_key_binding(nil, "auto", toggle_autocopy)
-