Skip to content

Commit

Permalink
Copy secondary subs shortcut (#114)
Browse files Browse the repository at this point in the history
* Copy secondary subs shortcut

* change default to ctrl+shift+c

---------

Co-authored-by: Ren Tatsumoto <[email protected]>
  • Loading branch information
artjomsR and tatsumoto-ren authored Mar 8, 2024
1 parent c28d793 commit 9d36192
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ Ctrl+n script-binding mpvacious-export-note
Ctrl+m script-binding mpvacious-update-last-note
Ctrl+M script-binding mpvacious-overwrite-last-note
Ctrl+c script-binding mpvacious-copy-sub-to-clipboard
Ctrl+c script-binding mpvacious-copy-primary-sub-to-clipboard
Ctrl+C script-binding mpvacious-copy-secondary-sub-to-clipboard
Ctrl+t script-binding mpvacious-autocopy-toggle
H script-binding mpvacious-sub-seek-back
Expand Down
3 changes: 2 additions & 1 deletion subs2srs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,8 @@ local main = (function()
subs_observer.init(menu, config)

-- Key bindings
mp.add_forced_key_binding("Ctrl+c", "mpvacious-copy-sub-to-clipboard", subs_observer.copy_current_to_clipboard)
mp.add_forced_key_binding("Ctrl+c", "mpvacious-copy-sub-to-clipboard", subs_observer.copy_current_primary_to_clipboard)
mp.add_key_binding("Ctrl+C", "mpvacious-copy-secondary-sub-to-clipboard", subs_observer.copy_current_secondary_to_clipboard)
mp.add_key_binding("Ctrl+t", "mpvacious-autocopy-toggle", subs_observer.toggle_autocopy)
mp.add_key_binding("Ctrl+g", "mpvacious-animated-snapshot-toggle", encoder.snapshot.toggle_animation)

Expand Down
12 changes: 10 additions & 2 deletions subtitles/observer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ autoclip_method = (function()
}
end)()

local function copy_subtitle(subtitle_id)
self.copy_to_clipboard("copy-on-demand", mp.get_property(subtitle_id))
end

------------------------------------------------------------
-- public

Expand All @@ -157,8 +161,12 @@ self.maybe_remove_all_spaces = function(str)
end
end

self.copy_current_to_clipboard = function()
self.copy_to_clipboard("copy-on-demand", mp.get_property("sub-text"))
self.copy_current_primary_to_clipboard = function()
copy_subtitle("sub-text")
end

self.copy_current_secondary_to_clipboard = function()
copy_subtitle("secondary-sub-text")
end

self.user_altered = function()
Expand Down

0 comments on commit 9d36192

Please sign in to comment.