Skip to content

Commit

Permalink
feat: paste-to-playlist now also opens file if mpv is idle
Browse files Browse the repository at this point in the history
ref #983
  • Loading branch information
tomasklaen committed Sep 6, 2024
1 parent 6ef8af5 commit a9938c2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/uosc/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1090,10 +1090,15 @@ bind_command('paste-to-open', function()
if payload then mp.commandv('loadfile', payload) end
end)
bind_command('paste-to-playlist', function()
local payload = get_clipboard()
if payload then
mp.commandv('loadfile', payload, 'append')
mp.commandv('show-text', t('Added to playlist') .. ': ' .. payload, 3000)
-- If there's no file loaded, we use `paste-to-open`, which both opens and adds to playlist
if state.is_idle then
mp.commandv('script-binding', 'uosc/paste-to-open')
else
local payload = get_clipboard()
if payload then
mp.commandv('loadfile', payload, 'append')
mp.commandv('show-text', t('Added to playlist') .. ': ' .. payload, 3000)
end
end
end)
bind_command('copy-to-clipboard', function() set_clipboard(state.path) end)
Expand Down

0 comments on commit a9938c2

Please sign in to comment.