Replies: 1 comment 5 replies
mp.observe_property('clipboard/text', 'native', function (_, clipboard)
if clipboard and clipboard:find('^http') and (mp.get_property_native('idle-active') or mp.get_property_native('eof-reached')) then
mp.commandv('loadfile', clipboard)
end
end) |
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
So I noticed that we have
--clipboard-enable=<yes|no> (Windows and Wayland only) Enable native clipboard support (default: yes). This allows reading and writing to the clipboard property to get and set clipboard contents. --clipboard-monitor=<yes|no> (Windows only) Enable clipboard monitoring so that the clipboard property can be observed for content changes (default: no). This only affects clipboard implementations which use polling to monitor clipboard updates. Other platforms currently ignore this option and always/never notify changes.I've tried to use it (with AI help), couldn't get it to work as I wanted - which was to monitor the clipboard for any URLs and then paste them into mpv and then bring mpv to foreground
(I use Windows)
So with the help of AI here's the final lua script that does that:
This script works.
But... now that we have property with
clipboardI kinda need some help to shrink this long script to something more reasonable and efficient, are there any experts on the matter who can help me with that?By the way I tried using PowerShell for some of those functions and it appears that it's a bad idea since it's slow + takes much more CPU usage
All reactions