Chances are that the title makes absolutely no sense as I'm still a total newbie to linux in general, but basically what I'm trying to do is make a keyboard shortcut which would instantly make mpv play an url from my clipboard when I press Win+M.
I'm obviously totally misunderstanding how this works, as reading about piping I had gotten the idea that I'd have to use piping and tried things like xclip | mpv
and xclip -o | mpv
while having a youtube url on my clipboard, like https://www.youtube.com/watch?v=KqI6TOlPluo for an example, but it seems to just come up with the same stuff as if I only wrote mpv
with nothing else in the terminal. If somebody could clear up whether this is even possible would be really nice, Ubuntu seems like it'd be great if I learnt to use it a little better.
edit: As clarification, I want the result to be the same as just doing mpv https://www.youtube.com/watch?v=KqI6TOlPluo
You have to use command sub situation:
mpv "$(xclip -o -selection clipboard)"
or for primary x selection:
mpv "$(xclip -o -selection primary)"
Lets say your clipboard contains http://example.foo/video.mp4
, the result would be:
mpv "http://example.foo/video.mp4"
What you are doing is piping stdout of your first command which is the url, to the stdin of second command "mpv" which doesn't look for anything from stdin and even if it does (e.g: mpv -
) it looks for data to play and not a url or file address.
No comments:
Post a Comment